Skip to content

laser.measles.compartmental.base

base

Basic classes for compartmental model.

BaseCompartmentalScenario(df)

Bases: BaseScenario

Scenario wrapper for the compartmental model.

Validates that the input DataFrame conforms to the BaseScenarioSchema (columns id, pop, lat, lon, mcv1) and makes the data available to model components.

Parameters:

Name Type Description Default
df DataFrame

Polars DataFrame with patch-level data.

required

Examples:

1
2
3
from laser.measles.scenarios.synthetic import single_patch_scenario

scenario = single_patch_scenario(population=100_000, mcv1_coverage=0.85)

BaseScenarioSchema

Bases: Model

Schema for the scenario data.

Examples:

1
2
3
4
from laser.measles.scenarios.synthetic import single_patch_scenario

scenario = single_patch_scenario(population=100_000, mcv1_coverage=0.85)
# Validated automatically when passed to CompartmentalModel(scenario, params)

PatchLaserFrame(capacity, initial_count=-1, **kwargs)

Bases: BasePatchLaserFrame

Patch-level LaserFrame for the compartmental model.

Examples:

1
2
3
model.patches.S  # susceptible counts, shape (nticks+1, num_patches)
model.patches.E  # exposed counts (SEIR model)
model.patches.I  # infectious counts