Skip to content

Commit

Permalink
Add submap vs slice test that is failing
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Apr 25, 2024
1 parent 98e0b0a commit afc8c52
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sunpy/map/tests/test_mapbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import sunpy.coordinates
import sunpy.map
import sunpy.sun
from ndcube.tests.helpers import assert_cubes_equal
from sunpy.coordinates import HeliographicCarrington, HeliographicStonyhurst, sun
from sunpy.data.test import get_dummy_map_from_header, get_test_filepath
from sunpy.image.transform import _rotation_registry
Expand Down Expand Up @@ -1859,3 +1860,16 @@ def test_set_wcs_modifies_crpix(aia171_test_map, aslice, dims):
aia171_test_map.meta["CRPIX2"])

assert np.allclose(sliced_ref_coord, ori_ref_coord)

def test_slicing_map_submap(aia171_test_map):
bl_coord = SkyCoord(-1000 * u.arcsec, 0 * u.arcsec, frame=aia171_test_map.coordinate_frame)
bottom_left = aia171_test_map.wcs.world_to_pixel(bl_coord)

tp_coord = SkyCoord(0 * u.arcsec, 1000 * u.arcsec, frame=aia171_test_map.coordinate_frame)
top_right = aia171_test_map.wcs.world_to_pixel(tp_coord)

submap = aia171_test_map.submap(bottom_left*u.pix, top_right=top_right*u.pix)
sliced_map = aia171_test_map[int(bottom_left[1]):int(top_right[1]) + 1,
int(bottom_left[0]):int(top_right[0]) + 1]

assert_cubes_equal(submap, sliced_map, check_data=True)

0 comments on commit afc8c52

Please sign in to comment.