diff --git a/jdaviz/configs/imviz/plugins/coords_info/coords_info.py b/jdaviz/configs/imviz/plugins/coords_info/coords_info.py index 6d8b15f19e..002523894d 100644 --- a/jdaviz/configs/imviz/plugins/coords_info/coords_info.py +++ b/jdaviz/configs/imviz/plugins/coords_info/coords_info.py @@ -12,7 +12,7 @@ from jdaviz.configs.mosviz.plugins.viewers import (MosvizImageView, MosvizProfileView, MosvizProfile2DView) from jdaviz.configs.specviz.plugins.viewers import SpecvizProfileView -from jdaviz.core.events import ViewerAddedMessage, GlobalDisplayUnitChanged +from jdaviz.core.events import ViewerAddedMessage, GlobalDisplayUnitChanged, SnackbarMessage from jdaviz.core.helpers import data_has_valid_wcs from jdaviz.core.marks import PluginScatter, PluginLine from jdaviz.core.registries import tool_registry @@ -120,8 +120,15 @@ def _on_viewer_added(self, msg): self._create_viewer_callbacks(self.app.get_viewer_by_id(msg.viewer_id)) def _on_global_display_unit_changed(self, msg): - # eventually should observe change in flux OR angle - if msg.axis == "flux": + + # display units of mouseover should reflect choice of selected flux and + # angle unit, as well as the toggled display unit type for the spectrum + # viewer (flux or sb). e.g if data loaded is in MJy / sr, and the spectrum + # viewer is toggled to 'flux', mouseover should show data in MJy. + + self.hub.broadcast(SnackbarMessage(f"In _on_global_display_unit_changed, msg = {msg.axis} unit = {msg.unit}", color='error', sender=self)) + + if msg.axis == "spectral_y": self.image_unit = u.Unit(msg.unit) @property diff --git a/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py b/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py index 6b5bc11619..80a408cf32 100644 --- a/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py +++ b/jdaviz/configs/specviz/plugins/unit_conversion/unit_conversion.py @@ -262,7 +262,8 @@ def _on_flux_unit_changed(self, msg): self.spectrum_viewer.state.y_display_unit = yunit self.spectrum_viewer.reset_limits() - # and broacast that there has been a change in flux + # and broacast that there has been a change in the spectral axis y unit + # to either a flux or surface brightness unit self.hub.broadcast(GlobalDisplayUnitChanged("spectral_y", flux_or_sb, sender=self)) if not check_if_unit_is_per_solid_angle(self.spectrum_viewer.state.y_display_unit):