FITSKeyword — MSUMastro toolbox 0.1 documentation

# FITSKeyword

class `msumastro.header_processing.fitskeyword.` `FITSKeyword`(name=None, value=None, comment=None, synonyms=None)

  Bases: `object`

  Represents a FITS keyword, which may have several synonyms.

  Parameters: | name : str, optional Name of the keyword; case insensitive value : str or numeric type, optional Value of the keyword; this class imposes no constraints on the type of the keyword but if you intend to save the value in a FITS header you should be aware of the restrictions the FITS standard places on keyword values. comment : str, optional Description of the keyword. synonyms : str or list of str, optional Synonyms for this keyword. Synonyms are to look for a value in a FITS header and to set multiple keywords to the same value in a FITS header.

  Attributes Summary

  `name` | Primary name of the keyword.
  `names` | All names, including synonyms, for this keyword, as a list.
  `synonyms` | List of synonyms for the keyword.

  Methods Summary

  `add_to_header`(hdu_or_header[, ...]) | Add keyword to FITS header.
  `history_comment`([with_name]) | Produce a string describing changes to the keyword value.
  `set_value_from_header`(hdu_or_header) | Set value of keyword from FITS header.

  Attributes Documentation

  `name`

    Primary name of the keyword.

  `names`

    All names, including synonyms, for this keyword, as a list.

  `synonyms`

    List of synonyms for the keyword.

  Methods Documentation

  `add_to_header`(hdu_or_header, with_synonyms=True, history=False)

    Add keyword to FITS header.

    Parameters: | hdu_or_header : astropy.io.fits.Header or astropy.io.fits.PrimaryHDU Header/HDU to which the keyword is to be added. with_synonyms : bool, optional Control whether a keyword is added for each of the synonyms for the keyword. Default is True. history : bool, optional Control whether a history comment is added to the header; if True a history comment is added for each of the keyword names added to the header, including synonyms.

  `history_comment`(with_name=None)

    Produce a string describing changes to the keyword value.

    Parameters: | with_name : str, optional Name to use for the keyword in the history comment. Default is the name attribute of the Keyword.

  `set_value_from_header`(hdu_or_header)

    Set value of keyword from FITS header.

    Values are obtained from the header by looking for the keyword by its primary name and any synonyms. If multiple values are found they are checked for consistency.

    Parameters: | hdu_or_header: astropy.io.fits.Header or astrop.io.fits.PrimaryHDU Header from which the keyword value should be taken.
    Raises: | ValueError If hdu_or_header is of the wrong type, or the keyword (or synonyms) are not found in the header, or multiple non-identical values are found.