Hello, so I am using the MNE as a tool to analyze my data and I was looking at the structure of the filter function in github and saw that the â€śmethodâ€ť parameter has the option to do a FFT, but from what I understood it does a FIR filter. Could you explain to me why it works that way please? If you guys used FFT as a way to make the filter faster or something else, because I wanted to do a FFT in my data using MNE but Iâ€™m a little confused how I could do that. @larsoner
Yes the method='fft'
is just a backward compatible shortcut for method='fir'
(they should share the same code path and do the same thing).
Whenever a FIR filter is used, all we are doing is something mathematically equivalently (under the hood) to a timedomain convolution of the FIR filter kernel and the signal. There are lots of ways to do this quickly, such as direct convolution, fftbased convolution in the frequency domain, or overlapadd convolution, which correspond to the following SciPy functions:

numpy.convolve â€” NumPy v1.21 Manual / scipy.ndimage.convolve â€” SciPy v1.7.1 Manual (the
scipy.signal.convolve
sometimes does timedomain and other times callsfftconvolve
depending on sizes and efficiency)  scipy.signal.fftconvolve â€” SciPy v1.7.1 Manual
 scipy.signal.oaconvolve â€” SciPy v1.7.1 Manual
In MNE what we do is the overlapadd approach, just using our own code rather than SciPyâ€™s. Iâ€™m not sure of a good resource to understand all of these options other than a textbook like Oppenheim and Shaferâ€™s Discretetime Signal Processing.
For what itâ€™s worth, none of these (equivalent) approaches implements a frequencydomain brickwall filter (i.e., take the FFT of the entire signal, zero out components, and inverse transform) if thatâ€™s what you were thinking of, because this has some undesirable properties (e.g., bad ringing, assumes signal periodicity) that are better to avoid if possible.