From a54b5b08c131a062bbb929229dd2ea417a160ee3 Mon Sep 17 00:00:00 2001 From: "Brett M. Morris" Date: Wed, 31 Jul 2024 12:34:58 -0400 Subject: [PATCH] add test for nddata translation with non-WCS coords --- glue_astronomy/translators/tests/test_nddata.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/glue_astronomy/translators/tests/test_nddata.py b/glue_astronomy/translators/tests/test_nddata.py index e55a557..26a4dbc 100644 --- a/glue_astronomy/translators/tests/test_nddata.py +++ b/glue_astronomy/translators/tests/test_nddata.py @@ -11,7 +11,7 @@ from glue.core import Data, DataCollection from glue.core.component import Component -from glue.core.coordinates import Coordinates +from glue.core.coordinates import Coordinates, IdentityCoordinates WCS_CELESTIAL = WCS(naxis=2) WCS_CELESTIAL.wcs.ctype = ['RA---TAN', 'DEC--TAN'] @@ -222,3 +222,17 @@ def test_meta_round_trip(): assert len(image_new.meta) == 2 assert image_new.meta['BUNIT'] == 'Jy/beam' assert image_new.meta['some_variable'] == 10 + + +def test_other_coords(): + coords = IdentityCoordinates(n_dim=2) + + flux = [[2, 3], [4, 5]] * u.Jy + ndd = NDDataArray(data=flux) + + data_collection = DataCollection() + + data_collection['image'] = ndd + data_collection['image'].coords = coords + round_trip_ndd = data_collection['image'].get_object(cls=NDDataArray) + assert round_trip_ndd.shape == (2, 2)