xopto.mcbase.mcutil.fourier module

discreteSimpson(frequency: list, xpts: numpy.ndarray, fpts: numpy.ndarray, uneven: bool = False)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 (list, tuple, ndarray vector) – A list of frequencies at which to compute the Fourier transform.

  • xpts (np.ndarray vector) – A vector of evenly or unevenly spaced points at which the function values in fpts are defined.

  • fpts (np.ndarray vector of 2D array) – 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.

  • = 2*pi*int_0^inf(f(r)*J0(2*pi*q*r)*r*dr) (g(q)) –

Returns

F – The Fourier transfor of xfun at the given frequencies. If the fpts array ia 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 vector