Skip to content

laser.measles.components.base_infection_seeding

laser.measles.components.base_infection_seeding

Component for seeding initial infections in the compartmental model.

laser.measles.components.base_infection_seeding.BaseInfectionSeedingParams

Bases: BaseModel

Parameters for the infection seeding component.

laser.measles.components.base_infection_seeding.BaseInfectionSeedingParams.validate_infections_per_patch(v, info) classmethod

Validate that infections_per_patch matches target_patches length if both provided.

laser.measles.components.base_infection_seeding.BaseInfectionSeedingParams.validate_target_patches(v) classmethod

Validate target_patches format.

laser.measles.components.base_infection_seeding.BaseInfectionSeedingProcess(model, verbose=False, params=None)

Bases: BaseComponent

Component for seeding initial infections in the compartmental model.

This component initializes infections by moving individuals from the Susceptible (S) compartment to the Infected (I) compartment. It can either: 1. Automatically seed the patch with the largest population (default) 2. Seed specific patches provided by the user

The seeding occurs during the initialize() phase, after equilibrium states are set but before the simulation begins.

Parameters

model : BaseLaserModel The compartmental model instance verbose : bool, default=False Whether to print verbose output during initialization params : Optional[InfectionSeedingParams], default=None Component-specific parameters. If None, will use default parameters

Examples

Seed 1 infection in largest patch (default)

seeding_params = InfectionSeedingParams()

Seed 5 infections in largest patch

seeding_params = InfectionSeedingParams(num_infections=5)

Seed specific patches with same number of infections

seeding_params = InfectionSeedingParams( target_patches=["nigeria:kano:kano:A0001", "nigeria:kano:kano:A0002"], infections_per_patch=3 )

Seed specific patches with different numbers of infections

seeding_params = InfectionSeedingParams( target_patches=["nigeria:kano:kano:A0001", "nigeria:kano:kano:A0002"], infections_per_patch=[5, 2] )