laser.measles.compartmental.model
laser.measles.compartmental.model
Compartmental SEIR model for measles transmission with daily timesteps.
laser.measles.compartmental.model.CompartmentalModel(scenario, params, name='compartmental')
Bases: BaseLaserModel
Population-level SEIR model for measles transmission with daily timesteps.
Tracks compartment counts (S, E, I, R) per patch using deterministic
difference equations. This model is the fastest option for calibrating
transmission parameters to surveillance data because it avoids stochastic
noise. For individual-level tracking, see
ABMModel; for 14-day timesteps, see
BiweeklyModel.
This is the first object created in the build model stage of the
researcher workflow. After construction, attach components with
add_component or
by setting the components property, then call model.run().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scenario
|
DataFrame | BaseCompartmentalScenario
|
Metapopulation
patch data. Required columns: |
required |
params
|
CompartmentalParams
|
Simulation parameters including
|
required |
name
|
str
|
Display name for log messages. Defaults to
|
'compartmental'
|
Example:
1 2 3 4 5 6 7 8 9 10 11 12 | |
laser.measles.compartmental.model.CompartmentalModel.expose(indices, num_exposed)
Exposes the given nodes with the given number of exposed individuals. Moves individuals from Susceptible to Exposed compartment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indices
|
int | ndarray
|
The indices of the nodes to expose. |
required |
num_exposed
|
int | ndarray
|
The number of exposed individuals. |
required |
laser.measles.compartmental.model.CompartmentalModel.from_snapshot(path, params, components=None, verbose=True)
classmethod
Load a CompartmentalModel from an HDF5 snapshot.
Convenience wrapper around
load_snapshot.
Use this to resume a simulation from a checkpoint saved with
save_snapshot.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to the HDF5 file written by
|
required |
params
|
CompartmentalParams
|
|
required |
components
|
list | None
|
Ordered list of component classes — same as the
original model, minus |
None
|
verbose
|
bool
|
Print a loading summary. |
True
|
Returns:
| Type | Description |
|---|---|
CompartmentalModel
|
A configured
|
Example:
1 2 3 4 5 6 7 8 9 10 | |
laser.measles.compartmental.model.CompartmentalModel.infect(indices, num_infected)
Infects the given nodes with the given number of infected individuals. Moves individuals from Exposed to Infected compartment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indices
|
int | ndarray
|
The indices of the nodes to infect. |
required |
num_infected
|
int | ndarray
|
The number of infected individuals. |
required |
laser.measles.compartmental.model.CompartmentalModel.recover(indices, num_recovered)
Recovers the given nodes with the given number of recovered individuals. Moves individuals from Infected to Recovered compartment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indices
|
int | ndarray
|
The indices of the nodes to recover. |
required |
num_recovered
|
int | ndarray
|
The number of recovered individuals. |
required |