Skip to content

Improve pixel <-> sky region conversions#650

Open
larrybradley wants to merge 12 commits intoastropy:mainfrom
larrybradley:conv-wcs-distortion
Open

Improve pixel <-> sky region conversions#650
larrybradley wants to merge 12 commits intoastropy:mainfrom
larrybradley:conv-wcs-distortion

Conversation

@larrybradley
Copy link
Member

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):

  • Green: polygonized regions (using Add to_polygon method to region classes #649) -- taken as "truth". Polygon regions transform "exactly" (ignoring spherical projection)
  • Red: conversions based on regions main (a single scale factor applied to all shape axes)
  • White: conversions based on this PR -- which gives better results
    jcdua3f4q_flc
    jcdua3f4q_flc_zoom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant