laser.measles.components.base_transmission
laser.measles.components.base_transmission
Base transmission component for laser.measles models.
This module defines the common interface and parameters for transmission components across different model types (ABM, biweekly, compartmental).
laser.measles.components.base_transmission.BaseTransmission(model, verbose=False, params=None)
Bases: BasePhase, ABC
Abstract base class for transmission components.
This class defines the common interface that all transmission components must implement, regardless of their underlying mathematical approach (agent-based, compartmental, etc.).
Initialize the transmission component.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
The model instance this component belongs to |
required | |
verbose
|
bool
|
Whether to enable verbose logging |
False
|
params
|
BaseTransmissionParams | None
|
Component parameters (uses defaults if None) |
None
|
laser.measles.components.base_transmission.BaseTransmission.__call__(model, tick)
abstractmethod
Execute transmission dynamics for one time step.
This method must be implemented by each model type to define how transmission occurs in that specific mathematical framework.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
The model instance |
required | |
tick
|
int
|
Current time step |
required |
laser.measles.components.base_transmission.BaseTransmission.apply_spatial_mixing(local_infections)
Apply spatial mixing to infection rates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
local_infections
|
ndarray
|
Local infection rates per patch |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Mixed infection rates accounting for spatial coupling |
laser.measles.components.base_transmission.BaseTransmission.get_effective_beta(tick, time_scale='daily')
Get effective transmission rate accounting for seasonality.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tick
|
int
|
Current time step |
required |
time_scale
|
str
|
Time scale of the model |
'daily'
|
Returns:
| Type | Description |
|---|---|
float
|
Effective transmission rate |
laser.measles.components.base_transmission.BaseTransmission.get_force_of_infection(model, tick)
Calculate force of infection for each patch.
This method provides a common interface for calculating the force of infection, which can be overridden by model-specific implementations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
The model instance |
required | |
tick
|
int
|
Current time step |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of force of infection values per patch |
laser.measles.components.base_transmission.BaseTransmission.get_seasonal_multiplier(tick, time_scale='daily')
Calculate seasonal transmission multiplier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tick
|
int
|
Current time step |
required |
time_scale
|
str
|
Time scale of the model ('daily', 'biweekly') |
'daily'
|
Returns:
| Type | Description |
|---|---|
float
|
Seasonal multiplier (1.0 = no seasonal effect) |
laser.measles.components.base_transmission.BaseTransmissionParams
Bases: BaseModel
Common parameters for all transmission components.