FITS was developed at NRAO in the late 1970's to facilitate transport and
astronomical data (in particular, radio astronomy images) on magnetic tape in
a manner that was easily readable in a machine-independent way
on a variety of operating systems. The
original system is defined by Wells & Greisen, 1979, in "Image Processing
in Astronomy", eds Sedmak, Capacciolo, & Allen (Trieste Conference), 445.
The system was recommended as a standard format by the International
Astronomical Union in 1982. Since its conception as a simple format for
handling data arrays, it has been modified and updated to permit the
storage of tables of data. References include:
A FITS file (on tape or disk) consists of a set of header records followed by a set of data records. All fits records are 2880 bytes in length (equal to 36 80-byte cards), but taped data may use block sizes which are an integral multiple of this to increase storage efficiency. A block size of 10 (28,800 byte records) is common. All data are written as 8 bit words (360 words per record).
The header is a sequence of 80 character ASCII card images. Each line of the header consists of a keyword and a value; the header ends with the keyword END. A FITS header must contain certain keywords in order for the data to be interpretable. These are:
Click here to see an annotated sample FITS header.
The data section of the file always begins on a new record boundary. FITS supports the following types of data:
FITS files may include extensions. One often finds a single FITS file
is used to store a number of data tables or images. In this case, the
header must include the line
EXTEND = T / FITS dataset may contain extensions
Each extension is a separate FITS file, with its own header and data section.
Some FITS readers (like that in IRAF) cannot handle extensions.
Note that the main FITS file does not know how many extensions follow. Even if FITS keyword EXTEND = T, there need not be any extensions. If you try to read an extension that is not there, you will get a warning message.
The IDL astronomy user's library has a number of routines that permit one to read and extract values from the FITS headers. The main routine you will need is SXPAR, which extracts values from a header array. In the example above, the header variable H is a string array. You can print it (print,H). To extract the value of a keyword into a variable V you would type V=sxpar(H,keyword), where keyword, a string, is the name of the keyword. In the example FITS header, you would print the number of coadds in the final image by typing print,sxpar(H,'NCOADDS'); you could extract the value into a variable with the line ncoadds=sxpar(H,'NCOADDS').