diff --git a/docs/imviz/plugins.rst b/docs/imviz/plugins.rst index 898854fe14..a9f4d47370 100644 --- a/docs/imviz/plugins.rst +++ b/docs/imviz/plugins.rst @@ -128,11 +128,7 @@ an interactively selected region. A typical workflow is as follows: 4. Select the desired region using the :guilabel:`Subset` dropdown menu. 5. If you want to subtract background before performing photometry, you have the following 3 options. Otherwise if your image is already - background subtracted, choose "Manual" and leave the background set at 0. - If you change the linking (see :ref:`imviz-link-control`) after you have - a background calculated from Annulus or Subset, you need to re-select - the aperture or background subset, respectively, to have it properly - recalculated: + background subtracted, choose "Manual" and leave the background set at 0: * Manual: Enter the background value in the :guilabel:`Background value` field. This value must be in the same unit as display data, if applicable. diff --git a/jdaviz/configs/imviz/helper.py b/jdaviz/configs/imviz/helper.py index a12567037c..eb6662d938 100644 --- a/jdaviz/configs/imviz/helper.py +++ b/jdaviz/configs/imviz/helper.py @@ -500,10 +500,6 @@ def link_image_data(app, link_type='pixels', wcs_fallback_scheme='pixels', wcs_u if update_plugin and 'imviz-links-control' in [item['name'] for item in app.state.tray_items]: link_plugin = app.get_tray_item_from_name('imviz-links-control') link_plugin.linking_in_progress = True - app.hub.broadcast(LinkUpdatedMessage(link_type, - wcs_fallback_scheme == 'pixels', - wcs_use_affine, - sender=app)) else: link_plugin = None @@ -573,5 +569,10 @@ def link_image_data(app, link_type='pixels', wcs_fallback_scheme='pixels', wcs_u 'Images successfully relinked', color='success', timeout=8000, sender=app)) if link_plugin is not None: + # Only broadcast after success. + app.hub.broadcast(LinkUpdatedMessage(link_type, + wcs_fallback_scheme == 'pixels', + wcs_use_affine, + sender=app)) # reset the progress spinner link_plugin.linking_in_progress = False 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 3f8e22a482..8fcfee56ad 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 @@ -21,7 +21,7 @@ from traitlets import Any, Bool, List, Unicode, observe from jdaviz.core.custom_traitlets import FloatHandleEmpty -from jdaviz.core.events import SnackbarMessage +from jdaviz.core.events import SnackbarMessage, LinkUpdatedMessage from jdaviz.core.region_translators import regions2aperture from jdaviz.core.registries import tray_registry from jdaviz.core.template_mixin import PluginTemplateMixin, DatasetSelectMixin, SubsetSelect @@ -76,6 +76,7 @@ def __init__(self, *args, **kwargs): self._fitted_model_name = 'phot_radial_profile' 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 @@ -172,6 +173,13 @@ def _on_subset_update(self, msg): elif sbst.label == self.bg_subset_selected and sbst.data.label == self.dataset_selected: self._bg_subset_selected_changed() + def _on_link_update(self, msg): + if self.dataset_selected == '' or self.subset_selected == '': + return + + # Force background auto-calculation to update when linking has changed. + self._bg_subset_selected_changed() + @observe('subset_selected') def _subset_selected_changed(self, event={}): subset_selected = event.get('new', self.subset_selected)