From 5d8e01bcfaef7d5fee3bce8b173c31e25b34ff56 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Mon, 13 Nov 2023 20:56:30 -0500 Subject: [PATCH] Add folding period to ephemeris viewers axis label --- lcviz/plugins/ephemeris/ephemeris.py | 3 +++ lcviz/viewers.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lcviz/plugins/ephemeris/ephemeris.py b/lcviz/plugins/ephemeris/ephemeris.py index b4064f18..803cebe3 100644 --- a/lcviz/plugins/ephemeris/ephemeris.py +++ b/lcviz/plugins/ephemeris/ephemeris.py @@ -468,6 +468,9 @@ def round_to_1(x): 1./1000000) self.t0_step = round_to_1(self.period/1000) + # update x axis label + self.phase_viewer.set_plot_axes() + if not self._default_initialized: # other plugins that use EphemerisSelect don't see the first entry yet self._default_initialized = True diff --git a/lcviz/viewers.py b/lcviz/viewers.py index e057939e..7cd3aed1 100644 --- a/lcviz/viewers.py +++ b/lcviz/viewers.py @@ -219,9 +219,14 @@ def ephemeris_component(self): def _set_plot_x_axes(self, dc, component_labels, light_curve): # setting of y_att will be handled by ephemeris plugin self.state.x_att = dc[0].components[component_labels.index(f'phase:{self.ephemeris_component}')] # noqa - self.figure.axes[0].label = 'phase' self.figure.axes[0].num_ticks = 5 + ephem = self.jdaviz_helper.plugins.get('Ephemeris', None) + if ephem: + self.figure.axes[0].label = f'phase (P = {ephem.period:.2g} d)' + else: + self.figure.axes[0].label = 'phase' + def times_to_phases(self, times): ephem = self.jdaviz_helper.plugins.get('Ephemeris', None) if ephem is None: