-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Bug in coordinate transform with WCSLib 5 #3891
Labels
Milestone
Comments
astrofrog
added
Bug
Affects-dev
PRs and issues that do not impact an existing Astropy release
wcs
labels
Jun 26, 2015
Wow. That's sure something. Looking into it now. |
The change to WCSLib 5 also broke a test in Gammapy: Here's the print output corresponding to this test case that shows that the issue is in the WCS transformations, it doesn't round-trip: import numpy as np
from astropy.wcs import WCS
from gammapy.image import make_header
header = make_header(nxpix=2, nypix=1, binsz=10, xref=0, yref=0, proj='CAR')
# GLON pixel edges: (+10, 0, -10)
# GLAT pixel edges: (-5, +5)
EPS = 0.1
data = [
( 5, 5, 1), # in image[0, 0]
( 0, 0 + EPS, 2), # in image[1, 0]
( 5, -5 + EPS, 3), # in image[0, 0]
( 5, 5 + EPS, 99), # outside image
(10 + EPS, 0, 99), # outside image
]
lon, lat, weights = np.array(data).T
wcs = WCS(header)
origin = 0
x, y = wcs.wcs_world2pix(lon, lat, origin)
lon2, lat2 = wcs.wcs_pix2world(x, y, origin)
print(wcs)
print()
print('weights : ', weights)
print('lon : ', lon)
print('lon2 : ', lon2)
print('lat : ', lat)
print('lat2 : ', lat2)
print('x : ', x)
print('y : ', y) Output:
I didn't check if #3893 fixes this case also. |
Fixed by #3893. |
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
The change to WCSLib 5 has led to a bug in the following use case:
Before 7bac470
After 7bac470
This was discovered using the WCSAxes test suite: astrofrog/wcsaxes#168
cc @mdboom
The text was updated successfully, but these errors were encountered: