Table Of Contents

Previous topic

Example Usage

Next topic

WCS

This Page

API documentation

pywcs

Pywcs provides transformations following the SIP conventions, Paper IV table lookup distortion, and the core WCS functionality provided by wcslib. Each of these transformations can be used independently or together in a standard pipeline.

The basic workflow is as follows:

  1. import pywcs
  2. Call the pywcs.WCS constructor with a pyfits header and/or hdulist object.
  3. Optionally, if the FITS file uses any deprecated or non-standard features, you may need to call one of the fix methods on the object.
  4. Use one of the following transformation methods:
    • all_pix2sky: Perform all three transformations from pixel to sky coordinates.
    • wcs_pix2sky: Perform just the core WCS transformation from pixel to sky coordinates.
    • wcs_sky2pix: Perform just the core WCS transformation from sky to pixel coordinates.
    • sip_pix2foc: Convert from pixel to focal plane coordinates using the SIP polynomial coefficients.
    • sip_foc2pix: Convert from focal plane to pixel coordinates using the SIP polynomial coefficients.
    • p4_pix2foc: Convert from pixel to focal plane coordinates using the table lookup distortion method described in Paper IV.
    • det2im: Convert from detector coordinates to image coordinates. Commonly used for narrow column correction.

Testing pywcs

The unit tests are written for use with nose. To run them, install pywcs and then at the commandline:

nosetests pywcs.tests