I'm using Python to filter a signal using a Butterworth filter (scipy.signal.butter) and subsequently passing this through a forward-backward filter with cascaded second order sections (scipy.signal.sosfiltfilt). Obviously, this introduces a group delay which I don't like.
I was told to use just the scipy.signal.filtfilt as it has a zero phase shift, though it is less numerically stable than the sosfiltfilt method.
I understand there are ways to calculate the group delay, for example scipy.signal.group_delay. This gives me an array of the phase shift for each frequency in my sample domain.
So this brings me to my general question - how is knowing the group delay useful? How can I practically use the group delay at each frequency to correct for the phase shift in the filtered signal? Is there a method for this, or is it as tedious as delaying each frequency component separately and then summing them up to get a zero phase shifted signal?
Cheers
sosfiltfilt
andfiltfilt
do the same thing, just with different implementations. They're both zero phase and don't introduce any delay. $\endgroup$ – endolith Oct 24 '20 at 1:16