biosip_tools.eeg package¶
Submodules¶
biosip_tools.eeg.constants module¶
biosip_tools.eeg.timeseries module¶
- class biosip_tools.eeg.timeseries.EEGSeries(data: Optional[numpy.ndarray] = None, path: Optional[str] = None, sample_rate: int = 500)¶
Bases:
objectClass for EEG time series.
- Parameters
data (np.ndarray) – EEG data.
path (str) – Path to .npy array. Expected shape is (n_subjects, n_channels, n_samples)
sample_rate (int, optional) – sample rate, defaults to 500
- append(new_data) None¶
Append new data to the EEG data.
- Parameters
new_data (EEGSeries) – Data to append.
- apply_cheby_filter(lowcut: float, highcut: float, order: int = 6, rs: float = 40, plot_response=False)¶
Apply a Chebyshev II filter to the EEG data.
- Parameters
lowcut (float) – Lower pass-band edge.
highcut (float) – Upper pass-band edge.
order (int, optional) – [description], defaults to 6
rs (float, optional) – [description], defaults to 40
plot_response (bool, optional) – [description], defaults to False
- Returns
Filtered data
- Return type
- cheby_filter_bands(**kwargs) dict¶
Return a dictionary of filtered EEG data.
- Returns
Dictionary of filtered data. {band_name: data}
- Return type
dict
- fir_filter(l_freq: float, h_freq: float, verbose=False, **kwargs) numpy.ndarray¶
Apply a FIR filter to the EEG data. Accepts arguments for mne.filter.filter_data.
- Parameters
l_freq (float) – Lower pass-band edge.
h_freq (float) – Upper pass-band edge.
- Returns
Filtered data
- Return type
- fir_filter_bands(**kwargs) dict¶
Return a dictionary of filtered EEG data.
- Returns
Dictionary of filtered data. {band_name: data}
- Return type
dict
biosip_tools.eeg.utils module¶
- biosip_tools.eeg.utils.window_data_loader(eegs: biosip_tools.eeg.timeseries.EEGSeries, batch_size: int = 32, window_size: float = 1, infinity: bool = False, labels: Optional[numpy.ndarray] = None, epochs=1, shuffle: bool = False, return_subjects=False, stride: Optional[float] = None) tuple¶
[summary]
- Parameters
eegs (EEGSeries) – [description]
batch_size (int, optional) – batch size, defaults to 32
window_size (float, optional) – eeg window in seconds, defaults to 1
infinity (bool, optional) – whether the loop should be infinity, defaults to False
labels (np.ndarray, optional) – Labels per subject, defaults to None
epochs (int, optional) – number of epochs, defaults to 1
shuffle (bool, optional) – whether to shuffle the data, defaults to False
return_subjects (bool, optional) – batch size correspond to number of windows per subject, defaults to False
stride (float, optional) – stride in seconds, defaults to None
- Yield
batch and labels if labels are provided
- Return type
tuple