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

Fix Mosviz Zoom Bug Typo #1992

Merged
merged 5 commits into from
Feb 7, 2023
Merged
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
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Imviz

Mosviz
^^^^^^
- Fix typo where zoom Dec retrieval used RA instead. [#1992]

Specviz
^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/configs/mosviz/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def _zoom_to_object_params(self, msg):
return None, None

ra = table_data["R.A."][msg.selected_index]
dec = table_data["R.A."][msg.selected_index]
dec = table_data["Dec."][msg.selected_index]

if (ra == FALLBACK_NAME) or (dec == FALLBACK_NAME):
return None, None
Expand Down
9 changes: 9 additions & 0 deletions jdaviz/configs/mosviz/tests/test_parsers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from zipfile import ZipFile

import pytest
from numpy.testing import assert_allclose
from astropy.utils.data import download_file

from jdaviz.utils import PRIHDR_KEY, COMMENTCARD_KEY
Expand Down Expand Up @@ -142,6 +143,14 @@ def test_niriss_parser(mosviz_helper, tmp_path):
assert COMMENTCARD_KEY not in dc_1.meta
assert dc_1.meta['bunit_data'] == 'MJy/sr' # ASDF metadata

# We should be centered on the coordinates of the first data point
imview = mosviz_helper.app.get_viewer(mosviz_helper._default_image_viewer_reference_name)
x_pixcenter = (imview.state.x_max + imview.state.x_min)/2.0
y_pixcenter = (imview.state.y_max + imview.state.y_min)/2.0
viewer_center_coord = imview.layers[0].layer.coords.pixel_to_world(x_pixcenter, y_pixcenter)
assert_allclose(viewer_center_coord.ra.deg, dc_tab["R.A."][0])
assert_allclose(viewer_center_coord.dec.deg, dc_tab["Dec."][0])

# Test all the spectra exist
for dispersion in ('R', 'C'):
for sourceid in (243, 249):
Expand Down