=======
sip_tpv
=======

Utilities for converting between the SIP convention for representing distortion
in FITS images, and the TPV convention. Usage may look like::

    from astropy.io import fits
    from sip_tpv import pv_to_sip

    hdulist = fits.open('input.fits')
    for hdu in hdulist:
        pv_to_sip(hdu.header)

(hdulist is a collection of HDU objects)

Command-line tools
==================
Installing the package also provides ``sip_to_pv`` and ``pv_to_sip`` commands
that convert the header of one HDU in a FITS file and write a new file::

    sip_to_pv input_sip.fits output_tpv.fits
    pv_to_sip input_tpv.fits output_sip.fits --extension SCI

``--extension`` takes an HDU index or EXTNAME (default 0). ``pv_to_sip`` also
computes the reverse SIP coefficients (AP/BP); use ``--no-add-reverse`` to skip
them. Run either command with ``--help`` for all options. The underscore
spellings of options used in version 1.x (e.g. ``--preserve_sip``) are still
accepted.

License
=======
Licensed under a 3-clause BSD style license - see LICENSE.txt

This module includes the equations for converting from the SIP distortion representation
to the PV or TPV representations, following the SPIE proceedings paper at
http://proceedings.spiedigitallibrary.org/proceeding.aspx?articleid=1363103
and http://web.ipac.caltech.edu/staff/shupe/reprints/SIP_to_PV_SPIE2012.pdf .

The work described in that paper is extended to 7th order.

Copyright (c) 2012-2026, California Institute of Technology

If you make use of this work, please cite::

    "More flexibility in representing geometric distortion in astronomical images,"
    Shupe, David L.; Laher, Russ R.; Storrie-Lombardi, Lisa; Surace, Jason; Grillmair, Carl;
    Levitan, David; Sesar, Branimir, 2012, in Software and Cyberinfrastructure for
    Astronomy II. Proceedings of the SPIE, Volume 8451, article id. 84511M.

Contributors
============
* David Shupe, IPAC/Caltech (shupe@ipac.caltech.edu)
* Austin Beauchamp (austinbeauch@gmail.com)

Thanks also to
--------------
* Thanks to Octavi Fors for contributing code modifications for better modularization, and for extensive testing.
* Funding is acknowledged from NASA to the NASA Herschel Science Center and the
  Spitzer Science Center.
