preprocessing

syncopy.preprocessing(data, filter_class='but', filter_type='lp', freq=None, order=None, direction=None, window='hamming', polyremoval=None, rectify=False, hilbert=False, parallel=None, select=None, **kwargs)[source]

Preprocessing of time continuous raw data with IIR and FIR filters

data~syncopy.AnalogData

A non-empty Syncopy AnalogData object

filter_class{‘but’, ‘firws’}

Butterworth (IIR) or windowed sinc (FIR)

filter_type{‘lp’, ‘hp’, ‘bp’, ‘bs’}, optional

Select type of filter, either low-pass ‘lp’, high-pass ‘hp’, band-pass ‘bp’ or band-stop (Notch) ‘bs’.

freqfloat or array_like

Cut-off frequency for low- and high-pass filters or sequence of two frequencies for band-stop and band-pass filter.

orderint, optional

Order of the filter, default is 6. Higher orders yield a sharper transition width or less ‘roll off’ of the filter, but are more computationally expensive.

direction{‘twopass’, ‘onepass’, ‘onepass-minphase’}

Filter direction: ‘twopass’ - zero-phase forward and reverse filter, IIR and FIR ‘onepass’ - forward filter, introduces group delays for IIR, zerophase for FIR `’onepass-minphase’ - forward causal/minimum phase filter, FIR only

window{“hamming”, “hann”, “blackman”}, optional

The type of window to use for the FIR filter

polyremovalint or None, optional

Order of polynomial used for de-trending data in the time domain prior to filtering. A value of 0 corresponds to subtracting the mean (“de-meaning”), polyremoval = 1 removes linear trends (subtracting the least squares fit of a linear polynomial).

rectifybool, optional

Set to True to rectify (after filtering)

hilbertNone or one of {‘abs’, ‘complex’, ‘real’, ‘imag’, ‘absreal’, ‘absimag’, ‘angle’}

Choose one of the supported output types to perform Hilbert transformation after filtering. Set to ‘angle’ to return the phase.

Returns

  • filtered (~syncopy.AnalogData) – The filtered dataset with the same shape and dimord as the input data

  • The parameters listed below can be provided as is or a via a cfg

  • configuration ‘structure’, see Notes for details.