core.utils.fft
Fast Fourier Transform related functions.
This module provides functions for computing inverse Fast Fourier Transforms.
Functions
- ifftCompute the inverse Fast Fourier Transform of an array with optional
frequency domain shifting
- gridr.core.utils.fft.ifft(array, shift=True, shift_after=True)[source]
Compute the inverse Fast Fourier Transform of the input array.
This function computes the inverse FFT of a 1D or 2D array and provides optional frequency domain shifting before and after the transform.
- Parameters:
array (numpy.ndarray) – Input array (1D or 2D) representing frequency domain data with zero-frequency component at the center of the spectrum
shift (bool, default True) – If True, shifts the input array so that the zero-frequency component is at the beginning of the spectrum before computing the inverse FFT
shift_after (bool, default True) – If True, shifts the result so that the zero spatial frequency index is at the center of the output array
- Returns:
The inverse FFT result with appropriate frequency domain shifting applied
- Return type:
numpy.ndarray
Notes
The function assumes the input array has its zero-frequency component at the center of the spectrum. This is typical for FFT results where the DC component is positioned at the middle of the array.
Examples
>>> import numpy as np >>> freq_data = np.random.rand(100) >>> spatial_data = ifft(freq_data, shift=True, shift_after=True)