StepLoadAux

class sofia_redux.instruments.hawc.steploadaux.StepLoadAux[source]

Bases: StepParent

Pipeline step parent class with auxiliary data support.

This class provides a pipe step with a simple mechanism to search auxiliary files and match them to input data. An initial list of potential aux files is determined from a path/filename string (a glob); the final file(s) is determined by matching header keywords between the auxiliary files and the step input data.

This object does not have a conventional setup function since it is intended to be inherited by other steps. Steps that inherit from this class should call the loadauxsetup function explicitly inside their setup functions, in order to set up the auxiliary data parameters.

Methods Summary

getdataobj(filename)

Retrieve the DataParent child appropriate to the data.

loadauxfile([auxpar, data, multi])

Load an auxiliary file into a pipeline data object.

loadauxname([auxpar, data, multi])

Search for files matching auxfile.

loadauxsetup([auxpar])

Load parameters for auxiliary file identification.

Methods Documentation

getdataobj(filename)[source]

Retrieve the DataParent child appropriate to the data.

Checks the filename to determine if it is likely to be a FITS file. If not, data is assumed to be text.

The returned object is initialized with self.config, but data from the input file is not loaded.

Parameters:
filenamestr

Path to the file to test.

Returns:
DataFits or DataText

The data object. Data is not loaded from the filename.

loadauxfile(auxpar='', data=None, multi=False)[source]

Load an auxiliary file into a pipeline data object.

Uses loadauxname to search for files matching auxfile.

auxparstr, optional

A name for the aux file parameter to use. This allows loadauxfiles to be used multiple times in a given pipe step (for example for darks and flats). Default value is self.auxpar which is set by loadauxsetup().

dataDataFits or DataText, optional

A data object to match the auxiliary file to. If no data is specified, self.datain is used (for Multi Input steps self.datain[0]).

multibool, optional

If set, a list of file names is returned instead of a single file name.

Returns:
DataFits or DataText, or a list of DataFits or DataText

A data object with the best match is returned.

loadauxname(auxpar='', data=None, multi=False)[source]

Search for files matching auxfile.

If only one match is found, that file is returned. Otherwise, the header keywords listed in auxfitkeys are matched between the data and any auxfiles found. The first auxfile for which these keyword values match the data values is selected. The filename of the best match is returned.

Parameters:
auxparstr, optional

A name for the aux file parameter to use. This allows loadauxfiles to be used multiple times in a given pipe step (for example for darks and flats). Default value is self.auxpar which is set by loadauxsetup().

dataDataFits or DataText, optional

A data object to match the auxiliary file to. If no data is specified, self.datain is used (for Multi Input steps self.datain[0]).

multibool, optional

If set, a list of file names is returned instead of a single file name.

Returns:
str or list of str

The matching auxiliary file(s).

loadauxsetup(auxpar='aux')[source]

Load parameters for auxiliary file identification.

This function should be called within the setup function for a pipeline step, after self.paramlist has been initialized.

Parameters:
auxparstr, optional

The auxiliary file type. This string will appear in the names of the parameters added to the step.