xdas.fft.ifft#

xdas.fft.ifft(da, n=None, dim={'last': 'signal'}, norm=None, parallel=None)[source]#

Compute the inverse of fft.

Parameters:
  • da (DataArray) – The data array to process, should be complex.

  • n (int, optional) – Length of transformed dimension of the output. If n is smaller than the length of the input, the input is cropped. If it is larger, the input is padded with zeros. If n is not given, the length of the input along the dimension specified by dim is used.

  • dim ({str: str}, optional) – A mapping indicating as a key the dimension along which to compute the IFFT, and as value the new name of the dimension. Default to {“last”: “signal”}.

  • norm ({“backward”, “ortho”, “forward”}, optional) – Normalization mode (see numpy.fft). Default is “backward”. Indicates which direction of the forward/backward pair of transforms is scaled and with what normalization factor.

Returns:

The transformed input with an updated dimension name and values.

Return type:

DataArray

Notes

To perform a multidimensional inverse Fourier operations, repeat this function on the desired dimensions.

Examples

>>> import xdas as xd
>>> import xdas.fft as xfft
>>> signal = xd.DataArray([0., 1., 0., -1.], coords={"time": [0, 1, 2, 3]})
>>> spectrum = xfft.fft(signal, dim={"time": "frequency"})
>>> result = xfft.ifft(spectrum, dim={"frequency": "time"})
>>> result["time"] = signal["time"]  # to match time coordinates
>>> assert np.real(result).equals(signal)