The fundamental unit of a FITS data set is the file, which begins with the
SIMPLE = T, where the first 6
bytes of the file contain SIMPLE, the ``='' is in byte 9, the
T is in byte 30, and the intervening bytes contain ASCII blanks. This
30-character string is the signature of FITS, the way in which generalized
software can identify the file as FITS. The string is not to be used if
the file deviates from the rules for FITS in any way. In such a case, a
value of F may be appropriate. A FITS file ends with an end-of-file
mark appropriate to the medium on which it is written. A FITS file is
composed of 23040-bit (2880 8-bit byte) logical records, organized into a
sequence of header data units (HDUs). This logical record length was
chosen because it was an integral multiple of the byte and word lengths of
all computers that had been sold in the commercial market in or before
1979, the time of the original FITS agreement. Each HDU consists of one or
more logical records containing an ASCII header followed by zero or more
records of binary data. The first HDU is called the primary HDU; those
following are called extensions. The last extension may be followed by
23040-bit special records, which need not be organized as HDUs.
Each FITS header record consists of 36 80-byte ``card images'' written in 7-bit printable ASCII code (ANSI 1977) with the sign bit set to zero. The header may contain as many records as are needed for the card images. The END card image is the last. The remainder of the last record of the header is filled with ASCII blanks to its full 23040-bit length. These header records should contain all the information necessary to read and label the associated data. In addition, other information may be provided, such as the processing history or instrument status. The header records are followed by the data records.
The first or primary HDU is governed by special rules. Its data records, if present, contain a matrix of data values, in one of several binary formats, called the primary data array. The array may have no more than 999 axes. There need not be data in the primary data array. An empty primary data array is most likely to appear when all the data of the FITS file are found in extensions.