-
-
Notifications
You must be signed in to change notification settings - Fork 581
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
Fix for aiaprep - issue #1691 #1756
Changes from all commits
1710e8b
0464e6c
e4299af
056119f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.DS_Store | ||
.idea | ||
.pydevproject | ||
.settings | ||
.project | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
""" | ||
Provides processing routines for data captured with the AIA instrument on SDO. | ||
""" | ||
import numpy as np | ||
import astropy.units as u | ||
|
||
from sunpy.map.sources.sdo import AIAMap | ||
|
@@ -49,7 +50,15 @@ def aiaprep(aiamap): | |
scale = 0.6*u.arcsec # pragma: no cover # can't test this because it needs a full res image | ||
scale_factor = aiamap.scale.x / scale | ||
|
||
newmap = aiamap.rotate(recenter=True, scale=scale_factor.value, missing=aiamap.min()) | ||
tempmap = aiamap.rotate(recenter=True, scale=scale_factor.value, missing=aiamap.min()) | ||
|
||
# extract center from padded aiamap.rotate output | ||
# crpix1 and crpix2 will be equal (recenter=True), as aiaprep does not work with submaps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do you assure it doesn't work for a submap? I've just tried and it didn't show any error or warning that I should not being doing this. Maybe raising an error if the dimensions are not right would be better than just proceed as normal and produce bad data: >>> saia_map = aia_map.submap(u.Quantity([30, 809], u.pix), u.Quantity([35, 789], u.pix))
>>> saia_map_prep = sunpy.instr.aia.aiaprep(saia_map)
>>> saia_map.dimensions
Pair(x=<Quantity 779.0 pix>, y=<Quantity 754.0 pix>)
>>> saia_map_prep.dimensions
Pair(x=<Quantity 754.0 pix>, y=<Quantity 741.0 pix>)
>>> saia_map.xrange
>>> <Quantity [-1156.8, 712.8] arcsec>
>>> saia_map_prep.xrange
<Quantity [-903.6, 906. ] arcsec>
>>> saia_map.yrange
<Quantity [-1144.8, 664.8] arcsec>
>>> saia_map_prep.yrange
<Quantity [-873.6, 904.8] arcsec> |
||
center = np.floor(tempmap.meta['crpix1']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why do you only use crpix1? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. crpix1 and crpix2 will always be the same (recenter=True) - aiaprep doesn't work on submaps There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add that as a comment to clairify for future Stu?! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment and docstring? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just an inline comment above the line will suffice, it's a suble implementation detail that's all. |
||
range_side = (center + np.array([-1, 1]) * aiamap.data.shape[0] / 2) * u.pix | ||
newmap = tempmap.submap(range_side, range_side) | ||
|
||
newmap.meta['r_sun'] = newmap.meta['rsun_obs'] / newmap.meta['cdelt1'] | ||
newmap.meta['lvl_num'] = 1.5 | ||
|
||
return newmap |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,8 @@ | |
def test_aiaprep(): | ||
# Test that header info for the map has been correctly updated | ||
# Check all of these for Map attributes and .meta values? | ||
# Check array shape | ||
assert prep_map.data.shape == original.data.shape | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. additionally a test that catches the submap case would be good. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any suggestions on how to do that? Just checking the equality of the dimensions wouldn't be sufficient. Rather than raising an error, how about a warning and document that aiaprep should be used before anything else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer an error than a warning, as warning could be disable... and this should be a "not to do". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All AIA images are 4096x4096. There's a Quality keyword that, if non-zero, indicates through bit flags if it's a calibration image, dark image, etc. |
||
# Check crpix values | ||
assert prep_map.meta['crpix1'] == prep_map.data.shape[1]/2.0 + 0.5 | ||
assert prep_map.meta['crpix2'] == prep_map.data.shape[0]/2.0 + 0.5 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The routine
aiaprep
now guaranteed to return 4096 by 4096 pixel map.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wafels It will also work for full-disk images that have been resized (2048^2, 1024^2, etc.), but not submaps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So full field of view and centered on the Sun? What is the problem with
submaps?
On Mon, May 16, 2016 at 12:48 PM, Larry Manley notifications@github.com
wrote:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aiaprep is for derotating, recentering, and scaling to exactly 0.6 arcsec/pixel and is therefore not appropriate for submaps.