[AstroPy] WCS solutions from table HDUs

Simon Walker s.r.walker101 at googlemail.com
Sat Nov 28 15:51:23 EST 2015


I feel I’ve just answered my own question, by finding the `keysel` argument to `WCS.__init__`.

In my case, the following gives a valid wcs solution object:

```
from astropy.io import fits
from astropy.wcs import WCS

header = fits.getheader(filename, tablename)
wcs = WCS(header, keysel=[‘pixel’])
```

Thanks,
Simon

> On 27 Nov 2015, at 18:07, Simon Walker <s.r.walker101 at googlemail.com> wrote:
> 
> Hi,
> 
> When I try to read the wcs header from a table HDU, the returned wcs object is not valid (i.e. it maps pixel coordinates to pixel coordinates.)
> 
> My understanding is that `astropy.wcs` uses `wcslib` under the hood to handle most of the implementation, and `wcslib` supports table HDUs just fine. An example astrometric solution is given below:
> 
> TCTYP3  = 'RA---ZPN'           / WCS projection
> TCTYP6  = 'DEC--ZPN'           / WCS projection
> TCRVL3  =     307.241977403642 / RA at reference pixel
> TCRVL6  =     25.3168420637255 / Dec at reference pixel
> TCRPX3  =         1024.4417725
> TCRPX6  =          1023.831605
> TC3_3   = -0.00140653080291281
> TC6_6   = -0.00140646456957538
> TC3_6   =  1.3189450212842E-05
> TC6_3   = -1.3038301062367E-05
> TV6_1   =                   1.
> TV6_3   =     9.26153828229481
> TV6_5   =    -938.934425623138
> TV6_7   =     688883.879115836
> 
> I’ve seen these keywords mentioned in the Paper I description, and I believe they are valid. The solution creates a valid astrometric solution when using the equivalent image wcs keywords (CD1_1, CRPIX etc.).
> 
> If this is not supported I’d be happy to attempt an implementation - I am relatively familiar with `wcslib`. My knowledge of the standard however is a little shaky.
> 
> Thanks,
> Simon Walker




More information about the AstroPy mailing list