Skip to content

Commit 49d7644

Browse files
nabobalisCadair
andcommitted
Update ndcube/tests/helpers.py
Co-authored-by: Stuart Mumford <[email protected]>
1 parent 63cc3cf commit 49d7644

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ndcube/tests/helpers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from numpy.testing import assert_equal
1414

1515
import astropy
16-
from astropy.wcs.wcsapi import SlicedLowLevelWCS
16+
from astropy.wcs.wcsapi import BaseHighLevelWCS
1717
from astropy.wcs.wcsapi.fitswcs import SlicedFITSWCS
1818
from astropy.wcs.wcsapi.low_level_api import BaseLowLevelWCS
1919
from astropy.wcs.wcsapi.wrappers.sliced_wcs import sanitize_slices
@@ -145,11 +145,11 @@ def assert_wcs_are_equal(wcs1, wcs2):
145145
assert wcs1.pixel_bounds == wcs2.pixel_bounds
146146
if wcs1.pixel_shape is not None:
147147
random_idx = np.random.randint(wcs1.pixel_shape,size=[10,wcs1.pixel_n_dim])
148-
# SlicedLowLevelWCS vs HighLevelWCS don't have the same pixel_to_world method
149-
if isinstance(wcs1, SlicedLowLevelWCS):
150-
np.testing.assert_array_equal(wcs1.pixel_to_world_values(*random_idx.T), wcs2.pixel_to_world_values(*random_idx.T))
151-
else:
152-
np.testing.assert_array_equal(wcs1.pixel_to_world(*random_idx.T), wcs2.pixel_to_world(*random_idx.T))
148+
# SlicedLowLevelWCS vs BaseHighLevelWCS don't have the same pixel_to_world method
149+
low_level_wcs = wcs1
150+
if isinstance(wcs1, BaseHighLevelWCS):
151+
low_level_wcs = wcs1.low_level_wcs
152+
np.testing.assert_array_equal(low_level_wcs.pixel_to_world_values(*random_idx.T), low_level_wcs.pixel_to_world_values(*random_idx.T))
153153

154154
def create_sliced_wcs(wcs, item, dim):
155155
"""

0 commit comments

Comments
 (0)