# [Numpy-discussion] fft output and input storage

Warren Focke focke at slac.stanford.edu
Tue Jul 26 17:11:20 CDT 2005

```>>> print FFT.fft.__doc__
fft(a, n=None, axis=-1)

Will return the n point discrete Fourier transform of a. n defaults to the
length of a. If n is larger than a, then a will be zero-padded to make up
the difference. If n is smaller than a, the first n items in a will be
used.

The packing of the result is "standard": If A = fft(a, n), then A[0]
contains the zero-frequency term, A[1:n/2+1] contains the
positive-frequency terms, and A[n/2+1:] contains the negative-frequency
terms, in order of decreasingly negative frequency. So for an 8-point
transform, the frequencies of the result are [ 0, 1, 2, 3, 4, -3, -2, -1].

This is most efficient for n a power of two. This also stores a cache of
working memory for different sizes of fft's, so you could theoretically
run into memory problems if you call this too many times with too many
different n's.
>>>

Hmph.  The style guide says I should've put a blank line on the end of
that docstring.  But I don't think there was a style guide then.

w

On Tue, 26 Jul 2005, Daniel Sheltraw wrote:

> Hello all
>
> Would someone please tell me how negative and positive
> frequencies are
> stored in the output of the Numerical Python fft?
>
> Cheers,
> Daniel
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>

```

More information about the Numpy-discussion mailing list