Does the following code properly implement a phase-neutral band-pass filter using SciPy?
freq_fraction = FREQ / (SAMPLE_RATE/2) sharpness = 0.1 filter_length=128 fir = sig.firwin(filter_length, [freq_fraction*(1-sharpness),freq_fraction*(1+sharpness)], pass_zero=False ) filtered = sig.lfilter( fir, 1, data_to_filter ) filtered = sig.lfilter( fir, 1,filtered[::-1] )[::-1]
The code is based on the answer to:
which doesn't give a final code listing for how to maintain phase neutrality. I'm assuming it's just a matter of running the filter forward and backwards but want to double-check.
Also, if there are better/different ways of doing this (other than the remez and firwin2 methods listed in the other question) I'd love to know.