RandomField#

class pisces.math_utils.random_fields.RandomField(domain_dimensions: ndarray, bounding_box: ndarray, **kwargs)[source]#

Abstract base class for defining random fields in arbitrary dimensions.

This class provides a general framework for representing random fields on uniform grids. It encapsulates domain geometry, spatial and Fourier space utilities, and a standard interface for generating random field realizations.

Subclasses should implement generate(), which constructs a particular type of random field (e.g. Gaussian random field with a specified power spectrum).

Parameters:
  • domain_dimensions (numpy.ndarray of int) – Number of grid points along each axis of the domain. Must be a 1D array of length equal to the spatial dimensionality.

  • bounding_box (numpy.ndarray) – The lower and upper bounds of the domain in each dimension. For example, [[x_min, y_min], [x_max, y_max]] in 2D. The shape must be (2, ndim).

  • rng (numpy.random.Generator, optional) – Random number generator instance. Defaults to np.random.default_rng().

Notes

Methods

__init__(domain_dimensions, bounding_box, ...)

compute_grid_arrays()

Compute the meshgrid of spatial coordinates for the random field.

compute_spatial_mgrid(**kwargs)

Compute the meshgrid of spatial coordinates for the random field.

compute_wavenumber_arrays([fft_type])

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

compute_wavenumber_mgrid([fft_type])

Compute the meshgrid of wavenumber arrays for the random field.

generate(*args, **kwargs)

Generate a realization of the random field.

Attributes

bbox

Bounding box of the random field.

dd

Domain dimensions of the random field.

dl

Alias for grid_spacing.

grid_range

Range of the grid in each dimension.

grid_spacing

Spacing of the grid in each dimension.

ndim

Number of dimensions of the random field.