[SciPy-user] FFTN usage
Stefan van der Walt
Fri Feb 8 19:45:25 CST 2008
On Fri, Feb 08, 2008 at 05:33:02PM -0800, Brad Malone wrote:
> So let's say I have a grid of values with [i,j,k] where i,j,k each go
> from 0 to 3. How do I compute the Fourier transform of this grid using
> fftn? Is the first argument a 1D array that goes through my 3D array
> along some standard path (last column goes fastest, or something like
> this?), or is the first argument actually a 3D array itself? I looked
> at the documentation but it wasn't clear to me.
I assume your values are packed into an array of shape (4,4,4).
`fftn` can be seen as the equivalent of running a one-dimensional FFT
along every axis of that array, i.e. along rows, columns and depth.
You can further adjust the working by specifying keywords:
np.fft.fftn(a, s=None, axes=None)
fftn(a, s=None, axes=None)
The n-dimensional fft of a. s is a sequence giving the shape of the input
an result along the transformed axes, as n for fft. Results are packed
analogously to fft: the term for zero frequency in all axes is in the
low-order corner, while the term for the Nyquist frequency in all axes is
in the middle.
If neither s nor axes is specified, the transform is taken along all
axes. If s is specified and axes is not, the last len(s) axes are used.
If axes are specified and s is not, the input shape along the specified
axes is used. If s and axes are both specified and are not the same
length, an exception is raised.
Btw, this docstring was obtained by typing
import numpy as np
More information about the SciPy-user