seiz_eeg.dataset¶
EEG Data class with common data retrieval
- class seiz_eeg.dataset.EEGDataset(clips_df: DataFrame[ClipsDF], *, signal_transform: Callable[[ndarray[Any, dtype[float64]]], ndarray[Any, dtype[_ScalarType_co]] | Any] | None = None, label_transform: Callable[[int], Any] | None = None, prefetch: bool = False, diff_channels: bool = False)¶
Dataset of EEG clips with seizure labels
- Parameters:
clips_df (DataFrame[ClipsDF]) – Pandas dataframe of EEG clips annotations
signal_transform (Callable[[NDArray[float]], NDArray | Any], optional) – Function to transform signals before they are returned. Defaults to None.
label_transform (Callable[[int], Any], optional) – Function to transform labels before they are returned. Defaults to None.
prefetch (bool, optional) – Wether to prefetch all clips. Defaults to False.
diff_channels (bool, optional) – Wether to subtract pairwise channels. Defaults to False.
- clip_lenght¶
Lenght of each clip in seconds.
- Type:
float
- s_rate¶
Sampling rate of the clips.
- Type:
int
- output_shape¶
Shape of the output tensors.
- Type:
Tuple[tuple, tuple]
- class seiz_eeg.dataset.EEGFileDataset(clips_df: DataFrame[ClipsDF], *, signal_transform: Callable[[ndarray[Any, dtype[float64]]], ndarray[Any, dtype[_ScalarType_co]] | Any] | None = None, label_transform: Callable[[int], Any] | None = None, diff_channels: bool = False)¶
Extension of
EEGDataset
which returns a tensor of all clips from the same file.
- seiz_eeg.dataset.to_arrays(data: EEGDataset, pbar=False) Tuple[ndarray[Any, dtype[float64]], ndarray[Any, dtype[int64]]] ¶
Load all signals from
data
into a tensor.- Parameters:
data (EEGDataset) – Clips dataset. All clips must have the same lenght to be stacked.
pbar (bool, optional) – Wether toshow a progress bar while loading. Defaults to False.
- Returns:
Signals and labels
- Return type:
Tuple[NDArray[float], NDArray[int]]