[AstroPy] Problem running pywcs example

Peter Erwin erwin at mpe.mpg.de
Fri Aug 20 10:08:36 EDT 2010


Hi Mike,

You should be able to download it directly from the SDSS archive, via:

http://das.sdss.org/imaging/94/40/corr/2/fpC-000094-g2-0220.fit.gz


cheers,

Peter

On Aug 20, 2010, at 3:42 PM, Michael Droettboom wrote:

> Peter,
> 
> Can you send me one of your FITS files with CTYPE1 == "DEC--TAN" so I 
> can investigate this further?
> 
> Mike
> 
> On 08/20/2010 08:42 AM, Peter Erwin wrote:
>> Hi Mike,
>> 
>> Thanks for the "sub" suggestion... however, that seems to have the side effect of reversing
>> the x,y output order from new_wcs.wcs_sky2pix when the FITS header has CTYPE1="DEC--TAN"
>> 
>> i.e., the output from new_wsc.wcs_sky2pix(ra, dec) is [ array([y]), array([x]) ] when
>> CTYPE1="DEC--TAN", instead of [ array([x]), array([y]) ]
>> 
>> cheers,
>> 
>> Peter
>> 
>> On Aug 19, 2010, at 8:24 PM, Michael Droettboom wrote:
>> 
>> 
>>> I've added a note in the documentation about this.
>>> 
>>> Also of note is the "sub" method which creates a new WCS with the axes
>>> in the order you specify.  Therefore, given an arbitrary WCS where you
>>> don't know the order of the axes (or even how many axes it has), you can do:
>>> 
>>>    new_wcs = wcs.sub(['latitude', 'longitude'])
>>> 
>>> to get a new wcs that will always work in (ra, dec).
>>> 
>>> http://stsdas.stsci.edu/astrolib/pywcs/api_wcs.html#pywcs.WCS.sub
>>> 
>>> Mike
>>> 
>>> On 08/19/2010 12:22 PM, Peter Erwin wrote:
>>> 
>>>> Hi Mike,
>>>> 
>>>> It probably would be useful to mention the units explicitly in the documentation, yes.
>>>> 
>>>> Your note about the RA,Dec order depending on the CTYPE arguments does help
>>>> explain some weird, inconsistent results I was getting for SDSS images (some of which
>>>> turned out to have CTYPE1="DEC--TAN", while the majority have CTYPE1="RA--TAN").
>>>> That explains why WCS.wcs_pix2sky was returning (RA, Dec) for some images and
>>>> (Dec, RA) for others.
>>>> 
>>>> It might be useful putting a short note about this in the documentation, since I expect
>>>> a fair number of people will be like me (i.e., expecting things to be RA,Dec by default
>>>> and unaware that this can be mixed up depending on the details of the image header).
>>>> 
>>>> cheers,
>>>> 
>>>> Peter
>>>> 
>>>> On Aug 19, 2010, at 4:11 PM, Michael Droettboom wrote:
>>>> 
>>>> 
>>>> 
>>>>> On 08/19/2010 09:23 AM, Michael Droettboom wrote:
>>>>> 
>>>>> 
>>>>>> On 08/18/2010 03:56 PM, Peter Erwin wrote:
>>>>>> 
>>>>>> 
>>>>>>> Hi Mike,
>>>>>>> 
>>>>>>> Thanks for the quick reply!
>>>>>>> 
>>>>>>> It looks like what happened is that *was* an earlier version of pywcs hiding
>>>>>>> in /Users/erwin/lib/python [as opposed to
>>>>>>> /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6 ,
>>>>>>> which is where pywcs 1.9 got installed].  Possibly it got installed as part of
>>>>>>> an earlier installation of stsci_python ...
>>>>>>> 
>>>>>>> Anyway, I nuked the earlier installation, and now pywcs seems to work.
>>>>>>> 
>>>>>>> 
>>>>>>> Am I missing something, or does the documentation for pywcs mention anywhere what
>>>>>>> "sky coordinates" actually means (i.e., allowed formats, types, order, etc.?).
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> The order is described in the wcs_sky2pix docstring:
>>>>>> """
>>>>>> Either two or three arguments may be provided.
>>>>>> 	• 2 arguments: An N x naxis array of x- and y-coordinates, and an origin.
>>>>>> 	• 3 arguments: 2 one-dimensional arrays of x and y coordinates, and an origin.
>>>>>> """
>>>>>> 
>>>>>> As for types, it may be any numeric type (and the underlying calculations are performed in doubles).
>>>>>> 
>>>>>> 
>>>>> And for additional clarification, I should add that the order (whether it's [dec, ra] or [ra, dec]) depends on the CTYPEia arguments in the FITS header.  You can determine that programmatically (if necessary) from the .lat, .lng, .lattype and .lngtype members.
>>>>> 
>>>>> Mike
>>>>> 
>>>>> -- 
>>>>> Michael Droettboom
>>>>> Science Software Branch
>>>>> Space Telescope Science Institute
>>>>> Baltimore, Maryland, USA
>>>>> 
>>>>> _______________________________________________
>>>>> AstroPy mailing list
>>>>> AstroPy at scipy.org
>>>>> http://mail.scipy.org/mailman/listinfo/astropy
>>>>> 
>>>>> 
>>>> =============================================================
>>>> Peter Erwin                   Max-Planck-Insitute for Extraterrestrial
>>>> erwin at mpe.mpg.de              Physics, Giessenbachstrasse
>>>> tel. +49 (0)89 30000 3695     85748 Garching, Germany
>>>> fax  +49 (0)89 30000 3495     http://www.mpe.mpg.de/~erwin
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> AstroPy mailing list
>>>> AstroPy at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/astropy
>>>> 
>>>> 
>>> 
>>> -- 
>>> Michael Droettboom
>>> Science Software Branch
>>> Space Telescope Science Institute
>>> Baltimore, Maryland, USA
>>> 
>>> _______________________________________________
>>> AstroPy mailing list
>>> AstroPy at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/astropy
>>> 
>> =============================================================
>> Peter Erwin                   Max-Planck-Insitute for Extraterrestrial
>> erwin at mpe.mpg.de              Physics, Giessenbachstrasse
>> tel. +49 (0)89 30000 3695     85748 Garching, Germany
>> fax  +49 (0)89 30000 3495     http://www.mpe.mpg.de/~erwin
>> 
>> 
>> 
>> _______________________________________________
>> AstroPy mailing list
>> AstroPy at scipy.org
>> http://mail.scipy.org/mailman/listinfo/astropy
>> 
> 
> 
> -- 
> Michael Droettboom
> Science Software Branch
> Space Telescope Science Institute
> Baltimore, Maryland, USA
> 
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy

=============================================================
Peter Erwin                   Max-Planck-Insitute for Extraterrestrial 
erwin at mpe.mpg.de              Physics, Giessenbachstrasse
tel. +49 (0)89 30000 3695     85748 Garching, Germany
fax  +49 (0)89 30000 3495     http://www.mpe.mpg.de/~erwin






More information about the AstroPy mailing list