Skip to content

epymorph.simulator.basic.ipm_exec

IPM executor classes handle the logic for processing the IPM step of the simulation.

CompiledTransition module-attribute

CompiledTransition = CompiledEdge | CompiledFork

Result

Bases: NamedTuple

The result from executing a single IPM step.

visit_compartments instance-attribute

visit_compartments: SimArray

updated compartments as a result of these events (an (N,C) array) tracked by the location where the individuals currently are

visit_events instance-attribute

visit_events: SimArray

events that happened this tick (an (N,E) array) tracked by the location where the event occurred

home_compartments instance-attribute

home_compartments: SimArray

updated compartments as a result of these events (an (N,C) array) tracked by the location that the individuals consider home

home_events instance-attribute

home_events: SimArray

events that happened this tick (an (N,E) array) tracked by the home location of the individuals effected

CompiledEdge dataclass

CompiledEdge(rate_lambda: SympyLambda)

Lambdified EdgeDef (no fork). Effectively: poisson(rate * tau)

size class-attribute

size: int = 1

rate_lambda instance-attribute

rate_lambda: SympyLambda

CompiledFork dataclass

CompiledFork(
    size: int,
    rate_lambda: SympyLambda,
    prob_lambda: SympyLambda,
)

Lambdified ForkDef. Effectively: multinomial(poisson(rate * tau), prob)

size instance-attribute

size: int

rate_lambda instance-attribute

rate_lambda: SympyLambda

prob_lambda instance-attribute

prob_lambda: SympyLambda

IPMExecutor

IPMExecutor(
    rume: RUME,
    world: World,
    data: DataResolver,
    rng: Generator,
)

The standard implementation of compartment model IPM execution.

apply

apply(tick: Tick) -> Result

Applies the IPM for this tick, mutating the world state. Returns the location-specific events that happened this tick (an (N,E) array) and the new compartments resulting from these events (an (N,C) array).