Skip to content

epymorph.simulator.basic.output

Classes for representing simulation results.

RUMEType_co module-attribute

RUMEType_co = TypeVar(
    "RUMEType_co", covariant=True, bound=RUME[GeoScope]
)

Output dataclass

Output(
    rume: RUMEType_co,
    initial: NDArray[SimDType],
    visit_compartments: NDArray[SimDType],
    visit_events: NDArray[SimDType],
    home_compartments: NDArray[SimDType],
    home_events: NDArray[SimDType],
    data_mode: Literal["visit", "home"] = "visit",
)

Bases: TableRendererMixin, PlotRendererMixin, MapRendererMixin, Generic[RUMEType_co]

The output of a simulation run, including compartment data for all locations and all IPM compartments and event data for all locations and all IPM events.

rume instance-attribute

The Rume used in the simulation that generated this output.

initial instance-attribute

initial: NDArray[SimDType]

Initial compartments by location and compartment. Array of shape (N,C) where N is the number of locations, and C is the number of compartments

visit_compartments instance-attribute

visit_compartments: NDArray[SimDType]

Compartment data collected in the node where individuals are visiting. See compartments for more information.

visit_events instance-attribute

visit_events: NDArray[SimDType]

Event data collected in the node where individuals are visiting. See events for more information.

home_compartments instance-attribute

home_compartments: NDArray[SimDType]

Compartment data collected in the node where individuals reside. See compartments for more information.

home_events instance-attribute

home_events: NDArray[SimDType]

Event data collected in the node where individuals reside. See events for more information.

data_mode class-attribute instance-attribute

data_mode: Literal["visit", "home"] = field(default="visit")

Controls which data is returned by the compartments and events properties. Although you can access both data sets, it's helpful to have a default for things like our plotting and mapping tools. Defaults to "visit".

See data_by_visit and data_by_home to obtain an Output object that uses a different data mode.

data_by_visit cached property

data_by_visit: Output

Returns an Output object that contains the same set of data, but uses 'visit' as the default data mode.

data_by_home cached property

data_by_home: Output

Returns an Output object that contains the same set of data, but uses 'home' as the default data mode.

compartments property

compartments: NDArray[SimDType]

Compartment data by timestep, location, and compartment. Array of shape (S,N,C) where S is the number of ticks in the simulation, N is the number of locations, and C is the number of compartments.

events property

events: NDArray[SimDType]

Event data by timestep, location, and event. Array of shape (S,N,E) where S is the number of ticks in the simulation, N is the number of locations, and E is the number of events.

events_per_day property

events_per_day: NDArray[SimDType]

Returns this output's incidence from a per-tick value to a per-day value. Returns a shape (T,N,E) array, where T is the number of simulation days.

ticks_in_days property

ticks_in_days: NDArray[float64]

Create a series with as many values as there are simulation ticks, but in the scale of fractional days. That is: the cumulative sum of the simulation's tau step lengths across the simulation duration. Returns a shape (S,) array, where S is the number of simulation ticks.

dataframe property

dataframe: DataFrame

Returns the output data in DataFrame form, using the current data mode.