[AstroPy] Question about WCS distortion coefficients

Michael Droettboom mdroe at stsci.edu
Wed Dec 17 09:35:43 EST 2014


You can, as David suggests, initialize an astropy.wcs.WCS object from a 
FITS header.

You can also create the SIP coefficients programmatically, as in the 
following example:

|from astropy import wcs
import numpy as np

w = wcs.WCS()
sip = wcs.Sip([[1.03, 0.98], [1.03, 0.76]], [[1.03, 0.98], [1.03, 0.76]],
               [[1.03, 0.98], [1.03, 0.76]], [[1.03, 0.98], [1.03, 0.76]], [0, 0])
w.sip = sip
print w.all_pix2world([[2, 3]], 1)
|

The |Sip| constructor is documented further here: 
http://astropy.readthedocs.org/en/latest/api/astropy.wcs.Sip.html#astropy.wcs.Sip
and don’t hesitate to ask with further questions.

Cheers,
Mike

On 12/16/2014 05:22 PM, David Shupe wrote:

>
>> On Dec 16, 2014, at 11:50 AM, Brian York <york at stsci.edu 
>> <mailto:york at stsci.edu>> wrote:
>>
>> On 2014/12/16 13:59 , "Paul Kuin" <npkuin at gmail.com 
>> <mailto:npkuin at gmail.com>> wrote:
>>
>>> see
>>> Shupe, D.L., et al., 2005, Astronomical Data Analysis Soft-
>>>
>>> ware and Systems XIV ASP Conference Series, Vol. 347, Proceedings of the
>>> Conference held 24-27 October, 2004 in Pasadena, California, USA. Edited
>>> by P. Shopbell, M. Britton, and R. Ebert. San Francisco: Astronomical
>>> Soci- ety of the Pacific, 2005., p.491
>>
>> Thank you. This is definitely a helpful resource. What it does not 
>> have is
>> any information about modifying an astropy.wcs.WCS object to include 
>> these
>> coefficients (given that I am building one programmatically). Do you have
>> any suggestions on that?
>>
>> -Brian
>
> Brian, I have extensive experience in converting polynomials in 
> various formats to WCS and SIP keywords suitable for inclusion in FITS 
> headers. I haven’t worked much yet with the astropy.wcs.WCS class, but 
> it does look like the constructor can take a dictionary of the 
> keywords. I have some conversion functions written in Python and I’d 
> be happy to help you off-list with converting your polynomials.
>
> Regards,
>
> David Shupe
> IPAC/Caltech
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy

​

-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute

http://www.droettboom.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20141217/c15bca92/attachment.html>


More information about the AstroPy mailing list