3.2 FITS File Format

3.2.1 Multi-Extension FITS Files

FITS1 is a standard format for exchanging astronomical data, independent of the hardware platform and software environment. A file in FITS format consists of a series of Header Data Units (HDUs), each containing two components: an ASCII text header and the binary data. The header contains a series of keywords that describe the data in a particular HDU and the data component may immediately follow the header.

For HST FITS files, the first HDU, or primary header, contains no data. The primary header may be followed by one or more HDUs called extensions. Extensions may take the form of images, binary tables, or ASCII text tables. The data type for each extension is recorded in the XTENSION header keyword. Figure 3.1 schematically illustrates the structure of a FITS file and its extensions.

Figure 3.1: FITS format example.



Each FITS extension header contains the required keyword XTENSION, which specifies the extension type and has one of the following values: IMAGE, BINTABLE, and TABLE, corresponding to an image, binary table, and ASCII table, respectively.


Table 3.2: HST Header Keyword Descriptions

HDU Keyword

Description

Values

XTENSION

Data type for extension

  • IMAGE

  • BINTABLE (binary table)

  • TABLE (ASCII table)

EXTVER

Imset number

Integer

EXTNAME

Extension names that describe the type of data component

SCI (science image)

ERR (error image)

DQ (data quality image)

SAMP (number of sample)

TIME1 (exposure time)

EVENTS2 (photon event list)

GTI2 (good time interval)

WHT (weight image)

CTX (context image)

PIXVALUE3

Allowed for any extension except SCI, and used for an image with uniform value for all pixels

Real number

  1. Only found in NICMOS and WFC3 data.
  2. Only found in COS and STIS data.
  3. When an image has the same value at all pixels (e.g., data quality value), the extension has no data component. Instead, the constant pixel value is stored in the header keyword PIXVALUE.

A set of FITS extension images which are logically related to one another is called an imset. For example, the error image and the data quality image are in the same imset as the science image itself. The keyword EXTNAME is used to specify the extension names of different images in the same imset. For example, the science data from the two ACS/WFC CCDs are stored in extensions 1 and 4 of a MEF file, but may also be referred to as ['sci', 1] and ['sci', 2], where 'SCI' is the extension name, and the integers 1 and 2 refer to the imset. Similarly, one may access the science data, error array, and data quality array of only the first imset located in extensions 1, 2, and 3, respectively, as ['sci', 1], ['err', 1], and ['dq', 1]. The data format chapters of each of the instrument-specific data handbooks provide specific information on extension names and imset numbers.

3.2.3  Waivered FITS Format

File formats for the first and second generation HST instruments (FGS, FOC, FOS, HSP, WF/PC-1, GHRS, and WFPC2) were developed before the standardization of MEF format. The waivered FITS format was developed in response to the need for a machine independent storage format for these data and was based on the idea of stacking multi-group data as a new dimension in a FITS image.


For example, a WFPC2 science data file containing data from four cameras (groups) has four 800 x 800 pixel images in its data file. The waivered FITS file containing these data has an image with dimensions 800 x 800 x 4 pixels in its primary HDU. Similarly, a FOS file may contain a two-dimensional spectrum stored as 2064 x 40 pixels in the primary HDU constructed from 40 groups of 2064 pixel one-dimensional spectra.


The first extension of a waivered FITS file will contain the header information as a binary table with each group represented as a row in the table. Each column in the table is a header keyword. For example, In the case of a WFPC2 image consisting of four groups, the first extension of the waivered FITS file is a table containing four rows.



1A description of FITS format and various supporting documents can be found at the website https://fits.gsfc.nasa.gov/fits_home.html.