Skip to content

Commit

Permalink
enable clone viewer tool in image viewer
Browse files Browse the repository at this point in the history
(currently results in traceback, as shown in regression test)
  • Loading branch information
kecnry committed Mar 27, 2024
1 parent 5b9aa59 commit da08666
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions lcviz/tests/test_viewers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import pytest
from lightkurve import search_targetpixelfile


def test_reset_limits(helper, light_curve_like_kepler_quarter):
helper.load_data(light_curve_like_kepler_quarter)
Expand All @@ -19,6 +22,7 @@ def test_reset_limits(helper, light_curve_like_kepler_quarter):
assert tv.state.y_min == orig_ylims[0]


@pytest.mark.remote_data
def test_clone(helper, light_curve_like_kepler_quarter):
helper.load_data(light_curve_like_kepler_quarter)

Expand All @@ -27,3 +31,13 @@ def test_clone(helper, light_curve_like_kepler_quarter):

new_viewer = def_viewer._obj.clone_viewer()
assert helper._get_clone_viewer_reference(new_viewer._obj.reference) == 'flux-vs-time[2]'

# TODO: replace with test fixture
tpf = search_targetpixelfile("KIC 001429092",
mission="Kepler",
cadence="long",
quarter=10).download()
helper.load_data(tpf)
im_viewer = helper.viewers['image']
assert helper._get_clone_viewer_reference(im_viewer._obj.reference) == 'image[1]'
im_viewer._obj.clone_viewer()
2 changes: 1 addition & 1 deletion lcviz/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ class CubeView(CloneViewerMixin, CubevizImageView, WithSliceSelection):
['jdaviz:boxzoom'],
['jdaviz:panzoom'],
['bqplot:rectangle'],
['jdaviz:sidebar_plot', 'jdaviz:sidebar_export']
['lcviz:viewer_clone', 'jdaviz:sidebar_plot', 'jdaviz:sidebar_export']
]
# TODO: can we vary this default_class based on Kepler vs TESS, etc?
# see https://github.com/spacetelescope/lcviz/pull/81#discussion_r1469721009
Expand Down

0 comments on commit da08666

Please sign in to comment.