from numpy import pi,cos,sin,log10 from scipy.signal import qmf,freqz,hann,hamming import matplotlib.pyplot as plt from scipy.fftpack import fft from scipy.signal import resample_poly from scipy.signal import firwin,lfilter fpa = 1000 fsa = 3000 fc = (fpa+fsa)/2 n=linspace(0,50) ts=cos(2*pi*400*n/5000) b=hamming(26) C=hamming(26) c=qmf(b) D=qmf(C) f1 = firwin(30,fc/(5000/2),window = 'hamming') op = lfilter(f1,1,ts) op1 = qmf(op) #QMF procedure q1=convolve(ts,op) q2=convolve(ts,op1) q11=resample_poly(ts,up=1,down=2) q22=resample_poly(ts,up=1,down=2) q111=resample_poly(q11,up=2,down=1) q222=resample_poly(q22,up=2,down=1)
def cpu_version(self, sig): return signal.qmf(sig)
""" To pass a signal through a 2 channel IIR Quadrature mirror Filter bank """ from numpy import flip, fliplr, linspace, abs, convolve from numpy import pi, cos, sin, log10 from scipy.signal import qmf, freqz, resample_poly import matplotlib.pyplot as plt from scipy.fftpack import fft n = linspace(0, 5) ts = cos(0.5 * pi * n) C = [.1, .2, .3, .1] b = [.1, .2, .3, .1] c = qmf(b) w0, H0 = freqz(b, 1, 256) w1, H1 = freqz(c, 1, 256) D = qmf(C) w2, H2 = freqz(C, 1, 256) w3, H3 = freqz(D, 1, 256) q1 = convolve(ts, b) q2 = convolve(ts, c) q11 = resample_poly(q1, up=1, down=2) q22 = resample_poly(q2, up=1, down=2) Q1 = convolve(q11, C) Q2 = convolve(q22, D)