I understand that with a standard filter, higher order will yield sharper frequency selection at the cost of increased phase delay. However, with so-called zero-phase-distortion filters like that provided by scipy.signal.filtfilt
, will a higher order get you sharper frequency selection "for free"? (I know higher order filters take more computation time, but let's ignore that)
The sharper the filter is in the frequency domain, the longer the impulse response will be. This typically leads to "time blur" or "ringing" in the time domain. In addition, a zero phase filter is non-causal, so you get "pre-ringing" and any sharp onsets or transients in the time domain get degraded.
The long impulse response also leads to a long "transition" region at the beginning and the end of the signal. As a very rough rule: if you have a filter that does something drastic over 1Hz of bandwidth, it will need about 1 second of time domain signal until the effect of the filter is fully established.
The optimal choice is very dependent on the specific requirements of your application.
The Python function scipy.signal.filtfilt
increases the order of the filter by a factor of 2 because you are doing forward-backward filtering. Traditional filtering techniques employ forward filtering, which generates a phase. To negate the phase, backward filtering is applied to the output of the forward filter.
For example, if your original filter (forward filter) has $M$ zeros at $z = -1$, then the filter response obtained using scipy.signal.filtfilt
will have $2M$ zeros at $z = -1$. As the number of filter coefficients has doubled, you observe a sharper filter response. In addition, the $3 \rm{dB}$ cutoff frequency also changes for a zero-phase filter.