[AstroPy] problem using the WCS package

Nikta Amiri Nikta.Amiri at Colorado.EDU
Tue Jun 11 18:09:05 EDT 2013


Hello all,

I am trying to use WCS package in Astropy on a fits file that has NAXIS=4 in the header, to convert some coordinates in decimal degrees to pixel values. At first, I faced this error:

"RuntimeError: Input array must be 2-dimensional, where the second dimension >= 4"

To get around this problem, I edited the fits header and removed NAXIS 3 and 4 as well as all corresponding CDELT/CTYPE. When running WCS_world2pix I face no error, but the pixel values that I obtain are incorrect and in some cases I even get negative values for pixels. For example, I get these values after using WCS_world2pix on a fits image with 784*282 dimension:

array([[   8.35828508,  101.42723769],
       [  -2.40845355,  373.76598659],
       [ -54.96921724,  690.64432708],
       [ -60.6297434 ,  625.57276931],
       [  75.34581951,  902.489706  ]])


Could you please let me know if there is a solution to this problem? FYI, I attach the modified fits header and the lines that I removed in the original fits header below:

Thank you,
Nikta



SIMPLE  =                    T /                                                
BITPIX  =                  -32 /                                                
NAXIS   =                    2                                                  
NAXIS1  =                  282 /                                                
NAXIS2  =                  784 /                                                
EXTEND  =                    T /Tables following main image                     
BLOCKED =                    T /Tape may be blocked                             
OBJECT  = 'YY'           /Source name                                     
TELESCOP= 'ZZ'           /                                                
INSTRUME= '        '           /                                                
OBSERVER= 'xx  '           /                                                
DATE-OBS= '1901-09-27'         /Obs start date YYYY-MM-DD                       
DATE-MAP= '2007-02-26'         /Last processing date YYYY-MM-DD                 
BSCALE  =    1.00000000000E+00 /REAL = TAPE * BSCALE + BZERO                    
BZERO   =    0.00000000000E+00 /                                                
BUNIT   = 'KM/S    '           /Units of flux                                   
EPOCH   =      1.950000000E+03 /Epoch of RA DEC                                 
BLANK   =                   -1 / IEEE not-a-number for blanked pixels           
DATAMAX =     -1.422322839E-01 /Maximum pixel value                             
DATAMIN =     -9.989158325E+02 /Minimum pixel value                             
CTYPE1  = 'RA---GLS'           /                                                
CRVAL1  =    1.00012502670E+01 /                                                
CDELT1  =     -2.222222276E-03 /                                                
CRPIX1  =      1.360000000E+02 /                                                
CROTA1  =      0.000000000E+00 /                                                
CTYPE2  = 'DEC--GLS'           /                                                
CRVAL2  =    4.10008354187E+01 /                                                
CDELT2  =      2.222222276E-03 /                                                
CRPIX2  =      3.640000000E+02 /                                                
CROTA2  =     -3.770000076E+01 /    

 And the removed lines are:
NAXIS3  =                    1 /                                                
NAXIS4  =                    1 /   

CTYPE3  = 'FREQ    '           /                                                
CRVAL3  =   -3.50000000000E+05 /                                                
CDELT3  =     -2.600757568E+03 /                                                
CRPIX3  =      1.435000000E+02 /                                                
CROTA3  =      0.000000000E+00 /                                                
CTYPE4  = '        '           /                                                
CRVAL4  =    0.00000000000E+00 /                                                
CDELT4  =      1.000000000E+00 /                                                
CRPIX4  =      0.000000000E+00 /                                                
CROTA4  =      0.000000000E+00 /  


More information about the AstroPy mailing list