13.3 Reading Fits Files#
Flexible Image Transport System (FITS) files are used to store astronomical images. As seen in the figure below, a FITS file is made up of two parts: an ASCII header and a binary image. The header usually contains important metadata that describes photometric and spatial calibration information.
Some of the more important header information includes:
NAXIS1
,NAXIS2
: the number of pixels along the axes.CTYPE1
,CTYPE2
: coordinates used for the axes (often celestial coordinates).In order to have a unique (RA, DEC) coordinate for each pixel in the image, it needs to be astrometrically calibrated. The three most important astrometry keywords (for each axis) are:
CDELT - the size of a pixel, usually given in degrees. For the header shown on the previous slide, CDELT1 = -2.777e-4 degrees = -2.777e-4 x 3600 = -1 arc second.
CRPIX - the pixel number of a reference pixel whose RA/DEC is given by the corresponding CRVAL keyword.
CRVAL - the RA/Dec of the reference pixel (as specified by CRPIX).
WCS
and fits
#
The astropy.wcs.WCS
sub-package is used to create an object to represent the world coordinate system (WCS) transformation of an image.
from astropy.wcs import WCS
The astropy.io.fits
sub-package is used to read-in FITS images.
from astropy.io import fits