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