pisces.math_utils.random_fields.GaussianRandomField.compute_wavenumber_arrays#

GaussianRandomField.compute_wavenumber_arrays(fft_type: str = 'real')#

Compute the 1D wavenumber arrays for each axis of the domain.

This method constructs the Fourier-space sampling frequencies along each axis of the grid, converting from discrete FFT frequencies (in cycles per unit length) to angular wavenumbers (radians per unit length).

The choice of FFT convention determines whether the last axis uses a reduced frequency representation:

  • If fft_type='complex' (full complex FFT, via np.fft.fftn), then all axes use np.fft.fftfreq and include both positive and negative frequencies.

  • If fft_type='real' (real-to-complex FFT, via np.fft.rfftn), then the last axis uses np.fft.rfftfreq to return only the non-negative frequencies, while all earlier axes still use np.fft.fftfreq.

Parameters:

fft_type ({'real', 'complex'}, optional) – FFT convention to use. Default is 'real'.

Returns:

Tuple of 1D arrays, one per axis, giving the discrete angular wavenumbers (radians per unit length) along each axis. The arrays can be combined with numpy.meshgrid() (for example via compute_wavenumber_mgrid()) to construct the full multidimensional Fourier grid.

Return type:

tuple of np.ndarray

Notes

  • The wavenumber values are computed as:

    k = 2 * pi * freq
    

    where freq is the output of np.fft.fftfreq or np.fft.rfftfreq.

  • The grid spacing is inferred from the domain dimensions and bounding box provided at initialization.