xopto.util.fourier module¶
- discrete_simpson(frequency: numpy.ndarray, xpts: numpy.ndarray, fpts: numpy.array, uneven: Optional[bool] = None) → numpy.ndarray[source]¶
Computes Fourier transform of a 1D function defined on a grid of evenly or unevenly spaced points. To compute transforms of multiple sets (functions), the fpts array shape must be (num_xfuns, xpts.size).
- Parameters
frequency (np.ndarray) – A list of frequencies (1/m) at which to compute the Fourier transform.
xpts (np.ndarray) – A vector of evenly or unevenly spaced points at which the function values in fpts are defined.
fpts (np.ndarray) – A vector or array of function values defined at points xpts. To compute transforms of multiple sets (functions), the fpts array shape must be (num_xfuns, xpts.size).
uneven (bool) – If True, the method assumes unevenly spaced values in xpts. Default is False. If set to None, the value of uneven flag is derived from the values in the xpts array.
- Returns
F – The Fourier transform at the given frequencies. If the fpts array is a vector (points of one function only) then F is a vector of size len(frequencies). If fpts is a 2D array of shape (N, xpts.size) then F is a 2D array of shape (N, len(frequencies)).
- Return type
np.ndarray