sunpy icon indicating copy to clipboard operation
sunpy copied to clipboard

[Discussion] Create a set of rules around cropping and pixel inclusion

Open CyclingNinja opened this issue 7 months ago • 4 comments

When cropping in a cube, how do we want pixel inclusions behavior to be at the bounding box boundary

CyclingNinja avatar Jun 19 '25 11:06 CyclingNinja

If you submap(-0.5, 0.5) you get a (1,1) array, ditto for (-0.25, 25)

Currently you can pass pixel coords to submap, but we don't want that to be the case going forward.

Fundamentally, any pixels within your bounding box, should be returned. However there are some very specific edgecases.

Should crop be inclusive of exclusive? we're defining a pixel as -0.5->+0.499999.

CyclingNinja avatar Jun 19 '25 11:06 CyclingNinja

Image

for context to help with our discussions 🫠

hayesla avatar Jun 19 '25 11:06 hayesla

Now agreed that submap should be inclusive as is the case currently on NDCube crop. i.e. submap includes top right.

So in the case of submap(bottom_left=(-0.5, -0.5) * u.pix, top_right=(0.5, 0.5) * u.pix) returns a 2 x 2 map.

Because 0.5, 0.5 is in the top right most pixel.

CyclingNinja avatar Jun 19 '25 11:06 CyclingNinja

So in the case of submap(bottom_left=(-0.5, -0.5) * u.pix, top_right=(0.5, 0.5) * u.pix) returns a 2 x 2 map.

I strongly disagree with this result

ayshih avatar Jun 19 '25 15:06 ayshih