API reference#
This page lists laser-measles’s API.
Base Components#
Components (e.g., infection, aging, vital dynamics, etc.) setup and affect the model, its structure and dynamics. Shared base classes that provide common interfaces and functionality across all model types. Model-specific implementations inherit from these base classes.
Component Architecture#
The laser-measles framework follows a hierarchical component architecture:
Base Components (
laser_measles.components) define abstract interfaces and common functionalityModel-Specific Implementations (
laser_measles.{model}.components) inherit from base classes and implement model-specific behaviorParameter Classes use Pydantic for validation and are paired with their respective component classes
Numpy/Numba Pattern - Components can provide both numpy and numba implementations for performance optimization
Inheritance Pattern Example:
# Base class in laser_measles.components
class BaseInitializeEquilibriumStatesProcess(BasePhase):
    # Common interface and default behavior
    pass
# Model-specific implementation in laser_measles.abm.components
class InitializeEquilibriumStatesProcess(BaseInitializeEquilibriumStatesProcess):
    # ABM-specific implementation
    pass
Process Base Classes#
Abstract base classes for components that modify population states and drive model dynamics:
Initialize S, R states of the population in each of the model states by rough equilibrium of R0.  | 
|
Phase for simulating the vital dynamics in the model with MCV1.  | 
|
A component to handle the birth events in a model with constant population - that is, births == deaths.  | 
|
Base class for infection (transmission and disease progression).  | 
Note that each component has a corresponding parameter class that is used to configure the component.
For example, the BaseInfectionProcess has a corresponding BaseInfectionParams class.
The parameter class is used to configure the component and defaults can be overridden using the
create_component function.
Tracker Base Classes#
Abstract base classes for components that monitor and record model state for analysis:
Component for tracking the number in each SEIR state for each time tick.  | 
|
Component for tracking detected cases in the model.  | 
|
Tracks the population size of each patch at each time tick.  | 
|
A phase that tracks and records the number of nodes experiencing fade-outs over time.  | 
Utilities#
Component creation and management utilities:
Decorator for creating components with default parameters.  | 
|
Helper function to create a component instance with parameters.  | 
ABM Model#
Core Model#
Agent based model:
Process Components#
Components that modify population states and drive model dynamics.
Most inherit from base classes in laser_measles.components:
Initialize S, R states of the population in each of the model states by rough equilibrium of R0.  | 
|
Process for simulating vital dynamics in the ABM model with MCV1 and constant birth and mortality rates (not age-structured).  | 
|
A component to handle the birth events in a model with constant population - that is, births == deaths.  | 
|
Combined infection process that orchestrates transmission and disease progression.  | 
|
Component for seeding initial infections in the compartmental model.  | 
|
Component for simulating the importation pressure in the model.  | 
|
Phase for implementing Supplementary Immunization Activities (SIAs) based on a calendar schedule.  | 
ABM-Specific Process Components#
Components unique to the ABM model:
Component for setting the population of the patches to not have births.  | 
|
A component to model the transmission of disease in a population.  | 
|
This component provides disease progression (E->I->R) It is used to update the infectious timers and the exposed timers.  | 
Tracker Components#
Components that monitor and record model state for analysis.
All inherit from base classes in laser_measles.components:
ABM state tracking component.  | 
|
Tracks the population size of each patch at each time tick.  | 
|
A component that tracks the number of nodes experiencing fade-outs over time.  | 
Compartmental Model#
Core Model#
Compartmental model with daily timesteps:
Process Components#
Components that modify population states and drive model dynamics.
All inherit from base classes in laser_measles.components:
Initialize S, R states of the population in each of the model states by rough equilibrium of R0.  | 
|
Process infection seeding.  | 
|
Component for simulating SEIR disease progression with daily timesteps.  | 
|
Component for simulating the importation pressure in the model.  | 
|
Phase for simulating the vital dynamics in the model with MCV1.  | 
|
A component to handle the birth events in a model with constant population - that is, births == deaths.  | 
|
Phase for implementing Supplementary Immunization Activities (SIAs) based on a calendar schedule.  | 
Tracker Components#
Components that monitor and record model state for analysis.
All inherit from base classes in laser_measles.components:
Atate tracking component.  | 
|
Tracks detected cases in the model.  | 
|
Tracks the population size of each patch.  | 
|
A component that tracks the number of nodes experiencing fade-outs over time.  | 
Biweekly Model#
Core Model#
Compartmental model with 2-week timesteps
Process Components#
Components that modify population states and drive model dynamics.
All inherit from base classes in laser_measles.components:
Initialize S, R states of the population in each of the model states by rough equilibrium of R0.  | 
|
Process infection seeding.  | 
|
Component for simulating the spread of infection in the model.  | 
|
Phase for simulating the vital dynamics in the model with MCV1.  | 
|
Component for simulating the importation pressure in the model.  | 
|
A component to handle the birth events in a model with constant population - that is, births == deaths.  | 
|
Phase for implementing Supplementary Immunization Activities (SIAs) based on a calendar schedule.  | 
Tracker Components#
Components that monitor and record model state for analysis.
Most inherit from base classes in laser_measles.components:
Atate tracking component.  | 
|
Tracks detected cases in the model.  | 
|
Tracks the population size of each patch.  | 
|
A component that tracks the number of nodes experiencing fade-outs over time.  | 
Biweekly-Specific Tracker Components#
Components unique to the Biweekly model:
A component that tracks the number of nodes experiencing fade-outs over time.  | 
Utilities#
Core Framework#
Base Classes#
Foundation classes that provide the component architecture:
Base class for all laser-measles components.  | 
|
Base class for laser-measles simulation models.  | 
Utilities#
Core utilities and computation functions:
Helper function to create a component instance with parameters.  | 
Demographics Package#
Geographic data handling for spatial epidemiological modeling:
Shapefile Utilities#
Functions for processing and visualizing geographic shapefiles:
Get a DataFrame containing the shapefile data with DOTNAME and shape columns.  | 
|
Raster Processing#
Tools for handling raster data and patch generation:
Mixing Models#
Spatial mixing models for population movement and disease transmission between geographic patches:
Base Classes#
Abstract base class that defines the interface for all mixing models:
Base class for migration models.  | 
Mixing Implementations#
Specific mixing model implementations for different types of population movement:
Gravity migration model.  | 
|
Stouffer migration model.  | 
|
Radiation migration model.  | 
|
Competing destinations mixing model.  |