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
aiaprep returns wrong array size #1691
Comments
intresting, does |
I believe so; there's some padding in there, not sure if it's necessary... |
intersting. I will try and take a look. I guess this is a part of @ayshih change where he added the padding so the image is not cropped. |
Perhaps we need a "keepdims" flag that returns an image the same size as On Tue, Mar 1, 2016 at 4:02 PM, Stuart Mumford notifications@github.com
|
I presume that is precisely the case. I'm not sure I like @wafels's suggestion of a |
Is it one pixel on all four sides that is padded? As far as submapping, does that have implications for memory fragmentation when processing large amounts of data? AIA images have nothing but noise on the outer 1-2 pixels. How about a non-padded form of rotate internal to aiaprep? I would also recommend being able to specify 'missing' and 'order' directly from aiaprep. |
To be clear, it's not padding just for the sake of padding. The dimensions of the data array are expanded to ensure that no data is cropped out during the rotation. For example, for the "worst case" of a 45-degree rotation, the dimension would be expanded up by a multiplicative factor of sqrt(2) (so, here, to ~5793 pixels on a side). Because no data is cropped out, the expansion is effectively symmetric around the center of the map (which may not be the same as the origin of the coordinate system).
There is no memory fragmentation considerations for submapping; you're creating a whole new Map object. There will be a small performance hit from the additional step of object creation, but that's unlikely to be a significant component compared to other processing (e.g., the rotation itself).
Definitely not a fan of this. I think that my suggestion is the most Pythonic approach.
You should probably create a new issue so that your request doesn't get buried. |
I thought map.rotate always rotated around the centre of the HPC system (i.e. centre of disk?)
I agree with @ayshih, cropping in aiaprep is the easiest solution for maintanability. I do wonder what is the most physically correct way to crop, is it to crop to 4096x4096 or is it to crop to some physical arcsecond size? I suppose if we are cropping after the scaling to 0.6" has taken place they are the same thing, we would be cropping to 4096*0.6"=2457.6" across? |
ping @drewleonard42 |
If I remember rightly, it does by default, but doesn't have to. I could be wrong, I've not looked at it in a while.
Presumably this means when we come to crop the image back again, we'll have to do so around the centre of the array rather than the origin? |
Well aiaprep aligns the centre of the disk to the centre of the image no? |
Excellent point. I should not try to have these conversations before I've woken up properly.... |
What I meant was that the default behavior of Of course, as pointed out above,
In a related vein, my snarky response to this issue as written would have been "And...?". What do users actually need here? Do they need pixel dimensions of exactly 4096 on a side? Do they need data dimensions of a specific spatial extent? |
@ayshih as far as I see it the argument here goes that the rotation will never crop useful data off if the array size is maintained (there is no data in the corners where the padding saves the data), at least for full disk AIA images. So why bother padding? |
Agreed, for This issue says that |
@ayshih I agree that it should be an instrument specific decision. |
Can someone come up with a systematic way to submap 4096x4096 coming out of aiaprep? The above values will vary slightly depending on time of year and point in orbit, so the padding could potentially go a little above 4108. |
As @Cadair as much suggested, you can crop to the "central" 4096x4096 region (since |
Thinking about this, would the correct logic be the follwing pesudo code: centre = np.floor(CRPIX[0])
left_x = centre-4096/2
right_x = centre+4096/2
out = in[left_y:right_y, left_x:right_x] ? |
That will work. |
submap([left, right] * u.pix, [left, right] * u.pix) |
Will anything in the tests need to be changed/added to implement this? |
@larrymanley just a new test for aiaprep to make sure it doesn't regress at some point in the future. |
@larrymanley why is |
@Cadair Can you give me some guidance on how to use the roll image in a test? It's in the sample data, not the test data. I tried downloading it directly as an online test, but it's a fits.gz file and wouldn't open. It worked a few weeks ago, and I know astropy will open .gz files. |
I would do something like the following: @pytest.mark.online
def test_aiaprep():
sunpy.data.download_sample_data(overwrite=False)
aiamap = sunpy.map.Map(AIA_171_ROLL_IMAGE) |
I noticed that 'aiaprep' returns a 4098x4098 array rather than a 4096x4096 array.
The text was updated successfully, but these errors were encountered: