Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add folding period to ephemeris viewers axis label #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lcviz/plugins/ephemeris/ephemeris.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion lcviz/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,14 @@
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)'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this rounding could be deceptive.... can we use tex to show ~=?

We could also add a settings expansion menu and make this a togglable option (having phase:ephemeris_component might also be an option people want in some cases, and actually briefly happens sometimes since that is the name of the data component). It would be really cool if we had some presets for the labels but also allowed custom formatting 😉

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting back to this - I think for now this is a good improvement, if we can use tex to avoid rounding confusion. Let's defer anything else to potential follow-up work 🐱.

else:
self.figure.axes[0].label = 'phase'

Check warning on line 228 in lcviz/viewers.py

View check run for this annotation

Codecov / codecov/patch

lcviz/viewers.py#L228

Added line #L228 was not covered by tests

def times_to_phases(self, times):
ephem = self.jdaviz_helper.plugins.get('Ephemeris', None)
if ephem is None:
Expand Down