ifft

powerbox.dft.ifft(X, Lk=None, L=None, a=0, b=6.283185307179586, axes=None, ret_cubegrid=False)[source]

Arbitrary-dimension nice inverse Fourier Transform.

This function wraps numpy’s ifftn and applies some nice properties. Notably, the returned fourier transform is equivalent to what would be expected from a continuous inverse Fourier Transform (including normalisations etc.). In addition, arbitrary conventions are supported (see powerbox.dft for details).

Default parameters have the same normalising conventions as numpy.fft.ifftn.

Parameters:
X : array

An array with arbitrary dimensions defining the field to be transformed. Should correspond exactly to the continuous function for which it is an analogue. A lower-dimensional transform can be specified by using the axes argument. Note that this should have its zero in the center.

Lk : float or array-like, optional

The length of the box which defines X. If a scalar, each transformed dimension in X is assumed to have the same length. If array-like, must be of the same length as the number of transformed dimensions. The default returns the un-normalised DFT (the same as numpy).

L : float or array-like, optional

The length of the real-space box, defining the dual of X. Only one of Lk/L needs to be passed. If L is passed, it is used. If a scalar, each transformed dimension in X is assumed to have the same length. If array-like, must be of the same length as the number of transformed dimensions. The default of Lk=1 returns the un-normalised DFT.

a,b : float, optional

These define the Fourier convention used. See powerbox.dft for details. The defaults return the standard DFT as defined in numpy.fft.

axes : sequence of ints, optional

The axes to take the transform over. The default is to use all axes for the transform.

ret_cubegrid : bool, optional

Whether to return the entire grid of real-space co-ordinate magnitudes.

Returns:
ft : array

The IDFT of X, normalised to be consistent with the continuous transform.

freq : list of arrays

The real-space co-ordinate grid in each dimension, consistent with the Fourier conventions specified.

grid : array

Only returned if ret_cubegrid is True. An array with shape given by axes specifying the magnitude of the real-space co-ordinates at each point of the inverse fourier transform.