NumPy and FFT
Michael A. Miller
mmiller3 at iupui.edu
Mon May 22 21:42:12 EDT 2000
If your data is in an array y, a FFT can be calculated like this:
import FFT
fft = FFT.fft(y)
A fast FT doesn't care at all what the sampling rate is, so
you'll have to calculate your own frequencies. If your sample
rate is f_sample, you could do something like this:
import Numeric
delta = 1 / f_sample
f = Numeric.array(range(len(fft))) / delta / len(fft)
N = len(f)
for i in range(N/2):
f[N/2+i] = - result[N/2-i]
Mike
P.S. More NumPy savvy folks can probably point out a much more
efficient way of calculating the negative frequencies...
More information about the Python-list
mailing list