Skip to content

laser.measles.abm.components.process_importation

process_importation

Importation components: periodically introduce new infections into a population during simulation.

Classes:

Name Description
ImportationParams

Pydantic schema for configuring importation cadence, count, time window, and patch targets.

InfectRandomAgentsProcess

Periodically infects a random subset of agents drawn from anywhere in the population.

InfectAgentsInPatchProcess

Periodically infects a fixed number of agents in each patch listed in importation_patchlist (defaults to all patches).

Both process classes share the same __init__(model, params: ImportationParams | None = None) signature; if params is omitted, values are read from model.params for backward compatibility.

ImportationParams

Bases: BaseModel

Parameters specific to the importation process components.

Examples:

1
2
3
from laser.measles.abm.components.process_importation import ImportationParams

params = ImportationParams()

InfectAgentsInPatchProcess(model, params=None)

A component to update the infection timers of a population in a model.

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.InfectAgentsInPatchProcess, components.ImportationParams()))

Initialize an InfectAgentsInPatchProcess instance.

Parameters:

Name Type Description Default
model ABMModel

The model object that contains the population.

required
params ImportationParams | None

Optional importation configuration. When provided, this should be an ImportationParams instance whose importation_period, importation_count, importation_start, importation_end, and importation_patchlist fields control the timing, number of imported infections, start/end ticks, and patches targeted by this process. If None, these values are populated from model.params for backward compatibility.

None

Attributes:

Name Type Description
model

The model object that contains the population.

Side Effects:

__call__(model, tick)

Updates the infection timers for the population in the model.

Parameters:

Name Type Description Default
model

The model containing the population data.

required
tick

The current tick or time step in the simulation.

required

Returns:

Type Description
None

None

plot(fig=None)

Nothing yet

InfectRandomAgentsProcess(model, params=None)

A component to update the infection timers of a population in a model.

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.InfectRandomAgentsProcess, components.ImportationParams()))

Initialize an InfectRandomAgentsProcess instance.

Parameters:

Name Type Description Default
model ABMModel

The model object that contains the population.

required
params ImportationParams | None

Optional importation configuration. If provided, this should be an ImportationParams instance whose importation_period, importation_count, and importation_start fields are used to initialize this process's period, count, and start attributes (and importation_end maps to end). If None, the values are loaded from model.params for backward compatibility.

None

Attributes:

Name Type Description
model

The model object that contains the population.

Side Effects:

__call__(model, tick)

Updates the infection timers for the population in the model.

Parameters:

Name Type Description Default
model

The model containing the population data.

required
tick

The current tick or time step in the simulation.

required

Returns:

Type Description
None

None

plot(fig=None)

Nothing yet