NumPy and FFT
Travis Oliphant
olipt at mayo.edu
Mon May 22 23:08:04 EDT 2000
>
> P.S. More NumPy savvy folks can probably point out a much more
> efficient way of calculating the negative frequencies...
>
I use this function all the time. It gives me the frequencies of the
output of the FFT call: I call it freqs (somebody please give me a better
name for it :-) )
def freqs(N,sample=1.0):
"""freq = freqs(N,sample=1.0)
return the frequency bins in cycles/unit (with zero at the start) given a
window length N and a sample spacing.
"""
sample = float(sample)
return concatenate((arange(0,(N+1)/2,1,'d'),arange(-(N-1)/2,0,1,'d')))/N/sample
Best,
Travis
More information about the Python-list
mailing list