laser.measles.abm.components.process_infection
laser.measles.abm.components.process_infection
Component defining the InfectionProcess, which orchestrates the transmission and disease progression of measles in a population.
laser.measles.abm.components.process_infection.InfectionParams
Bases: BaseInfectionParams
Combined parameters for ABM transmission and disease processes.
Spatial mixing is controlled in one of two ways:
- Default gravity — leave
mixerasNoneand configuredistance_exponentandmixing_scale. Internally a :class:~laser.measles.mixing.gravity.GravityMixingis constructed using those values. - Custom mixer — pass any mixing object (e.g.
GravityMixing(...),RadiationMixing(...)) asmixer=. When set, this takes precedence;distance_exponentandmixing_scaleare ignored.
The model sets the patch scenario on the mixer automatically at
initialisation, so callers don't need to assign mixer.scenario
themselves.
Examples::
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
laser.measles.abm.components.process_infection.InfectionParams.disease_params
property
Extract disease-specific parameters.
laser.measles.abm.components.process_infection.InfectionParams.transmission_params
property
Build the TransmissionParams to hand to TransmissionProcess.
If the caller supplied a mixer, pass it through. Otherwise wire
distance_exponent and mixing_scale into a default
GravityMixing(GravityParams(c=..., k=...)). The latter is the
fix called out in #140 — passing those values to TransmissionParams
directly silently dropped them because TransmissionParams doesn't
declare them.
laser.measles.abm.components.process_infection.InfectionProcess(model, params=None)
Bases: BaseInfectionProcess
Combined infection process that orchestrates transmission and disease progression.
This component provides a unified interface for both disease transmission (handled by TransmissionProcess) and disease progression through states (handled by DiseaseProcess), similar to the biweekly model's InfectionProcess but for agent-based modeling.
Example:
1 2 3 4 5 6 7 8 9 10 11 | |
Initialize the combined infection process.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
ABMModel
|
The model object that contains the patches and parameters. |
required |
params
|
InfectionParams | None
|
Combined parameters for both transmission and disease processes. |
None
|
laser.measles.abm.components.process_infection.InfectionProcess.mixing_matrix
property
The spatial mixing matrix the wrapped TransmissionProcess is using.
Convenience accessor that walks down to the live mixer instance:
self.transmission.params.mixer.mixing_matrix. Once the model has
run, mixer.scenario is set and the matrix is lazily computed on
first access. Shape is (n_patches, n_patches).
Provided here so code that has a handle on the InfectionProcess
(e.g. model.get_instance("InfectionProcess")[0]) can get the
matrix in one hop, without knowing that TransmissionProcess is
nested inside as a sub-component rather than registered separately.
laser.measles.abm.components.process_infection.InfectionProcess.__call__(model, tick)
Execute both transmission and disease progression for the given tick.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
ABMModel
|
The model object containing the population, patches, and parameters. |
required |
tick
|
int
|
The current time step in the simulation. |
required |
laser.measles.abm.components.process_infection.InfectionProcess.infect(model, idx)
Move agents at the given indices from susceptible to exposed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
ABMModel
|
The ABM model instance. |
required |
idx
|
ndarray
|
Array of agent indices to infect. |
required |
laser.measles.abm.components.process_infection.InfectionProcess.plot(fig=None)
Plot cases and incidence using the transmission component's plotting functionality.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fig
|
Figure | None
|
A Matplotlib Figure object to plot on. If None, a new figure is created. |
None
|