resistics.window.utils module

resistics.window.utils.datetime2gIndex(refTime: datetime.datetime, inTime: datetime.datetime, fs: float, windowSize: int, windowOverlap: int)[source]

Datetime to global index convertor

Global index 0 corresponds to reference time. This returns the global index of the time window nearest to inTime

Parameters
refTimedatetime.datetime

Reference time

inTimedatetime.datetime

Time for which you want closest global index

fsfloat

Sampling frequency in Hz

windowSizeint

Size of windows

windowOverlapint

Size of window overlaps

Returns
gIndexint

Global window index closest to inTime

firstWindowTimedatetime.datetime

Datetime of the global window

resistics.window.utils.gArray2datetime(gArray: numpy.ndarray, refTime: datetime.datetime, fs: float, windowSize: int, windowOverlap: int)[source]

Global index array to datetime convertor

Global index 0 corresponds to reference time

Parameters
gArraynp.ndarray

Globel indices array

refTimedatetime.datetime

Reference time

fsfloat

Sampling frequency in Hz

windowSizeint

Size of windows

windowOverlapint

Size of window overlaps

Returns
startTimenp.ndarray of datetime.datetime

Start times of global windows

endTimenp.ndarray of datetime.datetime

End times of global windows

resistics.window.utils.gArray2timestamp(gArray: numpy.ndarray, refTime: datetime.datetime, fs: float, windowSize: int, windowOverlap: int)[source]

Global index array to timestamp convertor

Global index 0 corresponds to reference time

Parameters
gArraynp.ndarray

Globel indices array

refTimedatetime.datetime

Reference time

fsfloat

Sampling frequency in Hz

windowSizeint

Size of windows

windowOverlapint

Size of window overlaps

Returns
startTimeUNIX timestamp

Start times of global windows

endTimeUNIX timestamp

End times of global windows

resistics.window.utils.gIndex2datetime(gIndex: int, refTime: datetime.datetime, fs: float, windowSize: int, windowOverlap: int)[source]

Global index to datetime convertor

Global index 0 corresponds to reference time

Parameters
gIndexint

Globel index

refTimedatetime.datetime

Reference time

fsfloat

Sampling frequency in Hz

windowSizeint

Size of windows

windowOverlapint

Size of window overlaps

Returns
startTimedatetime.datetime

Start time of global window gIndex

endTimedatetime.datetime

End time of global window gIndex

resistics.window.utils.gIndex2timestamp(gIndex: int, refTime: datetime.datetime, fs: float, windowSize: int, windowOverlap: int)[source]

Global index to timestamp convertor

Global index 0 corresponds to reference time

Parameters
gIndexint

Globel index

refTimedatetime.datetime

Reference time

fsfloat

Sampling frequency in Hz

windowSizeint

Size of windows

windowOverlapint

Size of window overlaps

Returns
startTimeUNIX timestamp

Start time of global window gIndex

endTimeUNIX timestamp

End time of global window gIndex