Skip to content

laser.measles.components.base_constant_pop

laser.measles.components.base_constant_pop

Component defining the ConstantPopProcess, which handles the birth events in a model with constant population - that is, births == deaths.

laser.measles.components.base_constant_pop.BaseConstantPopParams

Bases: BaseVitalDynamicsParams

Parameters specific to the births process component.

Example:

1
2
3
4
5
```python
from laser.measles.biweekly.components.process_constant_pop import ConstantPopParams

params = ConstantPopParams(crude_birth_rate=20)
```

laser.measles.components.base_constant_pop.BaseConstantPopParams.crude_death_rate property

Death rate is always equal to birth rate to maintain constant population.

laser.measles.components.base_constant_pop.BaseConstantPopProcess(model, verbose=False, params=None)

Bases: BaseVitalDynamicsProcess

A component to handle the birth events in a model with constant population - that is, births == deaths.

Attributes:

1
2
3
4
model: The model instance containing population and parameters.
verbose (bool): Flag to enable verbose output. Default is False.
initializers (list): List of initializers to be called on birth events.
metrics (DataFrame): DataFrame to holding timing metrics for initializers.

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
```python
from laser.measles.scenarios.synthetic import single_patch_scenario
from laser.measles.biweekly import BiweeklyModel, BiweeklyParams
from laser.measles.biweekly import components
from laser.measles import create_component

scenario = single_patch_scenario(population=100_000, mcv1_coverage=0.85)
params = BiweeklyParams(num_ticks=52, seed=42, start_time="2000-01")
model = BiweeklyModel(scenario, params)
model.add_component(create_component(components.ConstantPopProcess, components.ConstantPopParams()))
```

Initialize the Births component.

Parameters:

1
2
3
model (object): The model object which must have a `population` attribute.
verbose (bool, optional): If True, enables verbose output. Defaults to False.
params (BirthsParams, optional): Component parameters. If None, uses model.params.

laser.measles.components.base_constant_pop.BaseConstantPopProcess.lambda_birth property

birth rate per tick

laser.measles.components.base_constant_pop.BaseConstantPopProcess.mu_death property

death rate per tick

laser.measles.components.base_constant_pop.BaseConstantPopProcess.__call__(model, tick)

Adds new agents to each patch based on expected daily births calculated from CBR. Calls each of the registered initializers for the newborns.

Args:

1
2
model: The simulation model containing patches, population, and parameters.
tick: The current time step in the simulation.

Returns:

1
None

This method performs the following steps:

1
1. Draw a random set of indices, or size size "number of births"  from the population,

laser.measles.components.base_constant_pop.BaseConstantPopProcess.calculate_capacity(model)

Calculate the capacity of the model.