laser.cohorts.interventions.vaccination
vaccination
Vaccination intervention for the laser.cohorts Campaign component.
Moves a binomial-drawn fraction of each targeted compartment state into a
dedicated V (vaccinated) state. Coverage is applied as a direct
probability: coverage=0.8 means each targeted individual has an 80%
chance of being vaccinated on the scheduled tick.
Vaccination
Vaccination(model)
Bases: Intervention
Move a coverage fraction of targeted individuals into the V compartment.
Reads coverage from the params dict (default 0.0) and applies a
binomial draw to each targeted state in the targeted nodes. Results are
accumulated in the newly_vaccinated node property.
Expected params keys:
coverage (float): Probability in [0, 1] that any individual in a
targeted state/node is vaccinated this tick. Default 0.0.
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Example
Campaign.register(Vaccination) schedule = [ ... {"who": ["S"], "what": "Vaccination", "when": 30, ... "where": "*", "parameters": {"coverage": 0.8}, "notes": ""}, ... ]
properties
property
properties
Return the node properties declared by this intervention.
Returns:
| Type | Description |
|---|---|
list[PropertyType]
|
list[PropertyType]: |
states
property
states
Return the compartment states declared by this intervention.
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: |
execute
execute(tick, who, where, params, notes)
Vaccinate a fraction of targeted individuals on this tick.
For each targeted state in each targeted node, draws the number of
vaccinees from a binomial distribution using coverage as the
success probability, removes them from their current state, and adds
them to V[tick + 1].
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tick
|
int
|
Current simulation tick (0-indexed). |
required |
who
|
list[str] | None
|
Compartment state names to vaccinate from;
|
required |
where
|
list[int] | None
|
Node IDs to vaccinate; |
required |
params
|
dict
|
Must contain |
required |
notes
|
str
|
Free-text annotation; not used by this intervention. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |