resistics.decimate.parameters module

class resistics.decimate.parameters.DecimationParameters(sampleFreq: float)[source]

Bases: resistics.common.base.ResisticsBase

Class to calculate and hold decimation parameters

Attributes
sampleFreqfloat

Sampling frequency in Hz.

divFactorint

Minimum division factor when working out decimation factors

numLevelsint

Number of decimation levels

freqPerLevelint

Number of frequencies per decimation level

decFactorsnp.ndarray

Incremental decimation factors

decFrequenciesnp.ndarray

Sampling frequencies at each decimation level

evalFreqnp.ndarray

Array of evaluation frequencies

evalFreqPerLevelnp.ndarray

2-D array (numLevels,freqPerLevel) of evaluation frequencies

Methods

__init__(sampleFreq)

Initialise with sampling frequency

getSampleFreqLevel(decLevel)

Get the sample frequency of the level

getDecFactor(decLevel)

Get the decimation factor from level 0 to decLevel

getIncrementalFactor(decLevel)

Get the decimation factor from decLevel-1 to decLevel

getEvalFrequenciesForLevel(decLevel)

Returns evaluation frequencies for decLevel

setFrequencyParams(evalFreq, freqPerLevel, maxLevel)

Set decimation parameters by evaluation frequencies and frequencies per level

setDecimationParams(numLevels, freqPerLevel)

Set decimation parameters by number of levels and frequencies per level

calcFrequencyParams(numLevels, freqPerLevel)

Calculate decimation parameters based on number of levels and frequencies per level

calcDecimationParams(evalFreq, maxLevel, freqPerLevel)

Calculate decimation paratmers based on evaluation frequencies, frequecies per level and max level

calcNearestFactor(freq)

Calculate nearest decimation factor

printList()

Class status returned as list of strings

calcDecimationParams(self, evalFreq: Union[numpy.ndarray, List], maxLevel: int, freqPerLevel: int) → None[source]

Calculate decimation parameters from evaluation frequencies

Uses evaluation frequencies, number of frequencies per decimation level and max allowable decimation level to calculate decimation parameters.

Parameters
evalFreqList, np.ndarray

Number of decimation levels

maxLevelint

Maximum allowable number of decimation levels

freqPerLevel :

Number of frequencies per level

calcFrequencyParams(self, numLevels: int, freqPerLevel: int) → None[source]

Calculates evaluation frequencies and decimation parameters

Uses number of levels and frequencies per levels to auto-calculate evaluation frequencies and then the decimation parameters.

Parameters
numLevelsint

Number of decimation levels

freqPerLevelint

Number of evaluation frequencies per level

calcNearestFactor(self, freq: float)[source]

Calculates nearest decimation factor given frequency

Parameters
freqfloat

Frequency for which to calculate decimation factor

Returns
facint

The decimation factor

ffloat

Sampling frequency in Hz given the decimation factor (sampleFreq/decimationFactor)

checkDecimationLevel(self, decLevel: int) → None[source]

Checks user provided decimation levels and quits if out of bounds

Parameters
decLevelint

Decimation level

getDecFactor(self, decLevel: int) → float[source]

Get decimation factor for decimation level

Returns decimation factor relative to level 0

Parameters
decLevelint

Decimation level

Returns
outfloat

Decimation factor for level decLevel

getEvalFrequenciesForLevel(self, decLevel: int) → numpy.ndarray[source]

Get evaluation frequencies for level decLevel

Parameters
decLevelint

Decimation level

Returns
outnp.ndarray

Array of evaluation frequencies for level decLevel

getIncrementalFactor(self, decLevel: int) → int[source]

Get decimation factor for decimation level

Returns decimation factor relative to decLevel - 1

Parameters
decLevelint

Decimation level

Returns
outint

Incremental decimation factor from decLevel - 1

getSampleFreqLevel(self, decLevel: int) → float[source]

Get sampling frequency for decimation level

Parameters
decLevelint

Decimation level

Returns
outfloat

Sample frequency for decimation level decLevel

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

Class information as a list of strings

Returns
outlist

List of strings with information

setDecimationParams(self, numLevels: int, freqPerLevel: int) → None[source]

Sets number of levels and frequencies per levels to calculate decimation parameters

Parameters
numLevelsint

Number of decimation levels

freqPerLevelint

Number of evaluation frequencies per level

setFrequencyParams(self, evalFreq: List, freqPerLevel: int, maxLevel: int) → None[source]

Sets frequency parameters and calculates decimation paramters based on those

Parameters
evalFreqList

Evaluation frequencies

freqPerLevelint

Number of evaluation frequencies per level

maxLevelint

Maximum decimation level