Skip to content

laser.measles.compartmental.components.process_importation_pressure

laser.measles.compartmental.components.process_importation_pressure

Component for simulating the importation pressure in the compartmental model.

laser.measles.compartmental.components.process_importation_pressure.ImportationPressureParams

Bases: BaseModel

Parameters for the importation pressure component.

Importation pressure simulates external case introductions from outside the modeled population (e.g., international travel, cross-border movement), moving susceptible individuals into the exposed (E) compartment each daily tick.

Note

Unlike the ABM and biweekly models which move S→I, the compartmental model moves imported cases S→E, letting them progress through the latent period.

Attributes:

Name Type Description
crude_importation_rate float | list[float] | dict[str, float]

Yearly importation rate per 1,000 population. Three forms are accepted:

  • float (scalar): uniform rate applied to every patch. 0.0 disables importation entirely.

  • list / tuple / numpy array (sequence): per-patch rates in the same order as model.scenario rows. Length must equal the number of patches.

  • dict[str, float] (sparse patch override): maps patch string ids (values from model.scenario["id"], e.g. "n_0_0", "n_2_2") to rates. Patches absent from the dict receive a rate of 0.0 — they do not inherit the scalar default of 1.0.

importation_start int

Day on which importation begins (inclusive). Default 0 starts importation at the first tick.

importation_end int

Day on which importation ends (inclusive). Use -1 (default) to keep importation active for the full simulation. Must be greater than importation_start when not -1.

Examples:

Uniform low background pressure across all patches::

1
params = ImportationPressureParams(crude_importation_rate=0.05)

Disable importation entirely::

1
params = ImportationPressureParams(crude_importation_rate=0.0)

Per-patch sequence (one entry per patch, aligned to scenario row order)::

1
2
3
4
# 25-patch model; patch at row index 12 is the metro hub
rates = [0.02] * 25
rates[12] = 0.5
params = ImportationPressureParams(crude_importation_rate=rates)

Sparse dict — only named patches receive importation; all others get 0.0::

1
2
3
4
# Use string ids from model.scenario["id"], e.g. "n_0_0", "n_2_2"
params = ImportationPressureParams(
    crude_importation_rate={"n_2_2": 0.5, "n_0_0": 0.1},
)

Numpy array input (accepted and converted to list internally)::

1
2
3
4
import numpy as np
params = ImportationPressureParams(
    crude_importation_rate=np.array([0.01, 0.05, 0.01, 0.01, 0.01])
)

Time-windowed importation active only during the first year (days 0-364)::

1
2
3
4
5
params = ImportationPressureParams(
    crude_importation_rate=0.1,
    importation_start=0,
    importation_end=364,
)

Metro-only importation for the first year, then stop::

1
2
3
4
5
params = ImportationPressureParams(
    crude_importation_rate={"n_2_2": 2.0},
    importation_start=0,
    importation_end=364,
)

laser.measles.compartmental.components.process_importation_pressure.ImportationPressureParams.validate_importation_end(v, info) classmethod

Validate that importation_end is greater than importation_start when not -1.

laser.measles.compartmental.components.process_importation_pressure.ImportationPressureProcess(model, verbose=False, params=None)

Bases: BasePhase

Component for simulating the importation pressure in the model.

This component handles the simulation of disease importation into the population. It processes: - Importation of cases based on crude importation rate - Time-windowed importation (start/end times) - Population updates: Moves individuals from susceptible to exposed state

Parameters

model : object The simulation model containing nodes, states, and parameters verbose : bool, default=False Whether to print verbose output during simulation params : Optional[ImportationPressureParams], default=None Component-specific parameters. If None, will use default parameters

Notes
  • Importation rates are calculated per year
  • Importation is limited to the susceptible population
  • All state counts are ensured to be non-negative