Skip to content

laser.measles.abm.components.process_constant_pop

process_constant_pop

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

ConstantPopParams

Bases: BaseConstantPopParams

Parameters for constant-population vital dynamics (inherits all fields from base).

Examples:

1
2
3
from laser.measles.abm.components.process_constant_pop import ConstantPopParams

params = ConstantPopParams(crude_birth_rate=20)

ConstantPopProcess(model, params=None)

Bases: BaseConstantPopProcess

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

Attributes:

Name Type Description
model

The model instance containing population and parameters.

initializers list

List of initializers to be called on birth events.

metrics DataFrame

DataFrame to holding timing metrics for initializers.

Examples:

1
2
3
4
5
6
7
8
9
from laser.measles.scenarios.synthetic import single_patch_scenario
from laser.measles.abm import ABMModel, ABMParams
from laser.measles.abm import components
from laser.measles import create_component

scenario = single_patch_scenario(population=50_000, mcv1_coverage=0.85)
params = ABMParams(num_ticks=365, seed=42, start_time="2000-01")
model = ABMModel(scenario, params)
model.add_component(create_component(components.ConstantPopProcess, components.ConstantPopParams(crude_birth_rate=20)))

Initialize the Births component.

Parameters:

Name Type Description Default
model object

The model object which must have a population attribute.

required
params BirthsParams

Component parameters. If None, uses model.params.

None

__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.

Parameters:

Name Type Description Default
model

The simulation model containing patches, population, and parameters.

required
tick

The current time step in the simulation.

required

Returns:

Type Description
None

None

This method performs the following steps:

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