|
FITS Format Overview
FITS is a digital data format developed for storing
and transporting astronomical data in form of images and tables.
The acronym FITS stands for "Flexible Image Transport System",
which was developed in the 1970's at Kitt Peak National Observatory
and was standardized in 1981. It has been maintained by NASA for
more than 2 decades. A FITS format file consists of one of more
Header-Data Units, with each "HDU" consisting of an ASCII text
"header" containing metadata, followed by a multi-dimensional array
that may contain pixel data for an image, or table data in the form
of ASCII text or binary data. The FITS header and data array adhere
to a rigid structure defined in the standard. It is critical to
note that FITS is a data format, not an image format, as it was
originally designed to hold one HDU of image data. It was later
extended to hold multiple HDUs which may also hold table data.
The components of the Header-Data Unit ("HDU")
depend on the type of data it contains. For images, the data array
contains the image pixels. For an image, the header contains image
metadata that describe the array, such as the number of rows and
columns, and descriptive information such as the exposure time,
date and time the image was acquired, user comments, etc. The HDU
length is an integral multiple of 2880 bytes, and the header and
data array must each be padded to a total length that is an
integral multiple of 2880 bytes. Within the header, each 2880 byte
"record" consists of 36 "card images" of 80 bytes each (originally
based on 80-column Hollerith punch cards when FITS was developed).
Each card image contains one item of metadata as an 8-character
keyword, like NAXIS1, followed by a 72
character field that may contain a value, such as "512", and an
optional comment, such as "number of image columns". The final
keyword of the header is the END
keyword, which is blank padded to the end of the 2880-byte
record.
All characters in the FITS header must be in the
range of ASCII codes 32 through 126 (hex 0x20 through 0x7e). Mira
automatically scans the header and replaces characters outside this
range.
Header Contents
The FITS standard refers to each 80-character line
of the header as a card image. In this Use's Guide, a card image is
termed a keyword line. Each header line consists of the
following components:
-
A uppercase keyword up to 8 characters long,
starting in column 1, that identifies the information contained in
the card image.
-
A value, sometimes called the keyword value,
beginning in column 10.
-
An optional slash in column 32 that separates
the value from an optional comment.
-
An optional comment, in columns 33 though 80,
that describes the keyword.
There are other details relating to issues such as
the range of columns used for specific types of keyword values, but
these will not be addressed here. A typical keyword line looks
similar to the following one:
NAXIS1 = 512
/ number of image columns
Beyond the last non-blank character, the remainder
of the 80-byte line is padded with blanks (ASCII code 32, or hex
20). The format of the NAXIS keyword is
typical of all keyword lines.
The keyword name, including spaces, is exactly 8
bytes long and is left justified with the 80-character keyword
line. Except for HISTORY, COMMENT, and <blank> keywords, an equals
sign, =, follows in column 9. An optional slash may be placed in
column 32. Between columns 10 and 32 is placed the value of the
keyword, in this example, the number 512. Notice that the value 512
is right justified with one blank space after. Right justification
to column 30 is required for integer, real, and character values,
although this detail is sometimes missed by some software authors.
Keywords with a character string value, must be left justified and
enclosed within single quotation marks (') beginning in column 10.
Character value keywords such as SIMPLE
do not use quotation marks, but instead use a single character as
T (true) or F (false).
Examples of Proper Format
The Basic FITS Header
The 4 mandatory keywords at the beginning of every
FITS file are, in order, SIMPLE,BITPIX,
NAXIS, and END. The first four keywords define a basic image
and the END keyword signifies the end
of the header. Note that a FITS file may contain more than one HDU
and that the second and higher HDUs use theXTENSION keyword in place of the SIMPLE keyword.
A classic FITS file has one HDU and contains a
2-dimensional image. It has a header like the following:
|
SIMPLE = T
BITPIX = -32
NAXIS = 2
NAXIS1 = 512
NAXIS2 = 512
BSCALE = 1.512E02
/
DATE-OBS= '1999-21-05T05:20:45.005'
TIME-OBS= '05:20:45.005' /
EXPTIME = 500.0
MIRATYPE= '16
bit unsigned' /
OBJECT = 'This
string requires quotes'
HISTORY This
string uses no quotes
COMMENT This
string uses no quotes
END
|
The NAXIS1 keyword used
in the example is an essential FITS keyword because it
specifies the image dimension in the direction of the most rapidly
varying subscript. The term most rapidly varying subscript is
intended for those who write computer programs to read and write
FITS format. For a 2-D image, the value of NAXIS1 corresponds to the number of columns
in the image, which is 512 columns in the example. The number of
image dimensions is specified using the NAXIS keyword, and this would have a value of
either 1 or 2 for classic FITS files. If the image has 2
dimensions, an NAXIS2 keyword must
exist in the header. Note that FITS images may have an NAXIS value
between 0 and 999.
FITS File Types
Classic FITS Files
The classic FITS file contains a 2-dimensional
image array. Such a file contains the keywordSIMPLE = T at its beginning and has NAXIS = 2. This type of file contains one
Header-Data Unit, (HDU) consisting of a FITS header followed by a
two-dimensional pixel array.
FITS Extension Files
Mira Pro x64 can also open 2-dimensional image
arrays from images containing more than one Header-Data Unit (HDU).
In this type of FITS file, the data portion of the HDU is optional,
so the HDU may haveNAXIS = 0. A FITS
file may have a PRIMARY HDU that
contains only a header but no data array; this is identified by
NAXIS=
0.
The first HDU of a FITS file always has
SIMPLE = T.
The additional keyword EXTEND may also
be present in the first HDU to indicate that the file contains
additional HDU's. Additional HDU's must use the keyword
XTENSION to describe the type of
information the HDU contains, with one of the values 'IMAGE','TABLE', or 'BINTABLE'. Mira Pro x64 version 8 supports
only'IMAGE' type extensions. See the
EXTEND and XTENSION keywords in the
FITS Keywords topic. Mira handles FITS files and FITS
images in the following ways:
-
Classic FITS images (images with NAXIS = 2 and no extensions) and
File Lists containing them may be opened using the
standard
Open command.
-
FITS Extension files, classic FITS files, and
File Lists containing them may be opened using the
Open FITS File command.
-
Files with a PRIMARY
HDU (NAXIS=
0), IMAGE type extensions, and
NAXIS> 2
are opened into an
Image Window by separating the components into an
Image Set containing images with NAXIS = 2.
-
A dimensionless PRIMARY header havingNAXIS = 0 is opened into the
FITS Header Viewer.
-
After a FITS Extension image is opened into an
Image Set using
Open FITS file, you may save individual HDUs using
the Save,Save
As, and Save Image Set
commands.
-
An
Image Set may be saved to a FITS Extension file using
the
Save FITS Extension File command.
-
If the second or higher HDU includes the keyword
INHERIT = T, then the header of the
extension integrates the header of the first, orPRIMARY HDU having NAXIS =
0.
FITS Headers for XTENSION HDUs
A FITS file with more than one HDU is known as an
Extension file. The first HDU is identified by the SIMPLE keyword
in the first card image. Each additional HDU is a FITS XTENSION HDU and has some differences with the
first HDU. Whereas the first (or only) HDU begins with
theSIMPLE keyword, the second and
higher HDUs begin with the XTENSION
keyword. There may also be other keywords present that describe the
extension, such asEXTNAME and
EXTTYPE, but these are not required.
TheEXTNAME keyword is used for the
Name column entry in theFITS File Summary window shown below.
An XTENSION Header
looks like the following:
|
XTENSION=
'IMAGE'
BITPIX = -32
NAXIS = 2
NAXIS1 = 512
NAXIS2 = 512
BSCALE = 1.512E02
/
DATE-OBS= '1999-21-05T05:20:45.005'
TIME-OBS= '05:20:45.005' /
EXPTIME = 500.0
MIRATYPE= '16
bit unsigned' /
OBJECT = 'This
string requires quotes'
HISTORY This
string uses no quotes
COMMENT This
string uses no quotes
END
|
Selecting Multiple HDU's and Image Planes
When a FITS Extension file is selected for opening,
Mira opens a secondary window listing a summary of extension
details. This window also opens when any HDU has NAXIS > 2 to permit 2-axis planes to be selected
for opening. For details, see the
FITS File Summary topic.
Related Topics
Contents
Image Windows
Working with FITS Format
FITS File Summary
Open FITS File
View and Search FITS Header
Save and Save as Commands
FITS Keywords
Pixel Scale Sensitive FITS Keywords
FITS Header Editor
FITS Header Pane
Modify Keywords
Add Metadata
Mira Pro x64 8.83 User's Guide, Copyright Ⓒ 2026 Mirametrics, Inc.
All Rights Reserved.
|