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

Error in wcs.py #416

Closed
Russell-Ryan opened this issue Jul 27, 2022 · 1 comment · Fixed by #423
Closed

Error in wcs.py #416

Russell-Ryan opened this issue Jul 27, 2022 · 1 comment · Fixed by #423
Assignees
Labels

Comments

@Russell-Ryan
Copy link

Russell-Ryan commented Jul 27, 2022

The line 870+ of wcs.py to reference the document https://trs.jpl.nasa.gov/bitstream/handle/2014/40409/JPL%20Pub%2007-3%20%20w%20Errata.pdf?sequence=3&isAllowed=y

However, the equations coded up seem to be different from what is in the above document. If you re-index the angles as l0, l1, l2, l3 (and similarly for phi) and assuming that $\lambda_{-1}=\lambda_{3}$ (in the notation of the document), then the 870 should become:

area=np.abs((l1-l3)(np.sin(phi0)-np.sin(phi2)) + (l0-l2)(np.sin(phi3)-np.sin(phi1)))/2.

This gives correct pixel areas.

@mcara
Copy link
Member

mcara commented Sep 26, 2022

Just to note, the code referred to in the above comment is:

gwcs/gwcs/wcs.py

Lines 870 to 877 in f6098a6

l1, phi1 = np.deg2rad(self.__call__(*(crpix - 0.5)))
l2, phi2 = np.deg2rad(self.__call__(*(crpix + [-0.5, 0.5])))
l3, phi3 = np.deg2rad(self.__call__(*(crpix + 0.5)))
l4, phi4 = np.deg2rad(self.__call__(*(crpix + [0.5, -0.5])))
area = np.abs(0.5 * ((l4 - l2) * np.sin(phi1) +
(l1 - l3) * np.sin(phi2) +
(l2 - l4) * np.sin(phi3) +
(l3 - l2) * np.sin(phi4)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants