Skip to content

Instantly share code, notes, and snippets.

@gpdf
Created October 29, 2019 17:30
Show Gist options
  • Save gpdf/42755018c593aec01f6cb91e8a1525b8 to your computer and use it in GitHub Desktop.
Save gpdf/42755018c593aec01f6cb91e8a1525b8 to your computer and use it in GitHub Desktop.

A full discussion of FITS formats with links to definitive documentation is available. Since different packages support distinct subsets of the available FITS formats and conventions we briefly summarize them here.

A FITS file is comprised of segments called Header and Data Units (HDUs) which may be any of four formats. The table indicates the formats each package supports.

  • FITS images are generally supported and can include 1-999 dimensional arrays of unsigned bytes, signed 2 and 4 byte integers and 4 and 8 byte floating point numbers using IEEE representations. Some packages may only read images in the first HDU.
  • FITS binary tables store tabular information in a binary representation. Each cell in the table can be a multidimensional array but the dimensionality of the array must be constant within a column. The strict standard supports only one-dimensional arrays, but a convention to support multi-dimensional arrays is widely accepted. Binary tables can support the datatypes available for images as well as logical variables (stored as T and F), bit arrays, 8 and 16 byte complex numbers, and strings (as arrays of characters).
  • FITS ASCII tables store tabular information with all numeric information stored in ASCII formats. While ASCII tables are generally less efficient than binary tables, they can be made relatively human readable and can store numeric information with essentially arbitrary size and accuracy (e.g., 16 byte reals).
  • The random groups extension is currently deprecated but is nonetheless extensively used in radio astronomy. It allows groups of arrays where each element of the group has exactly the same dimensionality.

The variable-length-arrays convention is not strictly now part of the FITS standard but and is widely used. It allows one or more columns in a FITS binary table to consist of pointers to a heap area with each pointer defining the length and location of the array entry for the given row. Many FITS readers can read information that has been stored using standard compression algorithms, particularly the .Z and .gz files created by the Unix compress and gzip utilities. In addition, the FITS standard specifies means for data compression that may be more efficient for astronomical data.

A number of Several additional conventions are also supported by some FITS readers. None Some of these are now part of the official standard, but were added since a number of the FITS-reading libraries were written. In general use of these conventions should be avoided where possible in data distributed to the general community. Support for these conventions is not widespread. Users may wish to ensure that their specific communities' software are prepared to handle these features before committing to them.

  • The long-string standard allows FITS headers to specify string values longer than 68 characters.
  • The FITS hierarchical grouping convention defines a kind of FITS table which describes an association of HDUs which may span multiple files.
  • The header inheritance convention allows for FITS header information in the primary HDU to be used to default information in subsequent HDUs.
  • The HIERARCH keyword convention allows FITS keywords to be longer than the standard value of 8 characters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment