resistics.time.data module

class resistics.time.data.TimeData(sampleFreq: float, startTime: Union[datetime.datetime, str], stopTime: Union[datetime.datetime, str], data, comments: Union[str, List[str]] = [])[source]

Bases: resistics.common.base.ResisticsBase

Class for holding time data

Attributes
numSamplesint

The number of samples in the data

sampleFreqfloat

The sampling frequency

startTimedatetime.datetime

The time of the first sample

stopTimedatetime.datetime

The time of the last sample

chansList[str]

The channels in the data

numChansint

The number of channels

dataDict

The time data with channels as keys and arrays as values

commentsList[str]

Information about the time data as a list of strings

Methods

__init__(kwargs)

Initialise the time data

setData(windowSize, dataSize, sampleFreq, startTime, stopTime, data)

Set data with parameters

getDateArray()

(np.ndarray) A datetime array of the sample times

getComments()

Get a deepcopy of the comments

addComment(comment)

Add a comment to the dataset

copy()

Get a copy of the timeseries data

view(kwargs)

View the time data

printList()

Class status returned as list of strings

addComment(self, comment: str) → None[source]

Add a new comment

Parameters
commentstr

A new comment

copy(self)[source]

Get a copy of the time data object

Returns
TimeData

A copy of the time data object

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

Get a deepcopy of the comments

Returns
List[str]

Dataset comments as a list of strings

getDateArray(self) → numpy.ndarray[source]

Get the date array

Returns
np.ndarray

The date array of the time samples

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

Class information as a list of strings

Returns
outList[str]

List of strings with information

setData(self, sampleFreq: float, startTime: Union[datetime.datetime, str], stopTime: Union[datetime.datetime, str], data)[source]

Set the object parameters

Parameters
sampleFreqfloat

The sampling frequency in Hz

startTimedatetime, str

The startTime of the window

stopTimedatetime, str

The stopTime of the window

dataDict

The data dictionary with keys as channels and values as spectra data

view(self, **kwargs) → matplotlib.figure.Figure[source]

View timeseries data as a line plot

Parameters
sampleStartint, optional

Sample to start plotting from

sampleStopint, optional

Sample to plot to

figmatplotlib.pyplot.figure, optional

A figure object

plotfontsDict, optional

A dictionary of plot fonts

chansList[str]

Channels to plot

labelstr, optional

Label for the plots

xlimList, optional

Limits for the x axis

legenedbool

Boolean flag for adding a legend

Returns
plt.figure

Matplotlib figure object