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.