Skip to content

Commit

Permalink
BUG: Not all viewers have get_limits (#3361)
Browse files Browse the repository at this point in the history
Add test and change log.

Test was proven to fail on main locally.
  • Loading branch information
pllim authored Dec 18, 2024
1 parent 0b144b1 commit f41f4af
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ Bug Fixes
occured when certain flux-to flux-conversions occured, as well as certain conversions between flux and surface
brightness. This PR also fixed an issue with unit string formatting in the aperture photometry plugin. [#3228]

- Fixed broken histogram pan/zoom in Plot Options plugin. [#3361]

Cubeviz
^^^^^^^
- Removed the deprecated ``save as fits`` option from the Collapse, Moment Maps, and Spectral Extraction plugins; use the Export plugin instead. [#3256]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ def test_stretch_histogram(cubeviz_helper, spectrum1d_cube_with_uncerts):
assert po.stretch_histogram.marks['vmin'].x[0] == po.stretch_vmin.value
assert po.stretch_histogram.marks['vmax'].x[0] == po.stretch_vmax.value

# Make sure some tools work

po_panzoom = po.stretch_histogram.toolbar.tools["jdaviz:panzoom"]
po_panzoom.activate()
po_panzoom.deactivate()

po_prevzoom = po.stretch_histogram.toolbar.tools["jdaviz:prevzoom"]
po_prevzoom.activate()


@pytest.mark.filterwarnings('ignore')
def test_user_api(cubeviz_helper, spectrum1d_cube):
Expand Down
5 changes: 4 additions & 1 deletion jdaviz/core/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ class _BaseZoomHistory:
# Mixin for custom zoom tools to be able to save their previous zoom state
# which is then used by the PrevZoom tool
def save_prev_zoom(self):
self.viewer._prev_limits = self.viewer.get_limits()
# Cannot use viewer.get_limits() here because viewers from
# glue-jupyter does not have that method.
self.viewer._prev_limits = (self.viewer.state.x_min, self.viewer.state.x_max,
self.viewer.state.y_min, self.viewer.state.y_max)


class _MatchedZoomMixin:
Expand Down

0 comments on commit f41f4af

Please sign in to comment.