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] Adopt GenericMap.submap to use NDCube.crop underneath #7605

Open
wants to merge 3 commits into
base: map_ndcube_migration
Choose a base branch
from

Conversation

hayesla
Copy link
Member

@hayesla hayesla commented Apr 26, 2024

This PR is add NDCube.crop within GenericMap.submap

@hayesla hayesla requested a review from a team as a code owner April 26, 2024 10:40
@wtbarnes wtbarnes changed the title Adopt GenericMap.submap to use NDCube.crop underneath [map branch] Adopt GenericMap.submap to use NDCube.crop underneath Apr 26, 2024
@hayesla
Copy link
Member Author

hayesla commented May 27, 2024

ok, so I think this is mostly working. Two issues we need to consider:

  1. How we deal with slicing to a single pixel, which can happen of course when people use SkyCoord etc where this may not be as obvious as this example. This works with the current implementation of submap in sunpy
>>> aia_map = sunpy.map.Map(sunpy.data.sample.AIA_171_IMAGE)
>>> aia_map.submap([0, 0]*u.pixel, top_right=[0, 0]*u.pixel)

ValueError: Input points causes cube to be cropped to a single pixel. This is not supported.
  1. How we deal with reducing the number of dimensions. This can of course be dealt with in the submap function, just interested in peoples thoughts.
>>> aia_map.submap([0, 0]*u.pixel, top_right=[0, 2]*u.pixel)

TypeError: It is not possible to slice a map with an integer as it will reduce the number of data dimensions by one.
In order to apply the same slice without dropping a dimension do mymap[:2, 1:2].

@hayesla
Copy link
Member Author

hayesla commented May 27, 2024

just fyi - thats why I've commented out these tests. I'll adjust when we figure it out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants