bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / fft / _basic / ifft2
_Function
scipy.fft._basic:ifft2
source: build-install/usr/lib/python3.14/site-packages/scipy/fft/_basic.py:938
Signature
def ifft2(x, s = None, axes = (-2, -1), norm = None, overwrite_x = False, workers = None, *, plan = None)Summary
Compute the 2-D inverse discrete Fourier Transform.
Extended Summary
This function computes the inverse of the 2-D discrete Fourier Transform over any number of axes in an M-D array by means of the Fast Fourier Transform (FFT). In other words, ifft2(fft2(x)) == x to within numerical accuracy. By default, the inverse transform is computed over the last two axes of the input array.
The input, analogously to ifft, should be ordered in the same way as is returned by fft2, i.e., it should have the term for zero frequency in the low-order corner of the two axes, the positive frequency terms in the first half of these axes, the term for the Nyquist frequency in the middle of the axes and the negative frequency terms in the second half of both axes, in order of decreasingly negative frequency.
Parameters
x: array_likeInput array, can be complex.
s: sequence of ints, optionalShape (length of each axis) of the output (
s[0]refers to axis 0,s[1]to axis 1, etc.). This corresponds tonforifft(x, n). Along each axis, if the given shape is smaller than that of the input, the input is cropped. If it is larger, the input is padded with zeros. ifsis not given, the shape of the input along the axes specified byaxesis used. See notes for issue on ifft zero padding.axes: sequence of ints, optionalAxes over which to compute the FFT. If not given, the last two axes are used.
norm: {"backward", "ortho", "forward"}, optionalNormalization mode (see fft). Default is "backward".
overwrite_x: bool, optionalIf True, the contents of
xcan be destroyed; the default is False. See fft for more details.workers: int, optionalMaximum number of workers to use for parallel computation. If negative, the value wraps around from
os.cpu_count(). See fft for more details.plan: object, optionalThis argument is reserved for passing in a precomputed plan provided by downstream FFT vendors. It is currently not used in SciPy.
Returns
out: complex ndarrayThe truncated or zero-padded input, transformed along the axes indicated by
axes, or the last two axes ifaxesis not given.
Raises
: ValueErrorIf
sandaxeshave different length, oraxesnot given andlen(s) != 2.: IndexErrorIf an element of
axesis larger than the number of axes ofx.
Notes
ifft2 is just ifftn with a different default for axes.
See ifftn for details and a plotting example, and fft for definition and conventions used.
Zero-padding, analogously with ifft, is performed by appending zeros to the input along the specified dimension. Although this is the common approach, it might lead to surprising results. If another form of zero padding is desired, it must be performed before ifft2 is called.
Examples
import scipy.fft import numpy as np x = 4 * np.eye(4)✓
scipy.fft.ifft2(x)
✗array([[1.-0.j, 0.+0.j, 0.-0.j, 0.-0.j],
[0.+0.j, 0.+0.j, 0.+0.j, 1.-0.j],
[0.-0.j, 0.-0.j, 1.-0.j, 0.+0.j],
[0.-0.j, 1.+0.j, 0.-0.j, 0.-0.j]])
See also
Aliases
scipy.fft.ifft2