Skip to content

Commit

Permalink
enable stretch histogram in 2d spectrum viewers (#2407)
Browse files Browse the repository at this point in the history
* show stretch histogram for 2d spectrum viewers
* handle inverted x-axis for when limiting histogram to zoom limits
  • Loading branch information
kecnry authored Sep 1, 2023
1 parent 96e8a6c commit 1577249
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Imviz
Mosviz
^^^^^^

- Plot options now includes the stretch histogram previously implemented for Imviz/Cubeviz. [#2407]

Specviz
^^^^^^^

Expand All @@ -41,6 +43,8 @@ Specviz
Specviz2d
^^^^^^^^^

- Plot options now includes the stretch histogram previously implemented for Imviz/Cubeviz. [#2407]

API Changes
-----------

Expand Down
11 changes: 8 additions & 3 deletions jdaviz/configs/default/plugins/plot_options/plot_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,11 @@ def _update_stretch_histogram(self, msg={}):
x_data = data.get_component(data.components[1]).data
y_data = data.get_component(data.components[0]).data

inds = np.where((x_data >= viewer.state.x_min) &
(x_data <= viewer.state.x_max) &
inverted_x = getattr(viewer, 'inverted_x_axis', False)
x_min = viewer.state.x_min if not inverted_x else viewer.state.x_max
x_max = viewer.state.x_max if not inverted_x else viewer.state.x_min
inds = np.where((x_data >= x_min) &
(x_data <= x_max) &
(y_data >= viewer.state.y_min) &
(y_data <= viewer.state.y_max))

Expand Down Expand Up @@ -759,5 +762,7 @@ def _viewer_is_image_viewer(self):
# check is avoided, whenever possible).
from jdaviz.configs.imviz.plugins.viewers import ImvizImageView
from jdaviz.configs.cubeviz.plugins.viewers import CubevizImageView
from jdaviz.configs.mosviz.plugins.viewers import MosvizImageView, MosvizProfile2DView

return isinstance(self.viewer.selected_obj, (ImvizImageView, CubevizImageView))
return isinstance(self.viewer.selected_obj, (ImvizImageView, CubevizImageView,
MosvizImageView, MosvizProfile2DView))

0 comments on commit 1577249

Please sign in to comment.