filter_length distortion warning

MNE version: 1.0.2
MNE-bids version: 0.10
operating system: Ubuntu 20.04

Hello,

when preprocessing my fNIRS data, I’m applying a bandpass filter and get a warning like the following:

FIR filter parameters

Designing a one-pass, zero-phase, non-causal bandpass filter:

  • Windowed time-domain design (firwin) method
  • Hamming window with 0.0194 passband ripple and 53 dB stopband attenuation
  • Lower passband edge: 0.01
  • Lower transition bandwidth: 0.01 Hz (-6 dB cutoff frequency: 0.01 Hz)
  • Upper passband edge: 0.50 Hz
  • Upper transition bandwidth: 0.20 Hz (-6 dB cutoff frequency: 0.60 Hz)
  • Filter length: 5371 samples (660.096 sec)

/tmp/ipykernel_226266/3535447880.py:112: RuntimeWarning: filter_length (5371) is longer than the signal (4248), distortion is likely. Reduce filter length or filter a longer signal.
raw_haemo_filt = raw_haemo.filter(0.01, 0.5, h_trans_bandwidth=0.2, l_trans_bandwidth=0.005)

While I’ve searched through the forum, my problem is neither that any epoch is too short oder that I have to transpose anything. So I’m a bit stuck on how this problem arises and how I can influence the filter length. Surprisingly, I have a second data set with a different task for which there are no warnings put out, but the prepro code is the same (bad and short channel exclusion, motion correction, OD2haemo, bandpass filter).

I hope you can help me on this. What more info do you need?

Thanks in advance,
Dani

Can you show the command that you use to create that filter?

It looks like you require a very steep filter, so its length is very long. Also, since you are designing a bandpass filter it might be worth trying two separate filters (i.e. separate lowpass and highpass filters).

2 Likes

I posted the command already, it’s

raw_haemo_filt = raw_haemo.filter(0.01, 0.5, h_trans_bandwidth=0.2, l_trans_bandwidth=0.005)

But I see, now that you mentioned a “steep” filter, I tried adjusting the lower transition bandwidth from 0.005 to 0.0075 and ta da, the filter length got shorter which means it’s working now. Thanks for the hint!

On another note: I also applied two separate filters, but that didn’t change a thing.

I guess my homework will be some signal processing theory, cause I still don’t have a clue how a filter length is determined. But thanks again!

1 Like