It's not really a programming question, and is not specific to numpy
. Briefly, the absolute value of the complex number (sqrt(x.real**2 + x.imag**2)
, or numpy.abs()
) is the amplitude.
More detailed, when you apply FFT to an array X
(which, say, contains a number of samples of a function X(t)
at different values of t
), you try to represent it as a sum of "plane waves" exp(i w t)
(where i
is an imaginary unit, and w
is a real-valued frequency) with different values of w
. That is, you want something like
X = A exp(i w1 t) + B exp(i w2 t) + ...
An FFT returns you these coefficients A
, B
etc corresponding to some fixed frequencies w1
, w2
etc (in numpy
, you can get their values from fftfreq()).
Now, these coefficients are, in general, complex. A complex number A
can be represented as a combination of "amplitude" and "phase" as:
A = r exp(i p)
where r
(== numpy.abs(A)
) is the amplitude, and p
(== numpy.angle(A)
) is the phase, both real values. If you substitute it into the term in the FFT expansion, you get
r exp(i p) exp(i w t) == r exp(i (w t + p))
So, the amplitude r
changes the absolute value of the term, and the phase p
, well, shifts the phase. Therefore, in order to get the array of amplitudes from the result of an FFT, you need to apply numpy.abs
to it.
But I would really suggest you to read something on FFT theory, there's plenty of information around, for instance wiki.