How to define axis names in WCS

389 Views Asked by At

I'm trying to use WCS for simple linear, non-celestial axes. These are actually just the U,V coordinates representing the Fourier transform of an image.

import astropy.wcs as wcs
w=wcs.WCS(naxis=2)
w.wcs.axis_types[0]=0
w.wcs.axis_types[1]=0
w.wcs.ctype[0]='UU---SIN'
w.wcs.ctype[1]='VV---SIN'
print(w)
ww=w.deepcopy()

As I read the documentation for axis_types, I have specified that the first two axes are are linear axes (i.e. non-celestial). However when the deep copy executes, I get an error:

astropy.wcs._wcs.InconsistentAxisTypesError: ERROR 4 in wcs_types() at line 2486 of file cextern/wcslib/C/wcs.c:
Unrecognized celestial type (UU---SIN in CTYPE1).

What am I doing wrong?

Thanks, Tim

3

There are 3 best solutions below

0
Tim Cornwell On

Ah, I see that axis_types is an attribute and cannot be set in this way. It's apparent when trying to do: w.wcs.axis_types=[0,0] . Still not sure how to do this correctly.

1
keflavich On

Instead of UU---SIN and VV---SIN, just use UU and VV. wcs is recognizing that the SIN projection indicates a celestial coordinate system, but UU and VV do not describe any celestial coordinate system.

import astropy.wcs as wcs
w=wcs.WCS(naxis=2)
w.wcs.ctype[0]='UU'
w.wcs.ctype[1] = 'VV'
w.deepcopy()

This raises a question, though, of whether there is a well-defined convention for (presumably gridded?) UV data in FITS images.

0
Eric Greisen On

I believe AIPS still does this and I am disappointed that WCSLIB objects. UU---SIN etc seems a right way to describe what we have in such gridded images. Actually FFT does use this axis type while UVIMG simply uses U and V.