parse_dist#
- pypillometry.sim.parse_dist(spec)[source]#
Distribution of times from its specification.
- Parameters:
spec (str, float or Quantity) – a fixed time (
"300 ms",2.5(ms)) or a distribution, e.g."uniform(2 s, 10 s)","normal(500 ms, 30 ms)","lognormal(300 ms, 80 ms)"(mean and standard deviation of the times) or"exponential(1 s)"(mean)- Return type:
Dist- Returns:
with
sample(rng, size),meanandquantile(q)
Examples
>>> import numpy as np >>> d = parse_dist("uniform(2 s, 10 s)") >>> d.mean, str(d) (6000.0, 'uniform(2 s, 10 s)') >>> float(parse_dist("300 ms").sample(np.random.default_rng(0))) 300.0