laser_measles.biweekly package#
- BaseScenario#
alias of
BaseBiweeklyScenario
- class BiweeklyModel(scenario, params, name='biweekly')[source]#
Bases:
BaseLaserModel
A class to represent the biweekly model.
- Parameters:
scenario (BaseScenario) – A scenario containing the scenario data, including population, latitude, and longitude.
params (BiweeklyParams) – A set of parameters for the model.
name (str, optional) – The name of the model. Defaults to “biweekly”.
Notes
This class initializes the model with the given scenario and parameters. The scenario must include the following columns:
id (string): The name of the patch or location.
pop (integer): The population count for the patch.
lat (float degrees): The latitude of the patches (e.g., from geographic or population centroid).
lon (float degrees): The longitude of the patches (e.g., from geographic or population centroid).
mcv1 (float): The MCV1 coverage for the patches.
- infect(indices, num_infected)[source]#
Infects the given nodes with the given number of infected individuals.
- Parameters:
indices (int | np.ndarray) – The indices of the nodes to infect.
num_infected (int | np.ndarray) – The number of infected individuals to infect.
- Return type:
None
- recover(indices, num_recovered)[source]#
Recovers the given nodes with the given number of recovered individuals. Moves individuals from Infected to Recovered compartment.
- Parameters:
indices (int | np.ndarray) – The indices of the nodes to recover.
num_recovered (int | np.ndarray) – The number of recovered individuals.
- Return type:
None
- scenario_wrapper_class#
alias of
BaseBiweeklyScenario
-
patches:
PatchLaserFrame
#
- pydantic model BiweeklyParams[source]#
Bases:
BaseModelParams
Parameters for the biweekly model.
Show JSON schema
{ "title": "BiweeklyParams", "description": "Parameters for the biweekly model.", "type": "object", "properties": { "seed": { "default": 20250314, "description": "Random seed", "title": "Seed", "type": "integer" }, "start_time": { "default": "2000-01", "description": "Initial start time of simulation in YYYY-MM format", "title": "Start Time", "type": "string" }, "num_ticks": { "default": 365, "description": "Number of time steps", "title": "Num Ticks", "type": "integer" }, "verbose": { "default": false, "description": "Whether to print verbose output", "title": "Verbose", "type": "boolean" }, "show_progress": { "default": true, "description": "Whether to show progress bar during simulation", "title": "Show Progress", "type": "boolean" }, "use_numba": { "default": true, "description": "Whether to use numba acceleration when available", "title": "Use Numba", "type": "boolean" } }, "additionalProperties": false }
- Config:
extra: str = forbid
- Fields:
- property states: list[str]#
List of model states. Must be implemented by subclasses.
- property time_step_days: int#
Time step in days. Must be implemented by subclasses.
- Model#
alias of
BiweeklyModel
- Params#
alias of
BiweeklyParams
Subpackages#
Submodules#
laser_measles.biweekly.base module#
Basic classes for biweekly model.
- pydantic model BaseScenarioSchema[source]#
Bases:
Model
Schema for the scenario data.
Show JSON schema
{ "title": "BaseScenarioSchema", "description": "Schema for the scenario data.", "type": "object", "properties": { "pop": { "title": "Pop", "type": "integer" }, "lat": { "title": "Lat", "type": "number" }, "lon": { "title": "Lon", "type": "number" }, "id": { "title": "Id", "type": "string" }, "mcv1": { "title": "Mcv1", "type": "number" } }, "required": [ "pop", "lat", "lon", "id", "mcv1" ] }
-
field id:
str
[Required]#
-
field lat:
float
[Required]#
-
field lon:
float
[Required]#
-
field mcv1:
float
[Required]#
-
field pop:
int
[Required]#
- DataFrame#
alias of
BaseScenarioSchemaDataFrame
- LazyFrame#
alias of
BaseScenarioSchemaLazyFrame
-
field id:
- BaseScenario#
alias of
BaseBiweeklyScenario
laser_measles.biweekly.model module#
A class to represent the biweekly model.
- class BiweeklyModel(scenario, params, name='biweekly')[source]#
Bases:
BaseLaserModel
A class to represent the biweekly model.
- Parameters:
scenario (BaseScenario) – A scenario containing the scenario data, including population, latitude, and longitude.
params (BiweeklyParams) – A set of parameters for the model.
name (str, optional) – The name of the model. Defaults to “biweekly”.
Notes
This class initializes the model with the given scenario and parameters. The scenario must include the following columns:
id (string): The name of the patch or location.
pop (integer): The population count for the patch.
lat (float degrees): The latitude of the patches (e.g., from geographic or population centroid).
lon (float degrees): The longitude of the patches (e.g., from geographic or population centroid).
mcv1 (float): The MCV1 coverage for the patches.
- scenario_wrapper_class#
alias of
BaseBiweeklyScenario
-
patches:
PatchLaserFrame
#
- infect(indices, num_infected)[source]#
Infects the given nodes with the given number of infected individuals.
- Parameters:
indices (int | np.ndarray) – The indices of the nodes to infect.
num_infected (int | np.ndarray) – The number of infected individuals to infect.
- Return type:
None
- recover(indices, num_recovered)[source]#
Recovers the given nodes with the given number of recovered individuals. Moves individuals from Infected to Recovered compartment.
- Parameters:
indices (int | np.ndarray) – The indices of the nodes to recover.
num_recovered (int | np.ndarray) – The number of recovered individuals.
- Return type:
None
- scenario: BaseScenario#
- params: BaseModelParams#
- instances: list#
- phases: list#
- metrics: list#
- Model#
alias of
BiweeklyModel
laser_measles.biweekly.params module#
Parameters for the biweekly model.
- pydantic model BiweeklyParams[source]#
Bases:
BaseModelParams
Parameters for the biweekly model.
Show JSON schema
{ "title": "BiweeklyParams", "description": "Parameters for the biweekly model.", "type": "object", "properties": { "seed": { "default": 20250314, "description": "Random seed", "title": "Seed", "type": "integer" }, "start_time": { "default": "2000-01", "description": "Initial start time of simulation in YYYY-MM format", "title": "Start Time", "type": "string" }, "num_ticks": { "default": 365, "description": "Number of time steps", "title": "Num Ticks", "type": "integer" }, "verbose": { "default": false, "description": "Whether to print verbose output", "title": "Verbose", "type": "boolean" }, "show_progress": { "default": true, "description": "Whether to show progress bar during simulation", "title": "Show Progress", "type": "boolean" }, "use_numba": { "default": true, "description": "Whether to use numba acceleration when available", "title": "Use Numba", "type": "boolean" } }, "additionalProperties": false }
- Config:
extra: str = forbid
- Fields:
- property states: list[str]#
List of model states. Must be implemented by subclasses.
- property time_step_days: int#
Time step in days. Must be implemented by subclasses.
- Params#
alias of
BiweeklyParams