Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix unnecessary stretch histogram updates #3151

Merged
merged 3 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ Other Changes and Additions
Bug Fixes
---------

- Stretch histogram in zoom limits no longer attempts unnecessary updates when zoom limits are changed. [#3151]

Cubeviz
^^^^^^^

Expand Down
6 changes: 3 additions & 3 deletions jdaviz/configs/default/plugins/plot_options/plot_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ def state_attr_for_line_visible(state):
state_filter=is_image)

self.stretch_histogram = Plot(self, name='stretch_hist', viewer_type='histogram',
update_callback=self._update_stretch_histogram)
update_callback=self._request_update_stretch_histogram)
# Add the stretch bounds tool to the default Plot viewer.
self.stretch_histogram.tools_nested.append(["jdaviz:stretch_bounds"])
self.stretch_histogram._initialize_toolbar(["jdaviz:stretch_bounds"])
Expand Down Expand Up @@ -938,7 +938,7 @@ def _update_stretch_histogram(self, msg={}):
or not self.stretch_hist_zoom_limits):
vs = viewer.state
for attr in ('x_min', 'x_max', 'y_min', 'y_max'):
vs.add_callback(attr, self._update_stretch_histogram)
vs.add_callback(attr, self._request_update_stretch_histogram)
if isinstance(msg, dict) and msg.get('name') == 'viewer_selected':
viewer_label_old = msg.get('old')
if isinstance(viewer_label_old, list):
Expand All @@ -947,7 +947,7 @@ def _update_stretch_histogram(self, msg={}):
if viewer_label_old in self.app._viewer_store:
vs_old = self.app.get_viewer(viewer_label_old).state
for attr in ('x_min', 'x_max', 'y_min', 'y_max'):
vs_old.remove_callback(attr, self._update_stretch_histogram)
vs_old.remove_callback(attr, self._request_update_stretch_histogram)

if not len(self.layer.selected_obj):
# skip further updates if no data are available:
Expand Down
Loading