morphogen.distributions¶
Probability distributions of positive scalars (radii, lengths, weights…).
A distribution is given in configuration files either as a number (constant) or as a
mapping with a type key:
radius: 1.0
radius: {type: uniform, low: 0.5, high: 1.5}
radius: {type: lognormal, mean: 1.0, std: 0.3}
radius: {type: normal, mean: 20.0, std: 13.5} # truncated to positive values
radius: {type: discrete, values: [1.0, 2.0], weights: [0.7, 0.3]}
Unbounded distributions are truncated at their 1 - 1e-9 quantile so that every
model can bound the extent of its grains (needed to generate unbiased samples).
- morphogen.distributions.TAIL_QUANTILE = 0.999999999¶
Quantile at which unbounded distributions are truncated.
- class morphogen.distributions.Distribution[source]¶
Bases:
ABCDistribution of a positive random variable.
- abstractmethod quadrature(n: int = 128) tuple[ndarray, ndarray][source]¶
Nodes and weights approximating
E[f(X)]bysum(w * f(x)).
- property is_constant: bool¶
- class morphogen.distributions.Constant(value: 'float')[source]¶
Bases:
Distribution- property is_constant¶
- class morphogen.distributions.Uniform(low: 'float', high: 'float')[source]¶
Bases:
Distribution
- class morphogen.distributions.LogNormal(mean_value: float, std_value: float)[source]¶
Bases:
DistributionLog-normal distribution given by the mean and standard deviation of X itself.
- property sigma: float¶
- property mu: float¶
- class morphogen.distributions.TruncatedNormal(loc: float, scale: float, low: float = 0.0, high: float = inf)[source]¶
Bases:
DistributionNormal distribution N(mean, std) truncated to
[low, high](default: positive).
- class morphogen.distributions.Discrete(values: 'tuple[float, ...]', weights: 'tuple[float, ...]')[source]¶
Bases:
Distribution
- morphogen.distributions.distribution_from_config(value, name: str = 'distribution') Distribution[source]¶
Build a distribution from a number or a mapping (see the module docstring).