next previous
Up: Definition of the Flexible (FITS)


Subsections

   
4 FITS file organization

4.1 Overall

A FITS file shall be composed of the following FITS structures , in the order  listed:

Each FITS structure  shall consist of an integral number of FITS logical records. The primary HDU  shall start with the first record of the FITS file. The first record of each subsequent FITS structure  shall be the record immediately following the last record of the preceding FITS structure. The size of a FITS logical record shall be 23040 bits, corresponding to 2880 8-bit bytes.

4.2 Individual FITS structures

The primary HDU and every extension  HDU  shall consist of an integral number of header records consisting of ASCII  text, which may be followed by an integral number of data records. The first record of data shall be the record immediately following the last record of the header.

4.3 Primary header and data array

The first component of a FITS file shall be the primary  header. The primary header may, but need not be, followed by a primary data  array. The presence or absence of a primary data array shall be indicated by the values of the NAXIS or  NAXISn keywords  in the primary header (Sect. 5.4.1.1).

4.3.1 Primary header

The header of a primary HDU  shall consist of a series of card images  in ASCII  text. All header records shall consist of 36 card images. Card images without information shall be filled  with ASCII blanks (hexadecimal 20).

4.3.2 Primary data array

In FITS format, the   primary  data array shall consist of a single data array of 0-999 dimensions. The random groups convention in the primary data array is a more complicated structure (see Sect. 7). The data values shall be a byte stream with no embedded fill or blank space. The first value shall be in the first position of the first primary data array record. The first value of each subsequent row of the array shall be in the position immediately following the last value of the previous row. Arrays of more than one  dimension shall consist of a sequence such that the index along axis 1 varies most rapidly, that along axis 2 next most rapidly, and those along subsequent axes progressively less rapidly, with that along axis m, where m is the value of NAXIS , varying least rapidly; i.e., the elements of an array $A(x_{1}, x_{2}, \ldots, x_{m})$ shall be in the order  shown in Fig. 1. The index count along each axis shall begin with 1 and increment by 1 up to the value of the NAXISn  keyword (Sect. 5.4.1.1).
  \begin{figure}\par\begin{tabular}{l} \\
A(1, 1, \ldots, 1), \\
A(2, 1, \ldot...
...XIS1}, {\tt NAXIS2}, \ldots, {\tt NAXISm}) \\
\end{tabular}\par\par\end{figure} Figure 1: Arrays of more than one dimension shall consist of a sequence such that the index along axis 1 varies most rapidly and those along subsequent axes progressively less rapidly. Except for the  location of the first element, array structure is independent of record structure.

If the data array does not fill the final record, the remainder of the record shall be filled by setting all bits to zero.

4.4 Extensions

   
4.4.1 Requirements for conforming extensions

All extensions , whether or not further described in this standard, shall fulfill the following requirements to be in conformance with this FITS standard.

   
4.4.1.1. Identity.

Each extension  type  shall have a unique type name, specified in the  header according to the syntax codified in Sect. 5.4.1.2. To preclude conflict, extension type names must be registered   with the  IAUFWG. The FITS Support Office  shall maintain and provide a list of the registered extensions.

4.4.1.2. Size specification.

The total number of bits in the data of each extension shall be specified in the header for that extension, in the manner prescribed in Sect. 5.4.1.2.

4.4.1.3. Compatibility with existing FITS files.

No extension  shall  be constructed that invalidates existing FITS files.

4.4.2 Standard extensions

A standard  extension  shall be a conforming  extension  whose organization and content are completely specified in this standard. Only one FITS format shall be approved for each type of data organization. Each standard extension shall have a unique name   given by the value of the XTENSION keyword (see Appendix .18).

4.4.3 Order of extensions

An extension may follow the primary HDU  or another conforming  extension . Standard  extensions  and other conforming extensions may appear in any order  in a FITS file.

4.5 Special records

The first 8 bytes of special records must  not contain the string  "XTENSION''. It is recommended that they not contain the string  "SIMPLE \includegraphics[width=3mm,clip]{espace.eps} \includegraphics[width=3mm,clip]{espace.eps}''. The records must have the standard FITS 23040-bit record length. The contents of special records are not otherwise specified by this standard.

   
4.6 Physical blocking

   
4.6.1 Bitstream devices

For bitstream devices, including but not restricted to logical file systems, FITS files shall be written with fixed blocks of a physical block size equal to the 23040-bit FITS logical record size.

4.6.2 Sequential media

   
4.6.2.1. Fixed block.

For fixed block length sequential media, including but not restricted to optical disks (accessed as a sequential set of records), QIC format 1/4-inch cartridge tapes, and local area networks, FITS files shall be written as a bitstream, using the fixed block size of the medium. If the end of the last logical record does not coincide with the end of a physical fixed block, all bits in the remainder of the physical block containing the last logical record shall be set to zero. After an end-of-file mark has been detected in the course of reading a FITS file, subsequent incomplete FITS logical records should be disregarded.

   
4.6.2.2. Variable block.

For variable block length sequential media, including but not restricted to 1/2-inch 9-track tapes, DAT 4 mm cartridge tapes, and 8 mm cartridge tapes, FITS files may be written with an integer blocking factor equal to 1-10 logical records per physical block.


next previous
Up: Definition of the Flexible (FITS)

Copyright ESO 2001