Skip to content

epymorph.event

epymorph's event frameworks. The idea is to have a set of classes which define event protocols for logical components of epymorph.

OnStart

Bases: NamedTuple

The payload of a simulation on_start event.

simulator instance-attribute

simulator: str

Name of the simulator class.

rume instance-attribute

rume: RUME

The RUME for the simulation.

OnTick

Bases: NamedTuple

The payload of a Simulation tick event.

tick_index instance-attribute

tick_index: int

The index of the just-completed tick.

ticks instance-attribute

ticks: int

The total number of ticks for the simulation.

OnMovementStart

Bases: NamedTuple

The payload for the event when movement processing starts for a tick.

tick instance-attribute

tick: int

Which simulation tick.

day instance-attribute

day: int

Which simulation day.

step instance-attribute

step: int

Which tau step (by index).

OnMovementClause

Bases: NamedTuple

The payload for the event when a single movement clause has been processed.

tick instance-attribute

tick: int

Which simulation tick.

day instance-attribute

day: int

Which simulation day.

step instance-attribute

step: int

Which tau step (by index).

clause_name instance-attribute

clause_name: str

The clause processed.

requested instance-attribute

requested: NDArray[SimDType]

The number of individuals this clause 'wants' to move, that is, the values returned by its clause function. (An NxN array.)

actual instance-attribute

actual: NDArray[SimDType]

The actual number of individuals moved, by source, destination, and compartment. (An NxNxC array.)

total instance-attribute

total: int

The number of individuals moved by this clause.

is_throttled instance-attribute

is_throttled: bool

Did the clause request to move more people than were available (at any location)?

OnMovementFinish

Bases: NamedTuple

The payload for the event when movement processing finishes for one simulation tick.

tick instance-attribute

tick: int

Which simulation tick.

day instance-attribute

day: int

Which simulation day.

step instance-attribute

step: int

Which tau step (by index).

total instance-attribute

total: int

The total number of individuals moved during this tick.

DownloadActivity

Bases: NamedTuple

A description of ADRIO network download activity.

All fields are optional, as it may be possible to measure some but not others depending on the data source. ADRIOs should avoid reporting DownloadActivity where all fields are None, and should instead just report None for AdrioProgress.download

total instance-attribute

total: int | None

How many bytes are expected to be downloaded?

downloaded instance-attribute

downloaded: int | None

How many bytes have been downloaded?

download_speed instance-attribute

download_speed: int | None

What is the current approximate download speed?

ADRIOProgress

Bases: NamedTuple

The payload of AdrioEvents.on_adrio_progress

Perhaps not all ADRIOs will report progress, but those that do should emit one event when they start (with ratio_complete == 0) and one when they finish (with ratio_complete == 1). They are free to report as many intermediate progress events as they like.

adrio_name instance-attribute

adrio_name: str

The full name of the ADRIO class.

attribute instance-attribute

attribute: AbsoluteName

The name of the attribute being evaluated.

final instance-attribute

final: bool

Is this the last progress update for this ADRIO?

ratio_complete instance-attribute

ratio_complete: float

What ratio complete is it? (0: just started; 1: done)

download instance-attribute

download: DownloadActivity | None

Download activity if any, and if it can be measured.

duration instance-attribute

duration: float | None

If complete, how long did the ADRIO take overall (in seconds)?

EventBus

EventBus()

The one-stop for epymorph events. This class uses the singleton pattern.

on_start instance-attribute

on_start: Event[OnStart] = Event()

Event fires at the start of a simulation run.

on_tick instance-attribute

on_tick: Event[OnTick] = Event()

Event fires after each tick has been processed.

on_finish instance-attribute

on_finish: Event[None] = Event()

Event fires after a simulation run is complete.

on_movement_start instance-attribute

on_movement_start: Event[OnMovementStart] = Event()

Event fires at the start of the movement processing phase for every simulation tick.

on_movement_clause instance-attribute

on_movement_clause: Event[OnMovementClause] = Event()

Event fires after processing each active movement clause.

on_movement_finish instance-attribute

on_movement_finish: Event[OnMovementFinish] = Event()

Event fires at the end of the movement processing phase for every simulation tick.

on_adrio_progress instance-attribute

on_adrio_progress: Event[ADRIOProgress] = Event()

Event fires when an ADRIO is fetching data.