Skip to content

Instantly share code, notes, and snippets.

@saimn
Created July 10, 2012 13:03
Show Gist options
  • Save saimn/3083110 to your computer and use it in GitHub Desktop.
Save saimn/3083110 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('XMMLSS_00-nd-int.fits')
In [4]: w = wcs.WCS(hdulist[0].header)
In [5]: w.to_header()
Out[5]:
WCSAXES = 2 / Number of coordinate axes
CRPIX1 = 1920.5 / Pixel coordinate of reference point
CRPIX2 = 1920.5 / Pixel coordinate of reference point
CDELT1 = -0.000416666666667 / [deg] Coordinate increment at reference point
CDELT2 = 0.000416666666667 / [deg] Coordinate increment at reference point
CUNIT1 = 'deg' / Units of coordinate increment and value
CUNIT2 = 'deg' / Units of coordinate increment and value
CTYPE1 = 'RA---TAN' / Right ascension, gnomonic projection
CTYPE2 = 'DEC--TAN' / Declination, gnomonic projection
CRVAL1 = 36.661 / [deg] Coordinate value at reference point
CRVAL2 = -4.48 / [deg] Coordinate value at reference point
LONPOLE = 180 / [deg] Native longitude of celestial pole
LATPOLE = -4.48 / [deg] Native latitude of celestial pole
RESTFRQ = 0 / [Hz] Line rest frequency
RESTWAV = 0 / [Hz] Line rest wavelength
EQUINOX = 2000 / [yr] Equinox of equatorial coordinates
In [6]: import locale
In [7]: locale.setlocale(locale.LC_ALL, ('fr_FR', 'UTF-8'))
Out[7]: 'fr_FR.UTF-8'
In [8]: w.to_header()
Out[8]: WARNING: Output verification result: [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'CRPIX1' is not FITS standard (invalid value string: 1920,5 / Pixel coordinate of reference point). Fixed 'CRPIX1' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: Note: PyFITS uses zero-based indexing.
[astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'CRPIX2' is not FITS standard (invalid value string: 1920,5 / Pixel coordinate of reference point). Fixed 'CRPIX2' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'CDELT1' is not FITS standard (invalid value string: -0,000416666666667 / [deg] Coordinate increment at reference point). Fixed 'CDELT1' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'CDELT2' is not FITS standard (invalid value string: 0,000416666666667 / [deg] Coordinate increment at reference point). Fixed 'CDELT2' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'CRVAL1' is not FITS standard (invalid value string: 36,661 / [deg] Coordinate value at reference point). Fixed 'CRVAL1' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'CRVAL2' is not FITS standard (invalid value string: -4,48 / [deg] Coordinate value at reference point). Fixed 'CRVAL2' card to meet the FITS standard. [astropy.io.fits.verify]
WARNING: VerifyWarning: Card 'LATPOLE' is not FITS standard (invalid value string: -4,48 / [deg] Native latitude of celestial pole). Fixed 'LATPOLE' card to meet the FITS standard. [astropy.io.fits.verify]
WCSAXES = 2 / Number of coordinate axes
CRPIX1 = '1920,5 ' / Pixel coordinate of reference point
CRPIX2 = '1920,5 ' / Pixel coordinate of reference point
CDELT1 = '-0,000416666666667' / [deg] Coordinate increment at reference point
CDELT2 = '0,000416666666667' / [deg] Coordinate increment at reference point
CUNIT1 = 'deg' / Units of coordinate increment and value
CUNIT2 = 'deg' / Units of coordinate increment and value
CTYPE1 = 'RA---TAN' / Right ascension, gnomonic projection
CTYPE2 = 'DEC--TAN' / Declination, gnomonic projection
CRVAL1 = '36,661 ' / [deg] Coordinate value at reference point
CRVAL2 = '-4,48 ' / [deg] Coordinate value at reference point
LONPOLE = 180 / [deg] Native longitude of celestial pole
LATPOLE = '-4,48 ' / [deg] Native latitude of celestial pole
RESTFRQ = 0 / [Hz] Line rest frequency
RESTWAV = 0 / [Hz] Line rest wavelength
EQUINOX = 2000 / [yr] Equinox of equatorial coordinates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment