[AstroPy] Need some help with wcs

Christian Ambros ambrosc at ymail.com
Tue Jan 29 15:49:49 EST 2013

Hi guys,

I'm new to astropy but as I see the potential, I like to use it my Ph.d thesis.
After I had fun with some of the tuts and their data I started out to use some of my own data and ran into some problems with wcs.

After I opend up a fits with pyfits.open I tried to use wcs= pywcs.WCS(hdulist[0].header) to get the wcs data. I got the error mesg:    312                 # The header may have SIP or distortions, but no core
    313                 # WCS.  That isn't an error -- we want a "default"

A typical header of the images I want to work with looks like this:
SIMPLE  =                    T / Fits standard                                  
BITPIX  =                  -32 / Bits per pixel                                 
NAXIS   =                    2 / Number of axes                                 
NAXIS1  =                 1023 / Axis length                                    
NAXIS2  =                 1023 / Axis length                                    
ORIGIN  = 'NOAO-IRAF FITS Image Kernel July 1999' / FITS file originator        
EXTEND  =                    F / File may contain extensions                    
DATE    = '2000-08-24T17:53:06' / Date FITS file was generated                  
IRAF-TLM= '18:52:47 (24/08/2000)' / Time of last modification                   
TIMESYS = 'UTC     '           / P0S| time scale specification                  
RADESYS = 'FK5     '           / P2S| WCS for this file                         
EQUINOX =         2.000000E+03 / P0R| equinox                                   
OBSERVER= 'Reiprich / Englhauser' / P0R| observer(s)                            
TELESCOP= 'Skinakas 1.3m'      / P0R| telescope                                 
INSTRUME= 'CH 360  '           / P0R| instrument name                           
OBS_MODE= 'DIRECT MODE'        / RDF| observing mode                            
FILTER  = 'R       '           / RDF| filter ID                                 
OBJECT  = 'R1825.3+30'         / P0R| name of object                            
DATE-OBS= '2000-06-07T23:54:40' / P0R| time of obs start (UTC)                  
EXPOSURE=         3.000000E+02 / JER| exposure time (s)                         
DATE_CCD= '2000-06-08T00:00:20' / JER| end of CCD readout (UTC)                 
AIRMASS1= '1.005   '           / JER| air mass at obs start                     
AIRMASS2= '1.007   '           / JER| air mass at obs end                       
BLANK   =                65535 / P0R| undefined integer values                  
CTYPE1  = 'RA---TAN'           / P0R| (assumed) axis type for dim 1             
CTYPE2  = 'DEC--TAN'           / P0R| (assumed) axis type for dim 2             
CRPIX1  =                511.5 / P0R| 'pixel 1 from 0.5 to 1.5' convention      
CRPIX2  =         5.125000E+02 / P0R| 'pixel 1 from 0.5 to 1.5' convention      
CRVAL1  =         2.763750E+02 / P0R| (assumed) sky coord of 1st axis (deg)     
CRVAL2  =         3.045000E+01 / P0R| (assumed) sky coord of 2nd axis (deg)     
CDELT1  =    -1.3944444444E-04 / P0R| (assumed) X degrees per pixel             
CDELT2  =     1.3944444444E-04 / P0R| (assumed) Y degrees per pixel             
OBSGROUP= '07JUN00 '           / JER| group ID of observations                  
OBSFNAME= 'DATA0134'           / JER| file ID of observation                    
HISTORY   Changes by FIXQSRC:                                                   
HISTORY     * add new keywords (everything except for SIMPLE,BITPIX,NAXIS.);    
HISTORY         filled by information from the observation log files            
HISTORY     * fix I2 bug of PMIS (negative pixel values)                        
COMMENT   Keyword types:                                                        
COMMENT     * P0R - reserved  in Paper 0                                        
COMMENT     * P0S - suggested in Paper 0                                        
COMMENT     * P2S - suggested in Paper 2                                        
COMMENT     * RDF - present in ROSAT RDF FITS files                             
COMMENT     * JER - introduced by JER                                           
COMMENT   References:                                                           
COMMENT     * Paper 0: NOST 100-2.0, FITS Definition, http://fits.gsfc.nasa.gov/
COMMENT     * Paper 2: Paper II in http://fits.gsfc.nasa.gov/documents.html#WCS 
WCSDIM  =                    2                                                  
CD1_1   =  -1.3944444444000E-4                                                  
CD2_2   =  1.39444444440000E-4                                                  
LTM1_1  =                   1.                                                  
LTM2_2  =                   1.                                                  
WAT0_001= 'system=image'                                                        
WAT1_001= 'wtype=tan axtype=ra'                                                 
WAT2_001= 'wtype=tan axtype=dec'                                                
ZEROCOR = 'Aug 21 19:55 Zero level correction image is Zerom'                   
CCDSEC  = '[1:1024,1:1024]'                                                     
CCDMEANT=            651373512                                                  
CCDPROC = 'Aug 22  1:05 CCD processing done'                                    
FLATCOR = 'Aug 22  1:05 Flat field image is FlatRm with scale=40679.34'         
LTV1    =                  -1.                                                  
NCOMBINE=                   11 

As it is written in the documantation the values i.e. CRPIX j, PC i j or CD i j, CDELT i,CTYPE i, CRVAL i, or CUNIT i have to be present. As you can see in the middle of the header they exist ok the WCSAXES value ist missing but there is WCSDIM instead.
The error message says something about a 'default'. Do those values have to stand in a particular order at a particular position in the header?
I ran verify() but with no negativ result.

Is there, maybe, an example header to which I can refer to? If so I will write myself a tool to re-write the header of all of those 169 targets I have already in my databank. I would revise my header correcting program which update the header after camera output to get the 'right' header once and for all.

Thanks in advance,
"A little learning never caused anyone's head to explode!"

"Ein wenig Lernen hat noch niemandens Kopf zum Explodieren gebracht!"

More information about the AstroPy mailing list