laser.measles.abm.utils
laser.measles.abm.utils
This module provides utility functions for the laser-measles project.
Functions:
| Name | Description |
|---|---|
calc_distances |
np.ndarray, longitudes: np.ndarray, verbose: bool = False) -> np.ndarray: Calculate the pairwise distances between points given their latitudes and longitudes. |
calc_capacity |
np.uint32, nticks: np.uint32, cbr: np.float32, verbose: bool = False) -> np.uint32: Calculate the population capacity after a given number of ticks based on a constant birth rate. |
seed_infections_randomly |
int = 100) -> None: Seed initial infections in random locations at the start of the simulation. |
seed_infections_in_patch |
int, ninfections: int = 100) -> None: Seed initial infections in a specific location at the start of the simulation. |
set_initial_susceptibility_randomly |
float = 1.0) -> None: Set the population susceptibility level at the start of the simulation. |
set_initial_susceptibility_in_patch |
int, susc_frac: float = 1.0) -> None: Set the population susceptibility level at the start of the simulation in a specific patch. |
laser.measles.abm.utils.calc_capacity(population, nticks, cbr, verbose=False)
Calculate the population capacity after a given number of ticks based on a constant birth rate (CBR).
Args:
1 2 3 4 | |
Returns:
1 | |
laser.measles.abm.utils.calc_distances(latitudes, longitudes, verbose=False)
Calculate the pairwise distances between points given their latitudes and longitudes.
Parameters:
1 2 3 | |
Returns:
1 | |
Raises:
1 | |
laser.measles.abm.utils.seed_infections_in_patch(model, ipatch, ninfections=1)
Seed initial infections in a specific patch of the population at the start of the simulation. This function randomly selects individuals from the specified patch and sets their infection timer to the mean infection duration, effectively marking them as infected. The process continues until the desired number of initial infections is reached.
Args:
1 2 3 | |
Returns:
1 | |
laser.measles.abm.utils.seed_infections_randomly(model, ninfections=100)
Seed initial infections in random locations at the start of the simulation. This function randomly selects individuals from the population and seeds them with an infection, based on the specified number of initial infections.
Args:
1 2 3 | |
Returns:
1 | |
laser.measles.abm.utils.seed_infections_randomly_SI(model, ninfections=100)
Seed initial infections in random locations at the start of the simulation. This function randomly selects individuals from the population and seeds them with an infection, based on the specified number of initial infections.
Args:
1 2 3 | |
Returns:
1 | |
laser.measles.abm.utils.set_initial_susceptibility_in_patch(model, ipatch, susc_frac=1.0)
Set the population susceptibility level at the start of the simulation, in a specific patch. This function randomly selects individuals from the patch and changes their susceptibility to zero, according to the parameter susc_frac.
Args:
1 2 3 | |
Returns:
1 | |
laser.measles.abm.utils.set_initial_susceptibility_randomly(model, susc_frac=1.0)
Set the population susceptibility level at the start of the simulation. This function randomly selects individuals from the population and changes their susceptibility to zero, according to the parameter susc_frac.
Args:
1 2 | |
Returns:
1 | |