laser.measles.biweekly
laser.measles.biweekly
laser.measles.biweekly.BaseScenario = BaseBiweeklyScenario
module-attribute
Base class for scenario data wrappers.
Provides a wrapper around polars DataFrames with additional validation and convenience methods.
laser.measles.biweekly.BiweeklyModel(scenario, params, name='biweekly')
Bases: BaseLaserModel
A class to represent the biweekly model.
Args:
1 2 3 | |
Notes:
1 2 3 4 5 6 7 | |
Initialize the disease model with the given scenario and parameters.
Args:
1 2 3 | |
Returns:
1 | |
laser.measles.biweekly.BiweeklyModel.__call__(model, tick)
Updates the model for the next tick.
Args:
1 2 | |
Returns:
1 | |
laser.measles.biweekly.BiweeklyModel.infect(indices, num_infected)
Infects the given nodes with the given number of infected individuals.
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 to infect. |
required |
laser.measles.biweekly.BiweeklyModel.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 |
laser.measles.biweekly.BiweeklyParams
Bases: BaseModelParams
Parameters for the biweekly compartmental measles model (14-day timesteps).
All fields are inherited from :class:BaseModelParams. Key fields:
Attributes:
| Name | Type | Description |
|---|---|---|
num_ticks |
int
|
Number of biweekly (14-day) simulation steps (e.g., 26 = 1 year, 130 = 5 years). |
seed |
int
|
Random seed for reproducibility. Default: 20250314. |
start_time |
str
|
Simulation start in |
verbose |
bool
|
Print detailed logging. Default: False. |
Example::
1 2 3 | |
laser.measles.biweekly.create_component(component_class, params=None)
Helper function to create a component instance with parameters.
This function creates a callable object that will instantiate the component with the given parameters when called by the model.
Parameters
component_class : Type[BaseComponent] The component class to instantiate **kwargs Parameters to pass to the component constructor
Returns
Callable[[Any, Any], BaseComponent] A function that creates the component instance when called by the model
Examples
model.components = [ ... create_component(MyComponent, params=MyComponentParams), ... AnotherComponent, ... ]