Signal reconstruction
Recovering time- or sample-domain data from Fourier coefficients.
SciPy · Function
Computes the one-dimensional inverse discrete Fourier transform. It can select the transform axis, adjust its length by cropping or zero-padding, and choose a normalization convention.
Pass a one-dimensional array or array-like object to transform it back from frequency space. The selected axis is cropped or zero-padded to n when requested, and norm controls scaling; the result is a complex ndarray.
scipy.fft.ifft(x, n=None, axis=-1, norm=None, overwrite_x=False, workers=None, *, plan=None)| Name | Type | Description |
|---|---|---|
x | array_like | Input array; it can be complex. |
n | int, optional | Length of the transformed output axis. A smaller value crops the input; a larger value pads it with zeros. If omitted, the input length along axis is used. |
axis | int, optional | Axis over which to compute the inverse DFT. Defaults to the last axis. |
norm | {"backward", "ortho", "forward"}, optional | Normalization mode: "backward", "ortho", or "forward". Defaults to "backward". |
overwrite_x | bool, optional | If True, the contents of x may be destroyed; defaults to False. |
workers | int, optional | Number of workers to use for parallel computation. |
plan | object, optional | Reserved for a future planning interface; currently not used. |
complex ndarray: the truncated or zero-padded input transformed along the selected axis.
import numpy as np
from scipy.fft import fft, ifft
signal = np.array([1.0, 2.0, 1.0, 0.0])
spectrum = fft(signal)
recovered = ifft(spectrum)
print(np.real_if_close(recovered))Transforms a real signal to the frequency domain and reconstructs it with the inverse transform.
Recovering time- or sample-domain data from Fourier coefficients.
Applying frequency-domain processing before converting results back to samples.
Processing rows, columns, or another dimension in multidimensional arrays.
It computes the one-dimensional inverse discrete Fourier transform of x. By default, it uses the last axis and the backward normalization convention.
Follow-up: How does n affect the operation? It sets the output transform length: shorter inputs are cropped, while longer lengths are zero-padded.
The axis argument selects the dimension along which the inverse DFT is performed, defaulting to -1. The returned array is transformed along that dimension.
Follow-up: What happens if axis is invalid? NumPy-style axis validation raises an error rather than silently selecting another dimension.
norm selects among backward, ortho, and forward normalization modes, with backward as the default. The returned value is a complex ndarray containing the transformed, possibly cropped or zero-padded input.
Follow-up: When is overwrite_x appropriate? Only when modifying the input is acceptable, because True permits its contents to be destroyed.
scipy.fft.fftscipy.fft.ifftnscipy.fft.ifft2