{ } Raw JSON

bundles / astropy latest / astropy / io / fits / header / Header

class

astropy.io.fits.header:Header

source: /astropy/io/fits/header.py :54

Signature

class   Header ( cards = [] copy = False )

Members

Summary

FITS header class. This class exposes both a dict-like interface and a list-like interface to FITS headers.

Extended Summary

The header may be indexed by keyword and, like a dict, the associated value will be returned. When the header contains cards with duplicate keywords, only the value of the first card with the given keyword will be returned. It is also possible to use a 2-tuple as the index in the form (keyword, n)--this returns the n-th value with that keyword, in the case where there are duplicate keywords.

For example

>>> header['NAXIS']
0
>>> header[('FOO', 1)]  # Return the value of the second FOO keyword
'foo'

The header may also be indexed by card number

>>> header[0]  # Return the value of the first card in the header
'T'

Commentary keywords such as HISTORY and COMMENT are special cases: When indexing the Header object with either 'HISTORY' or 'COMMENT' a list of all the HISTORY/COMMENT values is returned

>>> header['HISTORY']
This is the first history entry in this header.
This is the second history entry in this header.
...

See the Astropy documentation for more details on working with headers.

Notes

Although FITS keywords must be exclusively upper case, retrieving an item in a Header object is case insensitive.

Aliases

  • astropy.io.fits.Header