[SciPy-dev] FFT docstrings (was: Scipy Tutorial (and updating it))

Tom Grydeland tom.grydeland@gmail....
Wed Dec 17 01:48:03 CST 2008

On Tue, Dec 16, 2008 at 6:05 PM,  <jh@physics.ucf.edu> wrote:

> I like it!  A lot!

Excellent!  Thanks.

> I added the helper routines and defined the time and frequency domains
> near the top (and took out similar text near the bottom), fixed some
> commas, etc.

Looks good.  I didn't like the parentheses "(each gets exactly half
the spectrum) in the discussion on real transforms", I think it is too
easy to misunderstand (as I did on first reading).

> I think all it needs now is examples.

Indeed.  I'll see what I can do about that.

> One point: (I'm not sure it's worth putting these distinctions on the
> page, I'm just justifying a change I made.)  Power is energy per unit
> time; the energy spectrum and power spectrum are colloquially the
> same.

I was fairly sure what I wrote was not correct, but that it could be
fixed.  I hope what ends up in the docstring is correct, not just

>  Both are proportional to the square of the amplitude spectrum.
> In areas where it matters, np.abs(A)**2 is the energy spectrum and
> varies with the signal length (longer signals have more energy).  The
> power spectrum is the energy spectrum divided by the time span (in
> physical units) of the dataset, and is independent of the signal
> length.  Both these must be adjusted by a constant to make the
> sampling rate not affect the output.

I think perhaps this should be included, it is clarifying.

> The zero channel of np.fft(a) is
> the mean, not the energy.

Well -- A[0], according to the definition in the first equation, is
simply the sum of all the values in the input vector (since k == 0,
all the exponentials are == 1).  I would not call that the mean.

>  The zero channel of np.abs(A)**2 is the
> total energy or power, each to within different constants.


> --jh--

Tom Grydeland

More information about the Scipy-dev mailing list