resistics.spectra.data module¶
-
class
resistics.spectra.data.
SpectrumData
(windowSize: int, dataSize: int, sampleFreq: float, startTime: Union[datetime.datetime, str], stopTime: Union[datetime.datetime, str], data, comments: List[str] = [])[source]¶ Bases:
resistics.common.base.ResisticsBase
Class for holding spectra data
- Attributes
- windowSizeint
The size of the time window in samples
- dataSizeint
The number of samples in the frequency spectra
- sampleFreqfloat
The sampling frequency
- startTimedatetime.datetime
The time of the first sample of the time data which was fourier transformed
- stopTimedatetime.time
The time of the last sample of the time data which was fourier transformed
- chansList[str]
The channels in the data
- numChansint
The number of channels
- dataDict
The spectra data with channels as keys and arrays as values
- commentsList[str]
Information about the spectra data as a list of strings
Methods
__init__(kwargs)
Initialise spectra data
setData(windowSize, dataSize, sampleFreq, startTime, stopTime, data)
Set data with parameters
getComments()
Get a deepcopy of the comments
addComment(comment)
Add a comment to the dataset
copy()
Get a copy of the spectrum data
view(kwargs)
View the spectra data
printList()
Class status returned as list of strings
-
addComment
(self, comment: str) → None[source]¶ Add a new comment
- Parameters
- commentfloat
A new comment
-
copy
(self)[source]¶ Get a copy of the time data object
- Returns
- TimeData
A copy of the time data object
-
property
freqArray
¶ Get the frequency array of the spectra data
- Returns
- freqArraynp.ndarray
Array of frequencies
-
getComments
(self) → List[str][source]¶ Get a deepcopy of the comments
- Returns
- List[str]
Dataset comments as a list of strings
-
property
nyquist
¶ Get the nyquist frequency of the spectra data
- Returns
- nyquistfloat
The nyquist frequency in Hz
-
printList
(self) → List[str][source]¶ Class information as a list of strings
- Returns
- outList[str]
List of strings with information
-
setData
(self, windowSize: int, dataSize: int, sampleFreq: float, startTime: Union[datetime.datetime, str], stopTime: Union[datetime.datetime, str], data) → None[source]¶ Set the object parameters
- Parameters
- windowSizeint
The window size in samples of the time data
- dataSizeint
The spectra size in samples
- 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
- commentsList[str]
Dataset comments
-
view
(self, **kwargs) → matplotlib.figure.Figure[source]¶ Plot spectra data
- Parameters
- figmatplotlib.pyplot.figure, optional
A figure object
- plotfontsDict, optional
A dictionary of plot fonts
- chansList[str], optional
A list of channels to plot
- labelstr, optional
Label for the plots
- xlimList, optional
Limits for the x axis
- colorstr, rgba Tuple
The color for the line plot
- legendbool
Boolean flag for adding a legend
- Returns
- plt.figure
Matplotlib figure object