diff --git a/CHANGES.rst b/CHANGES.rst index be60611660..5f59f51fa2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -83,6 +83,7 @@ Imviz Mosviz ^^^^^^ +- Fix typo where zoom Dec retrieval used RA instead. [#1992] Specviz ^^^^^^^ diff --git a/jdaviz/configs/mosviz/helper.py b/jdaviz/configs/mosviz/helper.py index 593c2619cb..ad286e1d98 100644 --- a/jdaviz/configs/mosviz/helper.py +++ b/jdaviz/configs/mosviz/helper.py @@ -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 diff --git a/jdaviz/configs/mosviz/tests/test_parsers.py b/jdaviz/configs/mosviz/tests/test_parsers.py index aba3452d99..5e690e4d79 100644 --- a/jdaviz/configs/mosviz/tests/test_parsers.py +++ b/jdaviz/configs/mosviz/tests/test_parsers.py @@ -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 @@ -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):