0001 function pfb_fir(x):
0002 N = len(x) # x is the incoming data time stream.
0003 taps = 4
0004 L = 512 # Points in subsequent FFT.
0005 bin_width_scale = 1.0
0006 dx = 3.1457/L
0007 X = numpy.array([n*dx-taps*math.pi/2 for n in range(taps*L)])
0008 coeff = numpy.sinc(bin_width_scale*X/math.pi)*numpy.hanning(taps*L)
0009
0010 y = np.array([0+0j]*(N-taps*L))
0011 for n in range((taps-1)*L, N):
0012 m = n
0013 coeff_sub = coeff[L*taps-m::-L]
0014 y[n-taps*L] = (x[n-(taps-1)*L:n+L:L]*coeff_sub).sum()
0015
0016 return y