xrscipy.fftpack.irfft

xrscipy.fftpack.irfft(x, coord, n=None)

Return inverse discrete Fourier transform of real sequence x.

The contents of x are interpreted as the output of the rfft function.

Parameters:
  • obj (xarray object) – Transformed data to invert.

  • coord (string) – Coordinate along which the ifft’s are computed. The coordinate must be evenly spaced.

  • n (int, 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].

Returns:

irfft – The inverse discrete Fourier transform.

Return type:

ndarray of floats

See also

rfft, ifft, scipy.fft.irfft

numpy.fftpack.irfft

scipy.fft.irfft : Original scipy implementation

Notes

The returned real array contains:

[y(0),y(1),...,y(n-1)]

where for n is even:

y(j) = 1/n (sum[k=1..n/2-1] (x[2*k-1]+sqrt(-1)*x[2*k])
                             * exp(sqrt(-1)*j*k* 2*pi/n)
            + c.c. + x[0] + (-1)**(j) x[n-1])

and for n is odd:

y(j) = 1/n (sum[k=1..(n-1)/2] (x[2*k-1]+sqrt(-1)*x[2*k])
                             * exp(sqrt(-1)*j*k* 2*pi/n)
            + c.c. + x[0])

c.c. denotes complex conjugate of preceding expression.

For details on input parameters, see rfft.

To process (conjugate-symmetric) frequency-domain data with a complex datatype, consider using the newer function scipy.fft.irfft.

Examples

>>> from scipy.fftpack import rfft, irfft
>>> a = [1.0, 2.0, 3.0, 4.0, 5.0]
>>> irfft(a)
array([ 2.6       , -3.16405192,  1.24398433, -1.14955713,  1.46962473])

Examples

>>> irfft(rfft(a))
array([1., 2., 3., 4., 5.])