FitsOptions

class sofia_redux.scan.configuration.fits.FitsOptions(allow_error=False, verbose=True)[source]

Bases: Options

Initialize the FITS options.

The FITS options is a place in the configuration where values from a FITS header may be stored and acted on when necessary.

Parameters:
allow_errorbool, optional

If True, allow poorly formatted options to be skipped rather than raising an error.

verbosebool, optional

If True, issues a warning when a poorly option is encountered.

Methods Summary

clear()

Clear all options.

copy()

Return a copy of the FitsOptions.

get(key[, default, unalias])

Return the option value for a given key.

keys()

Return a list of all keys in the FITS options.

read(header[, extension])

Read a FITS header and apply the contents to the options.

reread()

Re-read the current FITS header.

reset_preserved_cards()

Clear all preserved header cards.

set(key, value)

Set the value for a given FITS header key.

set_preserved_card(key[, header])

Add a key to the preserved header cards.

update_header(header_options[, extension])

Update the

Methods Documentation

clear()[source]

Clear all options.

Returns:
None
copy()[source]

Return a copy of the FitsOptions.

Returns:
FitsOptions
get(key, default=None, unalias=True)[source]

Return the option value for a given key.

Parameters:
keystr

The FITS key value to retrieve.

defaultstr or object, optional

The value to return in cases where key does not exist in the options.

unaliasbool, optional

If True, unalias the key before attempting to retrieve it’s value.

Returns:
valuestr or object

The FITS header value for key.

keys()[source]

Return a list of all keys in the FITS options.

Returns:
list (str)
read(header, extension=0)[source]

Read a FITS header and apply the contents to the options.

Parameters:
headerfits.Header or str or dict or configobj.ConfigObj

The FITS header, options, or FITS file to read.

extensionint, optional

The HDU extension to read in cases where a file path is supplied in the header parameter.

Returns:
optionsconfigobj.ConfigObj
reread()[source]

Re-read the current FITS header.

Returns:
None
reset_preserved_cards()[source]

Clear all preserved header cards.

Returns:
None
set(key, value)[source]

Set the value for a given FITS header key.

Parameters:
keystr

The key for which to set a value.

valuestr or object, optional

The value to set.

Returns:
None
set_preserved_card(key, header=None)[source]

Add a key to the preserved header cards.

Parameters:
keystr

The name of the FITS options key to preserve.

headerfits.Header, optional

The header from which to extract the key value and comments. If not supplied, defaults to the currently stored header.

Returns:
None
update_header(header_options, extension=0)[source]

Update the

Parameters:
header_optionsfits.Header or str or dict or configobj.ConfigObj

The FITS header, file path, or options with which to update the FitsOptions.

extensionint, optional

The HDU extension to read in cases where a file path was passed in as the argument.

Returns:
None