I am trying to run a series of data samples through a butterworth filter. The samples were taken at a sample rate of 200 samples/second. I want a band pass of between 20-40 hz. I use fs = 200 because of the sample rate but I get attenuation at all frequencies and see no evidence of the "passband" being a "0db" pass through - I get uniform attentuation of -20db at all frequencies
def butter_bandpass(lowcut, highcut, fs, order =4):
nyq = 0.5 * fs
low = lowcut/nyq
high = highcut/nyq
b, a = butter(order, [low, high], btype='band')
return b, a
def butter_bandpass_filter(data, lowcut, highcut, fs, order = 4):
b, a= butter_bandpass(lowcut, highcut, fs, order = order)
y = lfilter(b,a,data)
return y
fs = 200.00
lowcut = 20.0
highcut = 40.0
x = Signal_X_Col
y = butter_bandpass_filter(x, lowcut, highcut, fs, order = 4 )