Skip to content

Commit

Permalink
include flux-vs-phase:default from init
Browse files Browse the repository at this point in the history
  • Loading branch information
kecnry committed Mar 8, 2024
1 parent 16cdfe1 commit 8fa6b24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lcviz/plugins/viewer_creator/viewer_creator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from jdaviz.configs.default.plugins import ViewerCreator
from jdaviz.core.events import NewViewerMessage
from jdaviz.core.events import NewViewerMessage, ViewerAddedMessage
from jdaviz.core.registries import tool_registry
from lcviz.events import EphemerisComponentChangedMessage
from lcviz.viewers import TimeScatterView
Expand All @@ -25,7 +25,8 @@ def _rebuild_available_viewers(self, *args):
phase_viewers = [{'name': f'lcviz-phase-viewer:{e}', 'label': f'flux-vs-phase:{e}'}
for e in self.app._jdaviz_helper.plugins['Ephemeris'].component.choices] # noqa
else:
phase_viewers = []
phase_viewers = [{'name': 'lcviz-phase-viewer:default',
'label': 'flux-vs-phase:default'}]

self.viewer_types = [v for v in self.viewer_types if v['name'].startswith('lcviz')
and not v['label'].startswith('flux-vs-phase')] + phase_viewers
Expand Down
7 changes: 5 additions & 2 deletions lcviz/tests/test_plugin_ephemeris.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ def test_create_phase_viewer(helper, light_curve_like_kepler_quarter):
ephem = helper.plugins['Ephemeris']
vc = helper._tray_tools['lcviz-viewer-creator']

assert len(vc.viewer_types) == 1 # just time viewer
assert len(vc.viewer_types) == 2 # time viewer, phase viewer for default
_ = ephem.create_phase_viewer()
assert len(vc.viewer_types) == 2
assert len(ephem._obj._get_phase_viewers()) == 1

vc.vue_create_viewer('flux-vs-phase:default')
assert len(ephem._obj._get_phase_viewers()) == 2
Expand All @@ -134,3 +134,6 @@ def test_create_phase_viewer(helper, light_curve_like_kepler_quarter):

for pv in ephem._obj._get_phase_viewers():
assert pv._ephemeris_component == 'renamed'

ephem.add_component('new')
assert len(vc.viewer_types) == 3

0 comments on commit 8fa6b24

Please sign in to comment.