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

Prevent repeatedly updating previews in specviz2d spectral extraction #2862

Merged
merged 4 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -161,6 +161,8 @@ Specviz
Specviz2d
^^^^^^^^^

- Prevent laggy behavior in trace previews for spectral extraction. [#2862]

3.10 (2024-05-03)
=================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ def update_marks(self, step=None):
raise ValueError("step must be one of: trace, bg, ext")

# also listens to is_active from any _interaction_in_*_step methods
kecnry marked this conversation as resolved.
Show resolved Hide resolved
@observe('is_active', 'active_step')
@skip_if_not_tray_instance()
def _update_plugin_marks(self, msg={}):
if self.app._jdaviz_helper is None:
Expand Down Expand Up @@ -527,10 +528,10 @@ def _update_interactive_extract(self, event={}):
'trace_pixel', 'trace_peak_method_selected',
'trace_do_binning', 'trace_bins', 'trace_window', 'active_step')
@skip_if_not_tray_instance()
@skip_if_no_updates_since_last_active()
def _interaction_in_trace_step(self, event={}):
if ((event.get('name', '') in ('active_step', 'is_active') and self.active_step != 'trace')
or not self.is_active):
self._update_plugin_marks(event)
return

try:
Expand All @@ -546,16 +547,15 @@ def _interaction_in_trace_step(self, event={}):
self._update_interactive_extract(event)

self.active_step = 'trace'
self._update_plugin_marks(event)

@observe('is_active', 'bg_dataset_selected', 'bg_type_selected',
'bg_trace_selected', 'bg_trace_pixel',
'bg_separation', 'bg_width', 'bg_statistic_selected', 'active_step')
@skip_if_not_tray_instance()
@skip_if_no_updates_since_last_active()
def _interaction_in_bg_step(self, event={}):
if ((event.get('name', '') in ('active_step', 'is_active') and self.active_step != 'bg')
or not self.is_active):
self._update_plugin_marks(event)
return

try:
Expand Down Expand Up @@ -599,15 +599,14 @@ def _interaction_in_bg_step(self, event={}):
self._update_interactive_extract(event)

self.active_step = 'bg'
self._update_plugin_marks(event)

@observe('is_active', 'ext_dataset_selected', 'ext_trace_selected',
'ext_type_selected', 'ext_width', 'active_step')
@skip_if_not_tray_instance()
@skip_if_no_updates_since_last_active()
def _interaction_in_ext_step(self, event={}):
if ((event.get('name', '') in ('active_step', 'is_active') and self.active_step not in ('ext', '')) # noqa
or not self.is_active):
self._update_plugin_marks(event)
return

try:
Expand All @@ -633,7 +632,6 @@ def _interaction_in_ext_step(self, event={}):
self._update_interactive_extract(event)

self.active_step = 'ext'
self._update_plugin_marks(event)

# TODO: remove this, the traitlet, and the row in spectral_extraction.vue
# when specutils handles the warning/exception
Expand Down
Loading