[AstroPy] Confusion about WCS origin

Christoph Deil Deil.Christoph at gmail.com
Wed Mar 18 11:59:12 EDT 2015


> On 18 Mar 2015, at 16:47, Rahul Patel <rahul.patel.1 at stonybrook.edu> wrote:
> 
> Dear David,
> 
>   Thank you for the quick response.  I understand that it refers to the origin convention depending on which type of data I'm using. However what I'm confused with is which one I should use.
> 

Hi Rahul,

I’m pretty sure you should use origin=1.

To confirm that this gives correct results, you can do this:
1) transform the pixel coordinate (0, 0) to world coordinates (with origin=1) using Astropy
2) open the image in ds9, zoom in on the lower-left pixel and read off the world coordinates of the pixel center

The world coordinates you get with method 1) and 2) should match (up to the error with which you manage to put your mouse pointer over the pixel center in ds9).

Hope that helps,
Christoph
> I'm loading a fits file, which is an origin of 1,1 . But the data loaded by astropy is in the form of a numpy array, hence to my understanding, an origin of 0,0. Perhaps I'm misunderstanding something fundamental.
> 
> On Mar 18, 2015 10:43 AM, "David Shupe" <shupe at ipac.caltech.edu <mailto:shupe at ipac.caltech.edu>> wrote:
> Dear Rahul,
> 
> The origin parameter corresponds to the convention for numbering the pixels. The convention used in FORTRAN and FITS files is that the center of the first pixel has pixel coordinates [1.0, 1.0]. In the convention used by C and Numpy, the center of the first pixel is [0.0, 0.0].  
> 
> Even though you are giving a Numpy array to the function, you must specify which pixel numbering convention you are using with the origin argument. 
> 
> If you view an image with ds9, you can see that it uses the FORTRAN/FITS convention for numbering pixels.
> 
> Regards,
> David
> 
>> On Mar 17, 2015, at 6:36 PM, Rahul Patel <rahul.patel.1 at stonybrook.edu <mailto:rahul.patel.1 at stonybrook.edu>> wrote:
>> 
>> Dear all,
>> 
>>    I am using the WCS package in astropy and ran into some confusion on what to set the origin. For instance, when transforming from pixel to wcs
>> 
>> world = w.wcs_pix2world(pixcrd, 1)
>> 
>> the doc says to use 0 for origin assuming C and numpy and 1 for fits and fortran. The above example uses "1" but everything loaded into python is a numpy array. Any clarification would be useful. Thank you.
>> 
>>  
>> 
>> 
>> Rahul I. Patel 
>> -----------------------------------------------------------------
>> Rahul.Patel.1 at StonyBrook.edu <mailto:Rahul.Patel.1 at stonybrook.edu>
>> Department of Physics and Astronomy
>> State University of New York at Stony Brook
>> WEB: http://www.astro.sunysb.edu/rpatel <http://www.astro.sunysb.edu/rpatel>
>> ----------------------------------------------------------------- 
>> _______________________________________________
>> AstroPy mailing list
>> AstroPy at scipy.org <mailto:AstroPy at scipy.org>
>> http://mail.scipy.org/mailman/listinfo/astropy <http://mail.scipy.org/mailman/listinfo/astropy>
> 
> 
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org <mailto:AstroPy at scipy.org>
> http://mail.scipy.org/mailman/listinfo/astropy <http://mail.scipy.org/mailman/listinfo/astropy>
> 
> _______________________________________________
> 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/20150318/7048c049/attachment.html>


More information about the AstroPy mailing list