Skip to content

laser.measles.compartmental.base

laser.measles.compartmental.base

Basic classes for compartmental model.

laser.measles.compartmental.base.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

Example:

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

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

laser.measles.compartmental.base.BaseScenarioSchema

Bases: Model

Schema for the scenario data.

Example:

1
2
3
4
5
6
```python
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)
```

laser.measles.compartmental.base.PatchLaserFrame(capacity, initial_count=-1, **kwargs)

Bases: BasePatchLaserFrame

Patch-level LaserFrame for the compartmental model.

Example:

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