diff --git a/CHANGES.rst b/CHANGES.rst index 9c5df7fcdc..be30ea870f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -70,6 +70,9 @@ Cubeviz Imviz ^^^^^ +* Do not hide previous results in aperture photometry when there is a failure, but rather show + the failure message within the plugin UI to indicate the shown results are "out of date". [#2112] + Mosviz ^^^^^^ diff --git a/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py b/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py index d9994f334b..9616567df4 100644 --- a/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py +++ b/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.py @@ -45,6 +45,7 @@ class SimpleAperturePhotometry(PluginTemplateMixin, DatasetSelectMixin, TableMix counts_factor = Any(0).tag(sync=True) flux_scaling = Any(0).tag(sync=True) result_available = Bool(False).tag(sync=True) + result_failed_msg = Unicode("").tag(sync=True) results = List().tag(sync=True) plot_types = List([]).tag(sync=True) current_plot_type = Unicode().tag(sync=True) @@ -90,19 +91,11 @@ def __init__(self, *args, **kwargs): self.session.hub.subscribe(self, SubsetUpdateMessage, handler=self._on_subset_update) self.session.hub.subscribe(self, LinkUpdatedMessage, handler=self._on_link_update) - def reset_results(self): - self.result_available = False - self.results = [] - self.plot_available = False - self.radial_plot = '' - bqplot_clear_figure(self._fig) - @observe('dataset_selected') def _dataset_selected_changed(self, event={}): try: self._selected_data = self.dataset.selected_dc_item if self._selected_data is None: - self.reset_results() return self.counts_factor = 0 self.pixel_area = 0 @@ -143,7 +136,6 @@ def _dataset_selected_changed(self, event={}): self.pixel_area = 0.04 * 0.04 except Exception as e: - self.reset_results() self._selected_data = None self.hub.broadcast(SnackbarMessage( f"Failed to extract {self.dataset_selected}: {repr(e)}", @@ -174,7 +166,6 @@ def _on_link_update(self, msg): def _subset_selected_changed(self, event={}): subset_selected = event.get('new', self.subset_selected) if self._selected_data is None or subset_selected == '': - self.reset_results() return try: @@ -196,7 +187,6 @@ def _subset_selected_changed(self, event={}): except Exception as e: self._selected_subset = None - self.reset_results() self.hub.broadcast(SnackbarMessage( f"Failed to extract {subset_selected}: {repr(e)}", color='error', sender=self)) @@ -249,7 +239,6 @@ def _bg_subset_selected_changed(self, event={}): def vue_do_aper_phot(self, *args, **kwargs): if self._selected_data is None or self._selected_subset is None: - self.reset_results() self.hub.broadcast(SnackbarMessage( "No data for aperture photometry", color='error', sender=self)) return @@ -430,14 +419,15 @@ def vue_do_aper_phot(self, *args, **kwargs): else: bqplot_marks = [bqplot_line] - self._fig.marks = bqplot_marks - except Exception as e: # pragma: no cover - self.reset_results() - self.hub.broadcast(SnackbarMessage( - f"Aperture photometry failed: {repr(e)}", color='error', sender=self)) - + bqplot_clear_figure(self._fig) + msg = f"Aperture photometry failed: {repr(e)}" + self.hub.broadcast(SnackbarMessage(msg, color='error', sender=self)) + self.result_failed_msg = msg else: + self.result_failed_msg = '' + self._fig.marks = bqplot_marks + # Parse results for GUI. tmp = [] for key in phot_table.colnames: diff --git a/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.vue b/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.vue index fb49bba3f3..690ef28cd2 100644 --- a/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.vue +++ b/jdaviz/configs/imviz/plugins/aper_phot_simple/aper_phot_simple.vue @@ -139,6 +139,12 @@ + + + WARNING: {{result_failed_msg}} + + +