Skip to content

Commit

Permalink
update location of phase-indicator on change to ephemeris
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Mar 11, 2024
1 parent a12aff0 commit 5b9aa59
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lcviz/plugins/time_selector/time_selector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from jdaviz.configs.cubeviz.plugins import Slice
from jdaviz.core.registries import tray_registry

from lcviz.events import EphemerisChangedMessage
from lcviz.viewers import CubeView, PhaseScatterView

__all__ = ['TimeSelector']
Expand Down Expand Up @@ -42,6 +43,9 @@ def __init__(self, *args, **kwargs):
self.value_unit = 'd'
self.allow_disable_snapping = True

self.session.hub.subscribe(self, EphemerisChangedMessage,
handler=self._on_ephemeris_changed)

@property
def slice_axis(self):
# global display unit "axis" corresponding to the slice axis
Expand All @@ -68,3 +72,11 @@ def _on_select_slice_message(self, msg):
self.value = self.value + (new_phase - prev_phase) * viewer.ephemeris.get('period', 1.0)
else:
super()._on_select_slice_message(msg)

def _on_ephemeris_changed(self, msg):
for viewer in self.slice_indicator_viewers:
if not isinstance(viewer, PhaseScatterView):
continue
if viewer._ephemeris_component != msg.ephemeris_label:
continue
viewer._set_slice_indicator_value(self.value)

0 comments on commit 5b9aa59

Please sign in to comment.