Overview of the FITS Data Format
FITS was originally developed in the late 1970's as an archive and interchange format for astronomical data files. In the past decade FITS has also come into wide use as an on-line file format that can be directly read and written by data analysis software. FITS is much more than just another image format (such as JPG or GIF) and is primarily designed to store scientific data sets consisting of multidimensional arrays and 2-dimensional tables containing rows and columns of data.
A FITS file consists of one or more Header + Data Units (HDUs), where the first HDU is called the `Primary HDU', or `Primary Array'. The primary array contains an N-dimensional array of pixels, such as a 1-D spectrum, a 2-D image, or a 3-D data cube. Five different primary data types are supported: unsigned 8-bit bytes, 16 and 32-bit signed integers, and 32 and 64-bit single or double precision floating point reals. FITS can also store 16 and 32-bit unsigned integers.
Any number of additional HDUs may follow the primary array; these additional HDUs are called FITS `extensions'. There are currently 3 types of extensions defined by the FITS Standard:
Each header unit consists of any number of 80-character keyword records which have the general form:
The keyword names may be up to 8 characters long and can only contain uppercase letters, the digits 0-9, the hyphen, and the underscore character. The keyword name is (usually) followed by an equals sign and a space character (= ) in columns 9 - 10 of the record, followed by the value of the keyword which may be either an integer, a floating point number, a character string (enclosed in single quotes), or a boolian value (the letter T or F).
The last keyword in the header is always the `END' keyword which has no value or comment fields. There are many rules governing the exact format of a keyword record (see the FITS Standard for details) so it is generally better to rely on standard interface software like CFITSIO to correctly construct or parse the keyword records rather than directly reading or writing the raw FITS file.
Each header unit begins with a series of required keywords that specify the size and format of the following data unit. A 2-dimensional image primary array header, for example, begins with the following keywords:
SIMPLE = T / file does conform to FITS standard BITPIX = 16 / number of bits per data pixel NAXIS = 2 / number of data axes NAXIS1 = 440 / length of data axis 1 NAXIS2 = 300 / length of data axis 2The required keywords may be followed by other optional keywords to describe various aspects of the data, such as the date and time of the observation. Other COMMENT or HISTORY keywords are also frequently added to further document the contents of the data file.
The data unit, if present, immediately follows the last 2880-byte block in the header unit. Note that some HDUs do not have a data unit and only consist of the header unit.
Return to main FITS page.
Page Author: William Pence
Last update: Tuesday, 18-Oct-2016 17:11:56 EDT