scipy.fft.irfftn¶

scipy.fft.
irfftn
(x, s=None, axes=None, norm=None, overwrite_x=False, workers=None)[source]¶ Compute the inverse of the ND FFT of real input.
This function computes the inverse of the ND discrete Fourier Transform for real input over any number of axes in an MD array by means of the Fast Fourier Transform (FFT). In other words,
irfftn(rfftn(x), x.shape) == x
to within numerical accuracy. (Thea.shape
is necessary likelen(a)
is forirfft
, and for the same reason.)The input should be ordered in the same way as is returned by
rfftn
, i.e., as forirfft
for the final transformation axis, and as forifftn
along all the other axes. Parameters
 xarray_like
Input array.
 ssequence of ints, optional
Shape (length of each transformed axis) of the output (
s[0]
refers to axis 0,s[1]
to axis 1, etc.). s is also the number of input points used along this axis, except for the last axis, wheres[1]//2+1
points of the input are used. Along any axis, if the shape indicated by s is smaller than that of the input, the input is cropped. If it is larger, the input is padded with zeros. If s is not given, the shape of the input along the axes specified by axes is used. Except for the last axis which is taken to be2*(m1)
, wherem
is the length of the input along that axis. axessequence of ints, optional
Axes over which to compute the inverse FFT. If not given, the last len(s) axes are used, or all axes if s is also not specified.
 norm{None, “ortho”}, optional
Normalization mode (see
fft
). Default is None. overwrite_xbool, optional
If True, the contents of x can be destroyed; the default is False. See
fft
for more details. workersint, optional
Maximum number of workers to use for parallel computation. If negative, the value wraps around from
os.cpu_count()
. Seefft
for more details.
 Returns
 outndarray
The truncated or zeropadded input, transformed along the axes indicated by axes, or by a combination of s or x, as explained in the parameters section above. The length of each transformed axis is as given by the corresponding element of s, or the length of the input in every axis except for the last one if s is not given. In the final transformed axis the length of the output when s is not given is
2*(m1)
, wherem
is the length of the final transformed axis of the input. To get an odd number of output points in the final axis, s must be specified.
 Raises
 ValueError
If s and axes have different length.
 IndexError
If an element of axes is larger than than the number of axes of x.
See also
Notes
See
fft
for definitions and conventions used.See
rfft
for definitions and conventions used for real input.The default value of s assumes an even output length in the final transformation axis. When performing the final complex to real transformation, the Hermitian symmetry requires that the last imaginary component along that axis must be 0 and so it is ignored. To avoid losing information, the correct length of the real input must be given.
Examples
>>> import scipy.fft >>> x = np.zeros((3, 2, 2)) >>> x[0, 0, 0] = 3 * 2 * 2 >>> scipy.fft.irfftn(x) array([[[1., 1.], [1., 1.]], [[1., 1.], [1., 1.]], [[1., 1.], [1., 1.]]])