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

Calling aiapy.calibrate.register repeatedly yields different results #74

Open
nabobalis opened this issue Nov 12, 2020 · 4 comments
Open
Labels
bug(?) calibrate has attachment Attachment was not transfered from GitLab

Comments

@nabobalis
Copy link
Contributor

In GitLab by @hayesla on Nov 12, 2020, 11:12

When playing around with aiapy.calibrate.register I found that if you pass a level 1.5 map again through this it changes the map. I suspect that this shouldn't happen? Maybe a check should go in when a map is passed to check the "lvl_num" meta keywords.

For example if you pass a registered map through aiapy.calibrate.register again and check the difference you can see some differences:

>>> my_map = sunpy.map.Map("aia_lev1_171a_2011_06_07t06_52_00_35z_image_lev1.fits")
>>> registered_map = aiapy.calibrate.register(my_map)
>>> registered_map2 = aiapy.calibrate.register(registered_map)
>>> test_diff = np.abs(registered_map.data - registered_map2.data)
>>> plt.imshow(test_diff, origin="lower", vmin=0, vmax = np.percentile(test_diff, 99.5))
>>> plt.colorbar()

image

maybe I'm missing something, and its probably unlikely to be done by a user, but it would be best to have a check for the level number in the function.

@nabobalis
Copy link
Contributor Author

In GitLab by @wtbarnes on Nov 14, 2020, 14:25

This is worrying. I'd agree that there should probably be a check on the level number. It doesn't really make sense to call the prep operation on a level 1.5 map. But I'm concerned about those differences. If the map has been rescaled, derotated, and centered already, subsequent rotate calls should not have an discernible effect.

The differences you show here are quite small (1e-9 whereas 171 counts are of order 1e3). I wonder if these differences are just due to interpolation? I guess a good test would doing many repeated calls on the map and looking at the distribution of differences.

@nabobalis
Copy link
Contributor Author

In GitLab by @wtbarnes on Nov 15, 2020, 11:18

!94 added a check to raise a warning to at least alert the user that they're calling register on a map with a processing level > 1.

I don't think this completely resolves the issue though. Looking into this a bit more, I called register repeatedly on a 171 map and took the difference between the two and just looked at the distribution of values. The legend indicates the number of times register was called on the data so "0-1" refers to the level 1 minus the level 1.5 map, "1-2" refers to the level 1.5 map minus a map that has had register run on it twice, etc.

Figure_1

You can see that the distribution of differences doesn't significantly narrow to essentially 0 until register has been called for a fourth time. I'm not completely sure what to make of this. I suspect that this is something that should be dealt with upstream in sunpy as well.

@nabobalis
Copy link
Contributor Author

In GitLab by @wtbarnes on Nov 15, 2020, 11:26

Note that even for the 1-2 case (calling register once versus twice, orange), the distribution of differences is symmetric and most of the differences are quite small compared to the difference between a registered and non-registered map (blue distribution). Though there still are a few pixels with differences of order 1e3 in the 1-2 case.

@nabobalis
Copy link
Contributor Author

In GitLab by @wtbarnes on Apr 30, 2021, 05:41

changed health status to needs attention

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug(?) calibrate has attachment Attachment was not transfered from GitLab
Projects
None yet
Development

No branches or pull requests

1 participant