Cometa#
- class epilepsy_tools.cometa.RecordingInfo(fs, samples, channels, start_time, end_time)#
Stores metadata of the recording (raw signals). Construct with
RecordingInfo.from_fileorRecordingInfo.from_data.- Parameters:
data (
pandas.DataFrame) – The data already loaded withload_data()fs (float)
samples (int)
start_time (datetime)
end_time (datetime)
- start_time#
Start date and time of recording.
- Type:
- end_time#
End date and time of recording.
- Type:
- duration#
Duration of recording.
- Type:
- classmethod from_data(data)#
Get the recording info of data already loaded. This is equivalent to instanciating the class directly.
- Parameters:
data (
pandas.DataFrame) – The Cometa data loaded fromload_data().- Returns:
The information of the recording.
- Return type:
- classmethod from_file(file)#
Get the recording info of a given .c3d file.
- Parameters:
file (
str|os.PathLike) – Path of the .c3d file.- Returns:
The information of the recording.
- Return type:
- epilepsy_tools.cometa.downsample(data, *, ratio)#
Downsample the data to every ratio values. ratio=2 means keep half of the data, 3 keep only the third.
- Parameters:
data (
pandas.DataFrame) – The Cometa data loaded from cometa.load_data.ratio (
int) – The ratio of the data to keep. 2 means keep half of the data (1/2), 3 means keep only one value every three (1/3).
- Returns:
The downsampled DataFrame
- Return type:
- epilepsy_tools.cometa.extract_acceleration_data(data)#
Take the DataFrame returned by load_data and keep only the columns containing the acceleration data.
- Parameters:
data (
pandas.DataFrame) – The Cometa data loaded fromload_data().- Returns:
A DataFrame with only the acceleration data.
- Return type:
- epilepsy_tools.cometa.extract_emg_data(data)#
Take the DataFrame returned by load_data and keep only the columns containing the EMG data.
- Parameters:
data (
pandas.DataFrame) – The Cometa data loaded fromload_data().- Returns:
A DataFrame with only the EMG data.
- Return type:
- epilepsy_tools.cometa.load_data(file)#
Read a .c3d file from the Cometa device. Depending on how many sensors were installed and which modality was recorded, the shape of the DataFrame might be different.
- Parameters:
file (
str|os.PathLike) – Path of the .c3d file.- Returns:
The data inside the .c3d file.
- Return type:
- Raises:
ValueError – The file provided is not a .c3d file.
- epilepsy_tools.cometa.plot_acceleration(data, *, norm=True)#
Plot the acceleration from a Cometa DataFrame. If norm=True (the default), calculate the norm of the acceleration vectors for each sensors (the X, Y and Z components) and plot that.
- Parameters:
data (
pandas.DataFrame) – The Cometa data loaded fromload_data().norm (
bool, optional) – If we should compute the norm of the acceleration vectors from components, by default True.
- Returns:
fig – The
Figurewith the data plotted.- Return type:
- epilepsy_tools.cometa.plot_emg(data)#
Plot the EMG data from a Cometa DataFrame.
- Parameters:
data (
pandas.DataFrame) – The Cometa data loaded fromload_data().- Returns:
fig – The
Figurewith the data plotted.- Return type:
Examples#
See examples in Cometa Examples.