[SciPy-User] FFT Filter

Anders Harrysson anders.harrysson@fem4fun....
Sat Sep 24 02:33:53 CDT 2011


Dear all,

I am kind of new to scipy and also new to the signal processing field 
that this question relates to.
I am trying to do a bandpass FFT filter using python. The filter shape 
is symmetric around 11 Hz and is defined by the parameters ff and Hz below.

x=loadtxt('file')

sr = 250                    # [samples/s]
nf = sr/2.0                # Nyquist frequence
Ns = len(tr[:,0])       # Total number of samples
N=float(8192)          # Fourier settings

# Fourier transform
X1 = fft(x,n=int(N))
X1 = fftshift(X1)
F1 = arange(-N/2.0,N/2.0)/N*sr

# Filter
ff=[0,1,1,0]
Hz = [9.5, 10, 12, 12.5]
k1=interp(-F1,Hz,ff)+interp(F1,Hz,ff)
X1_f=X1*k1
X1_f=ifftshift(X1_f)
x1_f=ifft(X1_f,n=int(N))

My question is now:
Are ther built in functionallity for filtering in scioy and, if so, how 
would a similar filter looks like.

Regards,
Anders Harrysson


More information about the SciPy-User mailing list