Skip to content

Instantly share code, notes, and snippets.

@saimn
Created July 10, 2012 11:45
Show Gist options
  • Save saimn/3082829 to your computer and use it in GitHub Desktop.
Save saimn/3082829 to your computer and use it in GitHub Desktop.
In [1]: from astropy import wcs
In [2]: from astropy.io import fits
In [3]: hdulist = fits.open('../../../CFHTLS_T06/DEEP/CFHTLS_D-85_u_022559-042940_T0006.fits')
In [4]: w = wcs.WCS(hdulist[0].header)
In [5]: w.printwcs()
WCS Keywords
CD_11 CD_12: -5.1666667890000002e-05 0.0
CD_21 CD_22: 0.0 5.1666667890000002e-05
CRVAL : 36.495833330000004 -4.494444444
CRPIX : 9677.5 9677.5
NAXIS : 19354 19354
In [7]: w.wcs
Out[7]:
flag: 137
naxis: 2
crpix: 0x2730810
9677.5 9677.5
pc: 0x21ea6a0
pc[0][]: -5.1667e-05 0
pc[1][]: 0 5.1667e-05
cdelt: 0x272a960
1 1
crval: 0x2793e00
36.496 -4.4944
cunit: 0x231ddf0
"deg"
"deg"
ctype: 0x231dd30
"RA---TAN"
"DEC--TAN"
lonpole: 180.000000
latpole: -4.494444
restfrq: 0.000000
restwav: 0.000000
npv: 0
npvmax: 0
pv: 0x0
nps: 0
npsmax: 0
ps: 0x0
cd: 0x2144590
cd[0][]: -5.1667e-05 0
cd[1][]: 0 5.1667e-05
crota: 0x218e9f0
0 0
altlin: 2
velref: 0
alt: ' '
colnum: 0
colax: 0x21eabc0
0 0
wcsname: UNDEFINED
cname: 0x23265f0
UNDEFINED
UNDEFINED
crder: 0x27a2950
UNDEFINED UNDEFINED
csyer: 0x21cffb0
UNDEFINED UNDEFINED
radesys: UNDEFINED
equinox: 2000.000000
specsys: UNDEFINED
ssysobs: UNDEFINED
velosys: UNDEFINED
ssyssrc: UNDEFINED
zsource: UNDEFINED
obsgeo: UNDEFINED UNDEFINED UNDEFINED
dateobs: UNDEFINED
dateavg: UNDEFINED
mjdobs: UNDEFINED
mjdavg: UNDEFINED
ntab: 0
tab: 0x0
nwtb: 0
wtb: 0x0
types: 0x27470e0
2200 2201
lngtyp: "RA"
lattyp: "DEC"
lng: 0
lat: 1
spec: -1
cubeface: -1
err: 0x0
lin: (see below)
cel: (see below)
spc: (see below)
m_flag: 137
m_naxis: 2
m_crpix: 0x2730810 (= crpix)
m_pc: 0x21ea6a0 (= pc)
m_cdelt: 0x272a960 (= cdelt)
m_crval: 0x2793e00 (= crval)
m_cunit: 0x231ddf0 (= cunit)
m_ctype: 0x231dd30 (= ctype)
m_pv: 0x0 (= pv)
m_ps: 0x0 (= ps)
m_cd: 0x2144590 (= cd)
m_crota: 0x218e9f0 (= crota)
m_colax: 0x21eabc0 (= colax)
m_cname: 0x23265f0 (= cname)
m_crder: 0x27a2950 (= crder)
m_csyer: 0x21cffb0 (= csyer)
m_tab: 0x0 (= tab)
m_wtb: 0x0 (= wtb)
lin.*
flag: 137
naxis: 2
crpix: 0x2730810
9677.5 9677.5
pc: 0x21ea6a0
pc[0][]: -5.1667e-05 0
pc[1][]: 0 5.1667e-05
cdelt: 0x272a960
1 1
unity: 0
err: 0x0
piximg[0][]: -5.1667e-05 0
piximg[1][]: 0 5.1667e-05
imgpix[0][]: -19355 -0
imgpix[1][]: 0 19355
m_flag: 0
m_naxis: 0
m_crpix: 0x0
m_pc: 0x0
m_cdelt: 0x0
cel.*
flag: 137
offset: 0
phi0: 0.000000
theta0: 90.000000
ref: 36.496 -4.4944 180 -4.4944
prj: (see below)
euler: 36.496 94.494 180 -0.078362 0.99692
latpreq: 0 (not required)
isolat: 0
err: 0x0
prj.*
flag: 103
code: "TAN"
r0: 57.295780
pv: (not used)
phi0: 0.000000
theta0: 90.000000
bounds: 1
name: "gnomonic"
category: 1 (zenithal)
pvrange: 0
simplezen: 1
equiareal: 0
conformal: 0
global: 0
divergent: 1
x0: 0.000000
y0: 0.000000
err: 0x0
w[]: 0 0 0 0 0
0 0 0 0 0
m: 0
n: 0
prjx2s: 0x7f9d88297240
prjs2x: 0x7f9d88296d90
spc.*
flag: 0
type: " "
code: " "
crval: UNDEFINED
restfrq: 0.000000
restwav: 0.000000
pv: (not used)
w: 0 0 0 (remainder unused)
isGrism: 0
err: 0x0
spxX2P: 0x0
spxP2S: 0x0
spxS2P: 0x0
spxP2X: 0x0
In [8]: import locale
In [9]: locale.setlocale(locale.LC_ALL, ('fr_FR', 'UTF-8'))
Out[9]: 'fr_FR.UTF-8'
In [10]: w.wcs
Out[10]:
flag: 137
naxis: 2
crpix: 0x2730810
9677,5 9677,5
pc: 0x21ea6a0
pc[0][]: -5,1667e-05 0
pc[1][]: 0 5,1667e-05
cdelt: 0x272a960
1 1
crval: 0x2793e00
36,496 -4,4944
cunit: 0x231ddf0
"deg"
"deg"
ctype: 0x231dd30
"RA---TAN"
"DEC--TAN"
lonpole: 180,000000
latpole: -4,494444
restfrq: 0,000000
restwav: 0,000000
npv: 0
npvmax: 0
pv: 0x0
nps: 0
npsmax: 0
ps: 0x0
cd: 0x2144590
cd[0][]: -5,1667e-05 0
cd[1][]: 0 5,1667e-05
crota: 0x218e9f0
0 0
altlin: 2
velref: 0
alt: ' '
colnum: 0
colax: 0x21eabc0
0 0
wcsname: UNDEFINED
cname: 0x23265f0
UNDEFINED
UNDEFINED
crder: 0x27a2950
UNDEFINED UNDEFINED
csyer: 0x21cffb0
UNDEFINED UNDEFINED
radesys: UNDEFINED
equinox: 2000,000000
specsys: UNDEFINED
ssysobs: UNDEFINED
velosys: UNDEFINED
ssyssrc: UNDEFINED
zsource: UNDEFINED
obsgeo: UNDEFINED UNDEFINED UNDEFINED
dateobs: UNDEFINED
dateavg: UNDEFINED
mjdobs: UNDEFINED
mjdavg: UNDEFINED
ntab: 0
tab: 0x0
nwtb: 0
wtb: 0x0
types: 0x27470e0
2200 2201
lngtyp: "RA"
lattyp: "DEC"
lng: 0
lat: 1
spec: -1
cubeface: -1
err: 0x0
lin: (see below)
cel: (see below)
spc: (see below)
m_flag: 137
m_naxis: 2
m_crpix: 0x2730810 (= crpix)
m_pc: 0x21ea6a0 (= pc)
m_cdelt: 0x272a960 (= cdelt)
m_crval: 0x2793e00 (= crval)
m_cunit: 0x231ddf0 (= cunit)
m_ctype: 0x231dd30 (= ctype)
m_pv: 0x0 (= pv)
m_ps: 0x0 (= ps)
m_cd: 0x2144590 (= cd)
m_crota: 0x218e9f0 (= crota)
m_colax: 0x21eabc0 (= colax)
m_cname: 0x23265f0 (= cname)
m_crder: 0x27a2950 (= crder)
m_csyer: 0x21cffb0 (= csyer)
m_tab: 0x0 (= tab)
m_wtb: 0x0 (= wtb)
lin.*
flag: 137
naxis: 2
crpix: 0x2730810
9677,5 9677,5
pc: 0x21ea6a0
pc[0][]: -5,1667e-05 0
pc[1][]: 0 5,1667e-05
cdelt: 0x272a960
1 1
unity: 0
err: 0x0
piximg[0][]: -5,1667e-05 0
piximg[1][]: 0 5,1667e-05
imgpix[0][]: -19355 -0
imgpix[1][]: 0 19355
m_flag: 0
m_naxis: 0
m_crpix: 0x0
m_pc: 0x0
m_cdelt: 0x0
cel.*
flag: 137
offset: 0
phi0: 0,000000
theta0: 90,000000
ref: 36,496 -4,4944 180 -4,4944
prj: (see below)
euler: 36,496 94,494 180 -0,078362 0,99692
latpreq: 0 (not required)
isolat: 0
err: 0x0
prj.*
flag: 103
code: "TAN"
r0: 57,295780
pv: (not used)
phi0: 0,000000
theta0: 90,000000
bounds: 1
name: "gnomonic"
category: 1 (zenithal)
pvrange: 0
simplezen: 1
equiareal: 0
conformal: 0
global: 0
divergent: 1
x0: 0,000000
y0: 0,000000
err: 0x0
w[]: 0 0 0 0 0
0 0 0 0 0
m: 0
n: 0
prjx2s: 0x7f9d88297240
prjs2x: 0x7f9d88296d90
spc.*
flag: 0
type: " "
code: " "
crval: UNDEFINED
restfrq: 0,000000
restwav: 0,000000
pv: (not used)
w: 0 0 0 (remainder unused)
isGrism: 0
err: 0x0
spxX2P: 0x0
spxP2S: 0x0
spxS2P: 0x0
spxP2X: 0x0
In [11]: w = wcs.WCS(hdulist[0].header)
In [12]: w.printwcs()
WCS Keywords
CD_11 CD_12: -5.0 0.0
CD_21 CD_22: 0.0 5.0
CRVAL : 3.0 -4.0
CRPIX : 9.0 9.0
NAXIS : 19354 19354
In [13]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment