CompartmentalModel#
- class CompartmentalModel(scenario, params, name='compartmental')[source]#
Bases:
BaseLaserModelA class to represent the compartmental model with daily timesteps.
- Parameters:
scenario (
BaseCompartmentalScenario|DataFrame) – A scenario containing the scenario data, including population, latitude, and longitude.params (
CompartmentalParams) – A set of parameters for the model.name (
str) – The name of the model. Defaults to “compartmental”.
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.
- The default model uses SEIR compartments:
S: Susceptible individuals
E: Exposed individuals (infected but not yet infectious)
I: Infectious individuals
R: Recovered/immune individuals
Initialize the disease model with the given scenario and parameters.
- Parameters:
scenario (
BaseCompartmentalScenario|DataFrame) – A scenario containing the scenario data, including population, latitude, and longitude.params (
CompartmentalParams) – A set of parameters for the model, including seed, num_ticks, beta, sigma, gamma, and other SEIR parameters.name (
str) – The name of the model. Defaults to “compartmental”.
- Returns:
None
Attributes
ParamsTypeScenarioTypecomponentsRetrieve the list of model components.
Methods
- scenario_wrapper_class#
alias of
BaseCompartmentalScenario
- __call__(model, tick)[source]#
Hook for subclasses to update the model for a given tick.
- Parameters:
model (
BaseLaserModel) – The model instance.tick (
int) – The current time step or tick.
- Return type:
None
- expose(indices, num_exposed)[source]#
Exposes the given nodes with the given number of exposed individuals. Moves individuals from Susceptible to Exposed compartment.
- Parameters:
indices (
int|ndarray) – The indices of the nodes to expose.num_exposed (
int|ndarray) – The number of exposed individuals.
- Return type:
None
- infect(indices, num_infected)[source]#
Infects the given nodes with the given number of infected individuals. Moves individuals from Exposed to Infected compartment.
- Parameters:
indices (
int|ndarray) – The indices of the nodes to infect.num_infected (
int|ndarray) – The number of infected individuals.
- 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|ndarray) – The indices of the nodes to recover.num_recovered (
int|ndarray) – The number of recovered individuals.
- Return type:
None