Skip to content

Commit

Permalink
Backport PR #3242: prevent spectral lines from converting y-range (#3266
Browse files Browse the repository at this point in the history
)

Co-authored-by: Gilbert Green <42986583+gibsongreen@users.noreply.github.com>
  • Loading branch information
meeseeksmachine and gibsongreen authored Nov 1, 2024
1 parent 5921669 commit 64cb2c2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Bug Fixes
- Fixed Aperture Photometry radial profile fit crashing when NaN is present in
aperture data for Cubeviz and Imviz. [#3246]

- Prevent PluginMarks from converting y-range so they maintain their position
in the spectrum-viewer when spectral y units are converted. [#3242]

Cubeviz
^^^^^^^

Expand Down
6 changes: 6 additions & 0 deletions jdaviz/core/marks.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ def _on_global_display_unit_changed(self, msg):
return
axis = axis_map.get(msg.axis, None)
if axis is not None:
scale = self.scales.get(axis, None)
# if PluginMark mark is LinearScale(0, 1), prevent it from entering unit conversion
# machinery so it maintains it's position in viewer.
if isinstance(scale, LinearScale) and (scale.min, scale.max) == (0, 1):
return

getattr(self, f'set_{axis}_unit')(msg.unit)

def clear(self):
Expand Down

0 comments on commit 64cb2c2

Please # to comment.