DataText

class sofia_redux.instruments.hawc.datatext.DataText(filename='', config=None)[source]

Bases: DataParent

Pipeline data text object.

The data is stored as a list of strings, with an optional header.

Initialize data object and variables.

Parameters:
filenamestr, optional

Path to a text file. If specified, data will be loaded immediately from the file.

configconfigobj.ConfigObj, dict, str, or list of str, optional

If specified, the configuration will be loaded.

Attributes Summary

filenamefit

str : Regular expression that matches valid text file names.

Methods Summary

load([filename])

Load the data and header from a given text file.

loadhead([filename])

Load the header for text file given.

save([filename])

Save the data to the specified file.

sethead(line)

Add a text line to the header.

Attributes Documentation

filenamefit = '\\.txt\\Z'

str : Regular expression that matches valid text file names.

Methods Documentation

load(filename='')[source]

Load the data and header from a given text file.

After loading, self.loaded is set to True.

Parameters:
filenamestr, optional

The path to the file to load.

loadhead(filename='')[source]

Load the header for text file given.

Header lines are identified by the self.headermatch regular expression.

Parameters:
filenamestr, optional

The path to the file to load. If not specified, self.filename is used.

save(filename='')[source]

Save the data to the specified file.

Existing files are overwritten.

Parameters:
filenamestr, optional

The path to the file to load.

sethead(line)[source]

Add a text line to the header.

Header keywords in the line are identified by the self.keymatch regular expression.

Parameters:
linestr

The header line to add.