[SciPy-dev] problem with signal.butter
John Hunter
jdhunter at ace.bsd.uchicago.edu
Wed Aug 3 14:47:34 EDT 2005
I am trying to design a bandpass butterworth filter and am getting an
error
import scipy.signal as sig
Fs = 400.
Nyq = Fs/2.
# low pass stop freq, high pass corner freq, etc...
lpsf = 5.
lpcf = 7.
hpcf = 12.
hpsf = 18.
Nyq = Fs/2.
wp = [lpcf/Nyq, hpcf/Nyq]
ws = [lpsf/Nyq, hpsf/Nyq]
gpass = 3.
gstop = 15.
ord, Wn = sig.buttord(wp, ws, gpass, gstop)
mybutt = sig.butter(ord, Wn, btype='bandpass') # pun intended
With scipy version 0.3.2 I get the following the traceback
Traceback (most recent call last):
File "<console>", line 1, in ?
File "/usr/lib/python2.4/site-packages/scipy/signal/filter_design.py", line 482, in butter
return iirfilter(N, Wn, btype=btype, analog=analog, output=output, ftype='butter')
File "/usr/lib/python2.4/site-packages/scipy/signal/filter_design.py", line 456, in iirfilter
b, a = lp2bp(b,a,wo=wo,bw=bw)
File "/usr/lib/python2.4/site-packages/scipy/signal/filter_design.py", line 253, in lp2bp
aprime[Dp-j] = val
TypeError: can't convert complex to float; use abs(z)
Any ideas?
Thanks,
JDH
More information about the SciPy-Dev
mailing list