ifft — SciPy v1.15.3 Manual (original) (raw)

scipy.fftpack.

scipy.fftpack.ifft(x, n=None, axis=-1, overwrite_x=False)[source]#

Return discrete inverse Fourier transform of real or complex sequence.

The returned complex array contains y(0), y(1),..., y(n-1), where

y(j) = (x * exp(2*pi*sqrt(-1)*j*np.arange(n)/n)).mean().

Parameters:

xarray_like

Transformed data to invert.

nint, optional

Length of the inverse Fourier transform. If n < x.shape[axis],x is truncated. If n > x.shape[axis], x is zero-padded. The default results in n = x.shape[axis].

axisint, optional

Axis along which the ifft’s are computed; the default is over the last axis (i.e., axis=-1).

overwrite_xbool, optional

If True, the contents of x can be destroyed; the default is False.

Returns:

ifftndarray of floats

The inverse discrete Fourier transform.

Notes

Both single and double precision routines are implemented. Half precision inputs will be converted to single precision. Non-floating-point inputs will be converted to double precision. Long-double precision inputs are not supported.

This function is most efficient when n is a power of two, and least efficient when n is prime.

If the data type of x is real, a “real IFFT” algorithm is automatically used, which roughly halves the computation time.

Examples

from scipy.fftpack import fft, ifft import numpy as np x = np.arange(5) np.allclose(ifft(fft(x)), x, atol=1e-15) # within numerical accuracy. True