merge_headers

sofia_redux.toolkit.utilities.fits.merge_headers(headers, keyword_configuration, reference_header=None)[source]

Merge input headers.

Keyword handling is defined in the input configuration file, in ConfigObj format, as a list of keyword = value pairs. Allowed values are:

  • LAST : take the value from the latest file, by DATE-OBS

  • CONCATENATE : join unique string values with a ‘,’

  • DEFAULT : set to ‘UNKNOWN’ for strings, -9999 for numbers

  • OR : logical-or boolean values

  • AND : logical-and boolean values

  • MEAN : mean of all values

  • SUM : sum of all values

Parameters:
headerslist of astropy.io.fits.Header

Headers to check.

keyword_configurationstr, dict, or ConfigObj

Configuration file name or object.

reference_headerastropy.io.fits.Header, optional

If provided, is used as the base header to be updated. If not provided, the first header (by DATE-OBS) is used as the reference.

Returns:
astropy.io.fits.Header

Combined header.