pisces.math_utils.random_fields.RandomField.compute_wavenumber_arrays#
- RandomField.compute_wavenumber_arrays(fft_type: str = 'real')[source]#
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, vianp.fft.fftn
), then all axes usenp.fft.fftfreq
and include both positive and negative frequencies.If
fft_type='real'
(real-to-complex FFT, vianp.fft.rfftn
), then the last axis usesnp.fft.rfftfreq
to return only the non-negative frequencies, while all earlier axes still usenp.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 viacompute_wavenumber_mgrid()
) to construct the full multidimensional Fourier grid.- Return type:
tuple
ofnp.ndarray
Notes
The wavenumber values are computed as:
k = 2 * pi * freq
where
freq
is the output ofnp.fft.fftfreq
ornp.fft.rfftfreq
.The grid spacing is inferred from the domain dimensions and bounding box provided at initialization.