[AstroPy] [Pywcs] pywcs.WCS.cd array

Ole Streicher astropy at liska.ath.cx
Thu Apr 14 07:35:08 EDT 2011

Dear list,

when I try top access the individual coefficients of a pywcs.WCS object:

import pyfits, pywcs

d = {'NAXIS':3,
     'CD1_1':-4.12e-5, 'CD1_2':-3.72e-5, 'CD1_3':0,
     'CD2_1':-3.72e-5, 'CD2_2': 4.12e-5, 'CD2_3':0,
     'CD3_1': 0,       'CD3_2': 0,       'CD3_3':0.2,
     'CUNIT1':'deg', 'CUNIT2':'deg', 'CUNIT3':'nm',
     'CTYPE1':'RA---TAN', 'CTYPE2':'DEC--TAN','CTYPE3':'AWAV' }

wcs = pywcs.WCS( pyfits.Header(pyfits.Card(k,v) for k,v in d.items()))
print wcs.wcs.cd


results in an only 2x2 matrix with wrong coefficients:

[[ -4.12000000e-05  -3.72000000e-05]
 [  0.00000000e+00  -3.72000000e-05]]

Is this on purpose, and how can I acess the CDi_j coefficient matrix
from the WCS object? When I do a

print wcs.wcs

I get the correct values

cd[0][]:  -4.12e-05    -3.72e-05     0
cd[1][]:  -3.72e-05     4.12e-05     0
cd[2][]:   0            0            2e-10

Pywcs versions are 1.9 and 1.10.



More information about the AstroPy mailing list