getpar

sofia_redux.instruments.forcast.getpar.getpar(header, parname, writename=None, dtype=None, comment=None, update_header=True, default=None, dripconf=True, warn=False)[source]

Get a header or configuration parameter

Looks up a parameter from the DRIP configuration or the provided header. Values in the configuration file take precedence over values in the header. This function converts all parameters to string values before returning them. If a parameter cannot be found in either the configuration file or the header, then None will be returned.

Any string values enclosed within single quotes will have those outer quotes removed.

Parameters:
headerastropy.io.fits.header.Header

Input header

parnamestr

Parameter name

writenamestr

If set, the parameter to be returned will be added or modified in the header

update_headerbool

Will update the header if True

commentstr

Comment to write to the header along with the parameter

dtypetype

Attempt to convert the value to a float or int type. Failure will return zero of either type.

default

Value to return if not found. Note that an attempt will be made to convert default to type dtype if dtype is supplied.

dripconfbool, optional

Indicates whether configuration values can overwrite header keyword values.

warnbool, optional

Sends a message to logger at warning level if the default value is used.

Returns:
String or None if from the configuration. Otherwise it could
be anything, or set it yourself via dtype.