I've been playing around with filters using scipy, trying to filter a signal. After reading the documentation and going through a few examples, I thought I got it, but it seems like I'm doing something wrong and can't get it to work.
Using a bandstop filter below, I'd expect the variable fy to be pretty much constant, but I see can see no difference between the data and filtered sine wave.
import pylab as plt
import numpy as np
import scipy
numsamples=1000
f0=1/10
x=np.linspace(0,100,numsamples)
y=np.sin(2*np.pi*f0*x)
fs=numsamples/(max(x)-min(x))
nyquist=0.5*fs
fstart=(3/4)*f0/nyquist
fstop=(4/3)*f0/nyquist
a,b = scipy.signal.butter(2,[fstart,fstop],'bandstop', analog=True)
fy = scipy.signal.lfilter(a,b,y, axis=-1, zi=None)
plt.plot(y)
plt.plot(fy)
plt.show()
Thanks for your help,
Mike