python - Bandpass filter not respecting cutoff -
i'm using filter in python:
def bandpass_firwin(ntaps, lowcut, highcut, fs, window='hamming'): nyq = 0.5 * fs taps = firwin(ntaps, [lowcut, highcut], nyq=nyq, pass_zero=false, window=window, scale=false) where ntaps=128; lowcut = 0.7 ; highcut = 4 ; fs = 61
i filter signal has 610 samples sampled @ 61 hz (so 10 sec long).
when @ spectrum of signal has been filtered bandpass filter, see this:

the peek in spectrum @ 0.61 hz. not in range of 0.7 4 hz.
how possible ? & how can prevent ?
your filter isn't magic - there intrinsic limitations on bandwidth. try using more taps if need tight cutoff.
the more taps use though, more need think edge effects , how handle them (as edge assumptions encroach further , further data block). perhaps want smooth roll off @ edge? or mirror , repeat of data? perhaps can ignore entirely...
another technique convolution filter directly in frequency domain multiplying desired spectrum. imposes edge assumption signal repeated, though can change extending signal see fit. if want know support of equivalent fir filter, take ifft of window , can see how beginning of time block smear beginning.
Comments
Post a Comment