numpy.fft.fft

numpy.fft.fft(a, n=None, axis=-1)

Compute the one dimensional fft on a given axis.

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

Parameters:

a : array

input array

n : int

length of the fft

axis : int

axis over which to compute the fft

Notes

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.

Previous topic

Fourier transforms (numpy.fft)

Next topic

numpy.fft.ifft

This Page

Quick search