Skip to content

laser.measles.abm.components.process_importation

laser.measles.abm.components.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.

laser.measles.abm.components.process_importation.ImportationParams

Bases: BaseModel

Parameters specific to the importation process components.

Example:

1
2
3
4
5
```python
from laser.measles.abm.components.process_importation import ImportationParams

params = ImportationParams()
```

laser.measles.abm.components.process_importation.InfectAgentsInPatchProcess(model, params=None)

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

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

1
model: The model object that contains the population.

Side Effects:

laser.measles.abm.components.process_importation.InfectAgentsInPatchProcess.__call__(model, tick)

Updates the infection timers for the population in the model.

Args:

1
2
model: The model containing the population data.
tick: The current tick or time step in the simulation.

Returns:

1
None

laser.measles.abm.components.process_importation.InfectAgentsInPatchProcess.plot(fig=None)

Nothing yet

laser.measles.abm.components.process_importation.InfectRandomAgentsProcess(model, params=None)

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

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

1
model: The model object that contains the population.

Side Effects:

laser.measles.abm.components.process_importation.InfectRandomAgentsProcess.__call__(model, tick)

Updates the infection timers for the population in the model.

Args:

1
2
model: The model containing the population data.
tick: The current tick or time step in the simulation.

Returns:

1
None

laser.measles.abm.components.process_importation.InfectRandomAgentsProcess.plot(fig=None)

Nothing yet