morphogen.analysis.covariance

Covariance (two-point probability) functions of images.

C(h) = P(x in A, x + h in A) is estimated with fast Fourier transforms: circularly for periodic images, with zero padding and normalization by the number of pairs otherwise. C(0) is the volume fraction and C(h) -> p^2 when correlations vanish.

class morphogen.analysis.covariance.AxisFunction(lags: dict[str, ndarray], values: dict[str, ndarray], volume_fraction: float)[source]

Bases: object

A function of the lags along the x, y and z axes (the covariance, the lineal-path and two-point cluster functions of morphogen.analysis.correlation).

mean() → tuple[ndarray, ndarray][source]

Average of the three axes (requires cubic voxels and equal lengths).

class morphogen.analysis.covariance.AxisCovariance(lags: dict[str, ndarray], values: dict[str, ndarray], volume_fraction: float)[source]

Bases: AxisFunction

Covariance along the x, y and z axes.

morphogen.analysis.covariance.covariance(image, phase: int = 1, *, max_lag: int | None = None, periodic=None)[source]

Covariance of phase along the three axes, for lags 0..max_lag voxels.

max_lag defaults to half the image size along each axis.

morphogen.analysis.covariance.covariance_map(image, phase: int = 1) → ndarray[source]

Full 3D covariance of a periodic image, zero lag at the centre (fftshift order).