preprocessing#

spidet.preprocess.preprocessing.apply_preprocessing_steps(traces: List[Trace], notch_freq: int, resampling_freq: int, bandpass_cutoff_low: int, bandpass_cutoff_high: int) ndarray[dtype[float]][source]#

Applies the necessary preprocessing steps to the original iEEG data. This involves:

  1. Bandpass-filtering with a butterworth forward-backward filter of order 2

  2. Notch-filtering

  3. Rescaling

  4. Resampling

Parameters:
tracesList[Trace]

The original iEEG data as a list of Traces objects. Each trace corresponds to the recording of single channel.

notch_freqint

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.]

resampling_freq: int

The frequency to resample the data after filtering and rescaling

bandpass_cutoff_lowint

Cut-off frequency at the lower end of the passband of the bandpass filter.

bandpass_cutoff_highint

Cut-off frequency at the higher end of the passband of the bandpass filter.

Returns:
numpy.ndarray[np.dtype[float]]

2-dimensional numpy array containing the preprocessed data where the rows correspond to the input traces.