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

[map branch] Add simple submap vs slice test #7600

Draft
wants to merge 1 commit into
base: map_ndcube_migration
Choose a base branch
from
Draft
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
19 changes: 19 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 @@ -1866,3 +1867,21 @@
aia171_test_map.meta["CRPIX2"])

assert np.allclose(sliced_ref_coord, ori_ref_coord)

def test_slicing_map_submap_same(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)

Check warning on line 1873 in sunpy/map/tests/test_mapbase.py

View check run for this annotation

Codecov / codecov/patch

sunpy/map/tests/test_mapbase.py#L1872-L1873

Added lines #L1872 - L1873 were not covered by tests

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)

Check warning on line 1876 in sunpy/map/tests/test_mapbase.py

View check run for this annotation

Codecov / codecov/patch

sunpy/map/tests/test_mapbase.py#L1875-L1876

Added lines #L1875 - L1876 were not covered by tests

bottom_left_x, bottom_left_y = map(int, bottom_left)
top_right_x, top_right_y = map(int, top_right)

Check warning on line 1879 in sunpy/map/tests/test_mapbase.py

View check run for this annotation

Codecov / codecov/patch

sunpy/map/tests/test_mapbase.py#L1878-L1879

Added lines #L1878 - L1879 were not covered by tests

submap = aia171_test_map.submap([bottom_left_x, bottom_left_y]*u.pix,

Check warning on line 1881 in sunpy/map/tests/test_mapbase.py

View check run for this annotation

Codecov / codecov/patch

sunpy/map/tests/test_mapbase.py#L1881

Added line #L1881 was not covered by tests
top_right=[top_right_x, top_right_y]*u.pix
)

sliced_map = aia171_test_map[bottom_left_y : top_right_y + 1, bottom_left_x: top_right_x + 1]

Check warning on line 1885 in sunpy/map/tests/test_mapbase.py

View check run for this annotation

Codecov / codecov/patch

sunpy/map/tests/test_mapbase.py#L1885

Added line #L1885 was not covered by tests

assert_cubes_equal(submap, sliced_map)

Check warning on line 1887 in sunpy/map/tests/test_mapbase.py

View check run for this annotation

Codecov / codecov/patch

sunpy/map/tests/test_mapbase.py#L1887

Added line #L1887 was not covered by tests
Loading