[AstroPy] Inverting SIP distortions

David Berry d.berry at jach.hawaii.edu
Fri Nov 1 13:40:13 EDT 2013


I've seen several SIP headers where the inverse transformation given by the
AP* BP* headers is a poor inverse of the forward transformation given by
the A* B* headers. In fact this issue was discussed recently on the astropy
list (subject "Running wcs_pix2world for all image pixels") in the context
of a header presented by Maik Riechert, which showed a similar problem.
>From that case I came to the conclusion that astropy ignroes the AP/BP
headers and creates its own inverse transformation based on the forward
transformation - maybe I was wrong.

For what it's worth, pyast does in fact do this - so it should always
provide a good inverse for a SIP header.

David


On 1 November 2013 11:56, Michael Droettboom <mdroe at stsci.edu> wrote:

> On 10/31/2013 08:08 PM, Jacob Vanderplas wrote:
> > Hello,
> > I'm working on a problem that requires the inversion of SIP
> > corrections: that is, I have points in world coordinates that I want
> > to project onto an image plane.
> >
> > My FITS header contains both the (A_p_q, B_p_q) coefficients for the
> > forward transformation, as well as the (AP_p_q, BP_p_q) required for
> > the backward transformation, according to the Shupe et al 2005
> > reference.
> >
> > The astropy WCS object has methods sip_foc2pix() and sip_pix2foc(),
> > which appeared to be what I needed, but these don't seem to actually
> > invert each other. That is:
> >
> >>>> from astropy.wcs import WCS
> >>>> wcs = WCS(header)
> >>>> Xpix = [[1, 1]]
> >>>> Xfoc = wcs.sip_pix2foc(Xpix, 0)
> >>>> print wcs.sip_foc2pix(Xfoc, 0)
> > [[ 1.2522118   1.74039233]]
> >
> > I would have expected this to recover the input pixels, but it's
> > clearly not the case.  Is there any functionality in astropy that will
> > utilize the available AP/BP coefficients in my header to perform the
> > inverse SIP distortion?  Is there anything I'm doing wrong or missing
> > here?
> I would have expected the above to work.  Are we sure the AP* and BP*
> coeffs are a true inverse of the A* and B* ones?  You can send me the
> FITS file directly (off-list) and I'd be happy to have a look.
>
> Mike
>
>
> --
>                     _
> |\/|o _|_  _. _ | | \.__  __|__|_|_  _  _ ._ _
> |  ||(_| |(_|(/_| |_/|(_)(/_|_ |_|_)(_)(_)| | |
>
> http://www.droettboom.com
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20131101/7b587765/attachment.html>


More information about the AstroPy mailing list