FITS (.fits, .fit)

Background

    • MIME types: application/fits, image/fits
    • FITS scientific image and data format.
    • Standard format for the exchange and archival storage of astronomical data.
    • Endorsed by NASA and the International Astronomical Union.
    • FITS is an acronym for Flexible Image Transport System.
    • Allows multiple header-data units (HDUs).
    • Each HDU can be an image, an ASCII table or a binary table.
    • Image HDUs can only store arrays of single-channel 2D images.
    • Binary and ASCII table HDUs can only store 2D data.
    • Elements of a binary table can be multidimensional arrays.
    • Stores spectral data and raster images as arrays.
    • Developed in 1979 by Don Wells, Eric Greisen, and others.

Import & Export

  • Import["file.fits"] imports a FITS file as an image or an array of data values, depending on the HDU type, for a single HDU file.
  • Import["file.fits"] returns an association of the form <|1->hdu1,|> for all HDUs in the file.
  • Import["file.fits",elem] imports the specified element from a FITS file.
  • Import["file.fits",{elem, i}] returns elem stored in the i^(th) HDU.
  • The import format can be specified with Import["file","FITS"] or Import["file",{"FITS",elem,}].
  • Export["file.fits",expr] exports images and graphics as an image to a FITS file, at their raster sizes.
  • Export["file.fits",expr] exports string and numeric arrays as a table to a FITS file.
  • Export["file.fits",1->expr1,] exports expri to the i^(th) HDU.
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the FITS format.

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Structure elements:
  • "HDUCount"number of HDUs
    "Summary"summary of the file
    "SummarySlideView"slide-view summary of all HDUs
  • All elements of a FITS file are imported as a numbered association, returned in the form 1val1,2val2,.
  • Data representation elements:
  • "Data"array of pixel values or table elements
    "Plaintext"representation of image and table extensions as a string
    "RawData"raw data as stored in the file
  • Additional elements, available for image HDUs:
  • "Graphics"raster image, given as a Graphics object
    "Image"raster image, given as an Image object
    "IndeterminateMask"a SparseArray representing indeterminate values in the image
  • Additional elements, available for binary and ASCII table HDUs:
  • "TableData"representation of table extension
    "TableHeaders"table column headers
    "TableUnits"units of measurement corresponding to the table columns
  • Import and Export by default use the "Image" element for image HDUs and the "Data" element for binary and ASCII table HDUs.
  • Subelements for partial data import can be given in one of the following forms:
  • {elem,hdu}for any element
    {elem,hdu,rows,cols}for data elements of single-image and table HDUs
    {elem,hdu,spec1,spec2,,rows,cols}for data elements of higher-dimensional image HDUs
  • Part specification for hdu, speci, rows and cols can be any of the following:
  • Allall HDUs
    nnth HDU
    n;;mHDU n through m
    n;;m;;sfrom n through m with steps of s
    {n1,n2,}specific HDUs ni
  • Advanced elements:
  • "BitDepth"bits used to represent gray-level pixels in the file
    "Channels"the number of color channels used in the file
    "ColorSpace"color encoding used in the file
    "DataType"data type used to store image or table data in the file
    "Dimensions"data dimensions
    "Extension"type of the HDU extension
    "ImageSize"raster dimensions of a single frame
    "Range"minimum and maximum raw data values
  • General metadata elements:
  • "MetaInformation"processed metadata
    "RawMetaInformation"raw metadata as stored in the file
  • Information about the recording device and environment:
  • "Airmass"relative airmass
    "Declination"declination setting of the telescope axis
    "Device"recording instrument (e.g. camera)
    "Equinox"equinox for the celestial coordinate system used in this file, typically given in years
    "ExposureTime"photographic exposure time in seconds
    "HourAngle"hour angle of the depicted object when the image was taken
    "ObservationDate"date and time the observation was made
    "RightAscension"right ascension setting of the telescope axis
    "SiderealTime"sidereal time (LST)
    "Telescope"telescope that captured the image
  • Bibliographic information elements:
  • "Author"person who compiled the image information
    "Reference"bibliographic reference associated with this file
  • Other common metadata elements:
  • "Comments"comments for each piece of data or image stored in the file
    "History"description of how the data or image has been processed
    "Object"name of the observed object
    "Observer"person who recorded the data or image
    "Organization"organization or institution responsible for creating this file
  • Metadata field names are converted to all caps on export to conform with FITS standard.

Options

  • Import and Export option:
  • DataReversedAutomaticwhether to reverse the order of rows
  • Import options:
  • ColorFunctionAutomatichow each cell should be colored
    ImageSizeAutomaticoverall image size
    "Gamma"1.0gamma correction parameter used for rendering
    "IncludeExtensions"AllHDU extensions to import
    "IncludeHeaders"Falsewhether to import table headers
  • Export options:
  • "Append"Falsewhether to append to an existing file
    "CompressionMethod"Nonecompression algorithm to use on export
    "MetaInformation"Nonemetainformation per header to be added on export
  • Possible settings for "CompressionMethod" include "GZIP", "GZIPShuffled", "Rice", "HCompress" and "PLIO".

Examples

open all close all

Basic Examples  (3)

Import a FITS file containing image data:

In[1]:=
Click for copyable input
Out[1]=

Import a FITS file with multiple HDUs:

In[1]:=
Click for copyable input
Out[1]=

Export an image to FITS:

In[1]:=
Click for copyable input
Out[1]=

Scope  (7)

Import Elements  (44)

Export Elements  (4)

Import Options  (6)

Export Options  (3)

Possible Issues  (2)

Introduced in 2002
(4.2)
|
Updated in 2019
(12.0)