def __bandstop(self,ite_data,lowcut,highcut,fs,order,ftype,zerophase,**args):
fe = fs/2.0
low = lowcut/fe
high = highcut/fe
if low<0:
low=0
if high>1:
high=1
if ftype == "cheby1":
rp = args["rp"]
z,p,k = signal.iirfilter(order,[low,high],btype="bandstop",ftype=ftype,output="zpk",rp=rp)
elif ftype == "cheby2":
rs = args["rs"]
z,p,k = signal.iirfilter(order,[low,high],btype="bandstop",ftype=ftype,output="zpk",rs=rs)
elif ftype == "ellip":
rp = args["rp"]
rs = args["rs"]
z,p,k = signal.iirfilter(order,[low,high],btype="bandstop",ftype=ftype,output="zpk",rp=rp,rs=rs)
else:
z,p,k = signal.iirfilter(order,[low,high],btype="bandstop",ftype=ftype,output="zpk")
sos = signal.zpk2sos(z,p,k)
ite_data = signal.sosfilt(sos,ite_data)
if zerophase:
ite_data = signal.sosfilt(sos,ite_data[::-1])[::-1]
return ite_data
评论列表
文章目录