Skip to content

Filtering

It is typically better to set your filtering properties on the raw data so as to avoid what we call border (or edge) effects.

If you use this pipeline for evoked responses, you could consider a low-pass filter cut-off of h_freq = 40 Hz and possibly a high-pass filter cut-off of l_freq = 1 Hz so you would preserve only the power in the 1Hz to 40 Hz band. Note that highpass filtering is not necessarily recommended as it can distort waveforms of evoked components, or simply wash out any low frequency that can may contain brain signal. It can also act as a replacement for baseline correction in Epochs. See below.

If you use this pipeline for time-frequency analysis, a default filtering could be a high-pass filter cut-off of l_freq = 1 Hz a low-pass filter cut-off of h_freq = 120 Hz so you would preserve only the power in the 1Hz to 120 Hz band.

If you need more fancy analysis, you are already likely past this kind of tips! 😇

l_freq module-attribute

Python
l_freq: float | None = None

The low-frequency cut-off in the highpass filtering step. Keep it None if no highpass filtering should be applied.

Pipeline steps using this setting

The following steps are directly affected by changes to l_freq:

  • preprocessing/_04_frequency_filter
  • preprocessing/_06a1_fit_ica
  • preprocessing/_06a2_find_ica_artifacts

h_freq module-attribute

Python
h_freq: float | None = 40.0

The high-frequency cut-off in the lowpass filtering step. Keep it None if no lowpass filtering should be applied.

Pipeline steps using this setting

The following steps are directly affected by changes to h_freq:

  • preprocessing/_04_frequency_filter

l_trans_bandwidth module-attribute

Python
l_trans_bandwidth: float | Literal['auto'] = 'auto'

Specifies the transition bandwidth of the highpass filter. By default it's 'auto' and uses default MNE parameters.

Pipeline steps using this setting

The following steps are directly affected by changes to l_trans_bandwidth:

  • preprocessing/_04_frequency_filter

h_trans_bandwidth module-attribute

Python
h_trans_bandwidth: float | Literal['auto'] = 'auto'

Specifies the transition bandwidth of the lowpass filter. By default it's 'auto' and uses default MNE parameters.

Pipeline steps using this setting

The following steps are directly affected by changes to h_trans_bandwidth:

  • preprocessing/_04_frequency_filter

notch_freq module-attribute

Python
notch_freq: float | Sequence[float] | None = None

Notch filter frequency. More than one frequency can be supplied, e.g. to remove harmonics. Keep it None if no notch filter should be applied.

Info

The notch filter will be applied before high- and lowpass filtering.

Example

Remove line noise at 50 Hz:

Python
notch_freq = 50
Remove line noise at 50 Hz and its (sub-)harmonics
Python
notch_freq = [25, 50, 100, 150]

Pipeline steps using this setting

The following steps are directly affected by changes to notch_freq:

  • preprocessing/_04_frequency_filter

notch_trans_bandwidth module-attribute

Python
notch_trans_bandwidth: float = 1.0

Specifies the transition bandwidth of the notch filter. The default is 1..

Pipeline steps using this setting

The following steps are directly affected by changes to notch_trans_bandwidth:

  • preprocessing/_04_frequency_filter

notch_widths module-attribute

Python
notch_widths: float | Sequence[float] | None = None

Specifies the width of each stop band. None uses the MNE default.

Pipeline steps using this setting

The following steps are directly affected by changes to notch_widths:

  • preprocessing/_04_frequency_filter

zapline_fline module-attribute

Python
zapline_fline: float | None = None

Specifies frequency to remove using Zapline filtering. If None, zapline will not be used.

Pipeline steps using this setting

The following steps are directly affected by changes to zapline_fline:

  • preprocessing/_04_frequency_filter

zapline_iter module-attribute

Python
zapline_iter: bool = False

Specifies if the iterative version of the Zapline algorithm should be run.

Pipeline steps using this setting

The following steps are directly affected by changes to zapline_iter:

  • preprocessing/_04_frequency_filter

notch_extra_kws module-attribute

Python
notch_extra_kws: dict[str, Any] = {}

A dictionary of extra kwargs to pass to mne.filter.notch_filter. If kwargs are passed here that have dedicated config settings already, an error will be raised. For full documentation of the notch filter: https://mne.tools/stable/generated/mne.filter.notch_filter.

Pipeline steps using this setting

The following steps are directly affected by changes to notch_extra_kws:

  • preprocessing/_04_frequency_filter

bandpass_extra_kws module-attribute

Python
bandpass_extra_kws: dict[str, Any] = {}

A dictionary of extra kwargs to pass to mne.filter.filter_data. If kwargs are passed here that have dedicated config settings already, an error will be raised. For full documatation of the bandpass filter: https://mne.tools/stable/generated/mne.filter.filter_data

Pipeline steps using this setting

The following steps are directly affected by changes to bandpass_extra_kws:

  • preprocessing/_04_frequency_filter