filtering#
- spidet.preprocess.filtering.filter_signal(sfreq: int, cutoff_freq_low: int, cutoff_freq_high: int, data: array, zero_center: bool = True) array[source]#
Filter the provided signal with a bandpass butterworth forward-backward filter at specified cut-off frequencies. The order of the butterworth filter is predefined to be 2, which effectively results in an order of 4 as the data is forward-backward filtered. Additionally, the possibility to zero-center the data is provided.
- Parameters:
- sfreqint
Sampling frequency of the input signal/-s.
- cutoff_freq_lowint
Lower end of the frequency passband.
- cutoff_freq_highint
Upper end of the frequency passband.
- dataarray-like
Signal/-s to be filtered.
- zero_centerbool, optional
If True, re-centers the signal/-s, defaults to True.
- Returns:
- array-like
Bandpass filtered zero-centered signal/-s at cut-off frequency 200 Hz.
- spidet.preprocess.filtering.notch_filter_signal(eeg_data: array, notch_frequency: int, low_pass_freq: int, sfreq: int)[source]#
Creates a notch-filter and runs it over the provided data.
- Parameters:
- eeg_dataarray-like
Data to be filtered.
- notch_frequencyint
The frequency of the notch filter; data will be notch-filtered at this frequency and at the corresponding harmonics, e.g. notch_freq = 50 Hz -> harmonics = [50, 100, 150, etc.]
- low_pass_freqint
Frequency above which the signal is ignored.
- sfreqint
Baseline frequency of the signal.
- Returns:
- array-like
Filtered signal.