API Reference#

Fields#

GaussianRandomField(left_edge, right_edge, ...)

base_field.BaseField(left_edge, right_edge, ...)

Base class holding the grid geometry shared by all field types: the box edges, cell spacing, real-space coordinate arrays, and Fourier wavenumber arrays.

base_field.RandomField(left_edge, ...)

Base class for fields generated from random realizations, adding a seeded random number generator on top of BaseField's grid geometry.

Power spectra#

PowerSpectrum(power_spec_func[, ndim])

Base class wrapping a user-supplied power spectrum function P(k), with an adjustable normalization.

PowerLaw(alpha, k0[, ndim])

Power-law power spectrum.

PowerLawBetaModel(l_min, l_max, alpha[, ndim])

Power-law power spectrum with exponential cutoffs at small and large scales.

DoublePowerLaw(alpha_lo, alpha_hi, l_break)

Smoothly broken power-law power spectrum: index alpha_lo at large scales (k below the break wavenumber 2*pi/l_break), transitioning to index alpha_hi at small scales (k above the break wavenumber).

Fourier analysis#

FourierAnalysis(width, ddims)

FFT-based analysis of scalar and vector fields on a regular grid: power spectra, divergence/curl, and vector-potential inversion.

fourier_analysis.FFTArray(input_array[, delta])

An ndarray subclass that carries the grid spacing delta it was transformed with as metadata, so downstream methods (e.g. FourierAnalysis.ifftn) can validate that arrays being combined share the same grid.

Filters#

filters.KSpaceFilter(length[, ndim])

Base class for a fixed-scale, isotropic low-pass filter kernel, applied to a field by multiplication in Fourier space: filtered_hat(k) = W_hat(k) * data_hat(k) (Perrone et al. 2026, Eq.

GaussianFilter(length[, ndim])

Gaussian filter kernel at fixed scale length (\(\ell\)):

TopHatFilter(length[, ndim])

Spherical top-hat filter kernel at fixed scale length (\(\ell\)): uniform over a ball of radius \(\ell\) in real space (Perrone et al. 2026, Eq.