Improve pixel <-> sky region conversions#650
Open
larrybradley wants to merge 12 commits intoastropy:mainfrom
Open
Improve pixel <-> sky region conversions#650larrybradley wants to merge 12 commits intoastropy:mainfrom
larrybradley wants to merge 12 commits intoastropy:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves the pixel <-> sky region conversions, especially for WCS with distortions:
For non-distorted astropy WCS objects, the pixel scale is computed
from 1-pixel offsets along both the x and y axes, with the geometric
mean taken as the local isotropic scale. The North angle is computed by
offsetting in latitude by exactly this local pixel scale, ensuring the
finite-difference derivative is evaluated at the appropriate angular
scale.
Sky-to-pixel and pixel-to-sky coordinate conversions now use the
local WCS Jacobian matrix for WCS objects with distortions (e.g., SIP
polynomial corrections) or non-astropy WCS objects (e.g., GWCS). This
provides accurate directional scale factors along each axis of directed
regions (ellipses, rectangles, and their annuli) under distorted WCS,
rather than assuming an isotropic pixel scale.
Example
Regions originally defined in Sky coordinates in a non-distorted WCS image, then converted to pixel-based regions with a distorted WCS (an HST ACS/WFC FLC image whose WCS has both SIP and tabular distortions):
main(a single scale factor applied to all shape axes)