morphogen.seeding¶
Reproducible random number generation.
Every random draw in morphoGen goes through a numpy.random.Generator built
from a seed. The realizations of a study get seeds derived from the study seed and
their indices (SeedSequence(seed, spawn_key=(size_index, realization_index))), so
a result does not depend on how the study was split across processes or cluster jobs.
- morphogen.seeding.derive_seed(base: int | None, *key: int) SeedSequence[source]¶
Seed of the item
key(e.g.(size_index, realization_index)) of a study.
- morphogen.seeding.make_rng(seed: int | SeedSequence | Generator | None = None) tuple[Generator, dict | None][source]¶
Return a generator and a JSON-able description that reproduces it.
seedmay be an integer, aSeedSequence, an existing generator (used as is, not reproducible from the description) orNone(fresh entropy, recorded so that the realization can be regenerated).
- morphogen.seeding.describe_seed(ss: SeedSequence) dict[source]¶
The entropy and spawn key of a seed sequence, which recreate it (recorded with the results).
- morphogen.seeding.seed_from_description(desc: dict | int | None) SeedSequence | int | None[source]¶
Inverse of
describe_seed()(also accepts a plain integer).