kspace.PowerSpectrum#
- class kspace.PowerSpectrum(power_spec_func, ndim=3)[source]#
Bases:
objectBase class wrapping a user-supplied power spectrum function P(k), with an adjustable normalization.
- Parameters:
power_spec_func (callable) – A function of the wavenumber k returning the (unnormalized) power spectrum. Must be numba-jittable.
ndim (int, optional) – Number of dimensions (1, 2, or 3). Default is 3.
Methods
A(k)The Fourier amplitude corresponding to the power spectrum at a given wavenumber k, A(k) = sqrt(E(k) * k).
E(k)The "energy spectrum" of the power spectrum as a function of the wavenumber k.
__init__(power_spec_func[, ndim])integrate_E(kmin, kmax)Integrate the energy spectrum E(k) over a range of wavenumbers.
renormalize(f_rms[, kmin, kmax])Rescale the power spectrum's normalization so that the integral of its energy spectrum over [kmin, kmax] gives the desired RMS field value.
- A(k)[source]#
The Fourier amplitude corresponding to the power spectrum at a given wavenumber k, A(k) = sqrt(E(k) * k).
- Parameters:
k (float or array-like) – The wavenumber(s).
- E(k)[source]#
The “energy spectrum” of the power spectrum as a function of the wavenumber k.
- Parameters:
k (float or array-like) – The wavenumber(s).