morphogen.models.gaussian

Excursion sets of stationary Gaussian random fields.

morphogen.models.gaussian.K_CUTOFF = 6.0

modes with |k| * correlation_length above this are dropped (the Gaussian spectrum is then below exp(-18) of its maximum).

Type:

Spectral cut-off

morphogen.models.gaussian.MARGIN = 3.0

Margin (in correlation lengths) added around non-periodic domains.

class morphogen.models.gaussian.GaussianField(domain, correlation_length, threshold, box_lower, box_lengths, mode_seed, anisotropy=None, **kwargs)[source]

Bases: Microstructure

Phase 1 = {Y > threshold} for a unit-variance Gaussian field Y.

Y is a finite sum of Fourier modes on the generation box (the domain if periodic, the domain enlarged by 3 correlation lengths otherwise), so the same realization can be evaluated exactly at any resolution.

anisotropy

isotropic)

Type:

The affine anisotropy of the covariance rho(|A^-1 h|) (None

modes()[source]

Integer wave vectors and complex amplitudes C_m: Y(x) = Re sum C_m exp(i k_m.x).

field(shape=None, *, voxel_size=None, grid: Grid | None = None) → VoxelImage[source]

Values of the unit-variance Gaussian field at the voxel centres (float32).

voxelize(shape=None, *, voxel_size=None, grid: Grid | None = None, supersampling=1)[source]

Phase image (uint8), or partial volume fractions of phase 1 (float32) when supersampling > 1 (supersampling**3 sub-samples per voxel).

values_at(points) → ndarray[source]

The Gaussian field Y at points of space (rows): the sum of its modes.

contains(points) → ndarray[source]

Whether points lie in phase 1.

level_set_at(points, reach: float = inf) → ndarray[source]

(threshold - Y) * correlation_length at the points, as level_set().

property lipschitz: float

A bound of the slope of level_set_at() (three times the root mean square of the gradient of Y, times the correlation length).

level_set(shape=None, *, voxel_size=None, grid: Grid | None = None) → VoxelImage[source]

(threshold - Y) * correlation_length: negative in phase 1, roughly a distance near the interface.

summary() → dict[source]

Counts and sizes describing the realization.

class morphogen.models.gaussian.GaussianExcursion(correlation_length: float = 1.0, volume_fraction: float | None = None, threshold: float | None = None, *, anisotropy: Anisotropy | None = None)[source]

Bases: Model

Excursion set {Y > threshold} of a Gaussian field with covariance exp(-h^2 / 2 l^2).

Give the volume fraction p of the excursion (threshold Phi^-1(1 - p)) or the threshold itself. Periodic boxes should be at least ~10 correlation lengths wide. An anisotropy puts the metric of morphogen.models.affine in the covariance, rho(|A^-1 h|): correlation lengths s_i l along its principal axes, in periodic boxes too, whatever the axes (the modes of the box weighted by the spectrum at A^T k).

phases: ClassVar[dict[int, str]] = {0: 'phase 0', 1: 'excursion'}

Meaning of the phase indices of the voxel images.

property level: float
generate(domain: Domain, seed: int | SeedSequence | Generator | None = None) → GaussianField[source]

One realization of the model in domain.

theory(domain: Domain | None = None) → dict[str, float][source]

Theoretical morphological characteristics known in closed form (may be empty).

Some values depend on the domain (e.g. the intensity implied by a number of cells).

covariance(h) → ndarray[source]

C(h) = P(Y(x) > l, Y(x + h) > l) with rho(h) = exp(-h^2 / 2 l^2).

integral_range() → float[source]