Skip to content

Commit

Permalink
change messaging
Browse files Browse the repository at this point in the history
  • Loading branch information
cshanahan1 committed Aug 14, 2024
1 parent cddd7a8 commit 63f895d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
13 changes: 10 additions & 3 deletions jdaviz/configs/imviz/plugins/coords_info/coords_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 63f895d

Please sign in to comment.