resistics.window.windower module

class resistics.window.windower.Windower(refTime: datetime.datetime, timeData: resistics.time.data.TimeData, winSize: int, winOlap: int)[source]

Bases: resistics.common.base.ResisticsBase

Class for windowing time data with overlaps

Given time data for a decimation level and a reference time, the windower calculates the number of windows and returns them.

Attributes
timeDataTimeData

TimeData object to window

numSamplesint

The number of samples in each window

sampleFreqfloat

Sampling frequency of data in Hz

winSizeint

Number of samples in a window

winDurationfloat

Duration of a window in seconds

winOlapnp.ndarray

Number of overlap samples

chansList[str]

List of chans in timeData

refTimedatetime

Project reference time

dataTimedatetime

Time of timeData first sample

minWindowsint

Minimum number of windows required

winOffsetint

Offset between local and global window indexing

firstWindowTime: datetime

Time of the first window in the TimeData

winSamplesnp.ndarray[int]

Two dimensional, the sample start and end for each window

winTimes :
winActivenp.ndarray[bool]

Boolean flagging whether window is active or not

Methods

__init__(refTime, timeData, winSize, winOlap)

Initialise windower

getWindowActive(iW)

getGlobalIndex(iW)

Return the global index (relative to reference time) given local window index

getData(iWindow)

Get timeData for local window iWindow

getDataGlobal(iGlobal)

Get timeData for glonal index iGlobal

initialiseWindows()

Calculate number of windows, local to global index mapping and local window offset from global

printList()

Class status returned as list of strings

printWindowTimes()

Print window times

printWindowTimeList()

Window time information returned as List of strings

calcWindowTimes(self) → None[source]

Calculate start and stop times for each window

getData(self, iWindow: int) → resistics.time.data.TimeData[source]

Returns time window data for local index

Parameters
iWindowint

Local index of window

Returns
windowDataTimeData

TimeData object with the window data

getDataGlobal(self, iGlobal: int) → resistics.time.data.TimeData[source]

Returns time window data for global index

Parameters
iGlobalint

Global index of window

Returns
windowDataTimeData

TimeData object with the window data

getGlobalIndex(self, iWindow: int) → int[source]

Returns global index for local index

Parameters
iWindowint

Local index of window

Returns
iGlobalint

Global index

getWindowActive(self, iWindow: int) → bool[source]

Returns active status of local index

Parameters
iWindowint

Local index of window

Returns
activebool

True if active, false if not

initialiseWindows(self)[source]

Calculate all the window information

For timeData and referenceTime, initialiseWindows calculates the number of windows (after the reference time) and the global indices of the windows relative to the reference time Stores the offset between local indices and the global indices

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

Class information as a list of strings

Returns
outlist

List of strings with information

printWindowTimeList(self) → List[source]

Window time information as a list of strings

Returns
outlist

List of strings with information

printWindowTimes(self) → None[source]

Print the times of the windows