Frequency spectrum with fft of a real valued array...?
Robert Kern
robert.kern at gmail.com
Thu Jan 11 19:08:00 CET 2007
Holger wrote:
> What does it mean to me? How do I get to the wanted frequenca spectrum???
It's packed in the conventional FFT format. Here is a function in numpy (the
successor to Numeric, which I assume that you are using) that generates the
corresponding frequencies in the same packed format:
In [324]: import numpy
In [325]: numpy.fft.fftfreq?
Type: function
Base Class: <type 'function'>
Namespace: Interactive
File:
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy-1.0.2.dev3507-py2.5-macosx-10.4-i386.egg/numpy/fft/helper.py
Definition: numpy.fft.fftfreq(n, d=1.0)
Docstring:
fftfreq(n, d=1.0) -> f
DFT sample frequencies
The returned float array contains the frequency bins in
cycles/unit (with zero at the start) given a window length n and a
sample spacing d:
f = [0,1,...,n/2-1,-n/2,...,-1]/(d*n) if n is even
f = [0,1,...,(n-1)/2,-(n-1)/2,...,-1]/(d*n) if n is odd
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list
mailing list