resistics.mask.io module

class resistics.mask.io.MaskIO(datapath: str = '')[source]

Bases: resistics.common.base.ResisticsBase

Class for reading and writing maskData

Masks are referenced to sampling frequencies rather than particular measurements. The idea if that masks are calculated out for all the data and later, the data can be constrained either using date and time constraints or by using window masks based on statistics.

Mask files are located in: project -> maskData -> site -> sample frequency -> specdir

Attributes
datapathstr

Path to mask file directory

Methods

__init__(datapath)

Initialise the MaskIO object. read(maskName, sampleFreq) Read in maskName for sampleFreq from datapath write(maskData) Write out maskData object to datapath. getFileNames(makeName, sampleFreq) The filename for a maskFile given a maskName and sampling frequency

printList()

Class status returned as list of strings

getFileNames(self, maskName: str, sampleFreq: float) → Tuple[str, str][source]

Get the name of a mask file

This method is here to give consistent file names for mask files.

Parameters
maskNamestr

The name of the mask

sampleFreqfloat

The sampling frequency of the data

Returns
infoFilestr

The name of the mask infoFile

winFilestr

The name of the mask winFile

printList(self) → List[str][source]

Class information as a list of strings

Returns
outList[str]

List of strings with information

read(self, maskName: str, sampleFreq: float) → resistics.mask.data.MaskData[source]

Read in maskData from a file defined by maskName and sampleFreq

Parameters
maskNameMaskData

MaskData object

sampleFreqfloat

The sampling frequency of the data

Returns
maskDataMaskData

The MaskData object

write(self, maskData: resistics.mask.data.MaskData) → None[source]

Write the maskData out to datapath

Mask data is saved as a numpy binary object

Parameters
maskDataMaskData

MaskData object