laser_cholera.metapop package¶
- class laser_cholera.metapop.HumanToHuman(model)[source]¶
Bases:
object
- class laser_cholera.metapop.HumanToHumanVax(model)[source]¶
Bases:
object
- laser_cholera.metapop.get_parameters(paramsource: str | Path | dict | None = None, do_validation: bool = True, overrides: dict | None = None) PropertySetEx [source]¶
Submodules¶
laser_cholera.metapop.analyzer module¶
laser_cholera.metapop.census module¶
laser_cholera.metapop.derivedvalues module¶
laser_cholera.metapop.environmental module¶
- laser_cholera.metapop.environmental.map_suitability_to_decay(fast, slow, suitability, beta_a, beta_b)[source]¶
Map suitability to decay using a beta distribution.
- Parameters:
fast (float) – Fast decay time.
slow (float) – Slow decay time.
suitability (np.ndarray) – Suitability values.
beta_a (float) – Alpha parameter for the beta distribution.
beta_b (float) – Beta parameter for the beta distribution.
- Returns:
np.ndarray – Decay rates corresponding to the suitability values.
laser_cholera.metapop.envtohuman module¶
Environmental transmission rate.
laser_cholera.metapop.envtohumanvax module¶
Environmental transmission rate.
laser_cholera.metapop.exposed module¶
laser_cholera.metapop.humantohuman module¶
Human-to-human transmission rate.
- class laser_cholera.metapop.humantohuman.HumanToHuman(model)[source]¶
Bases:
object
laser_cholera.metapop.humantohumanvax module¶
Human-to-human transmission rate.
- class laser_cholera.metapop.humantohumanvax.HumanToHumanVax(model)[source]¶
Bases:
object
laser_cholera.metapop.infectious module¶
laser_cholera.metapop.logsetup module¶
laser_cholera.metapop.model module¶
- class laser_cholera.metapop.model.Model(parameters: PropertySet, name: str = 'Cholera Metapop')[source]¶
Bases:
object
- property components: list¶
Retrieve the list of model components.
- Returns:
list – A list containing the components.
- run() None [source]¶
Execute the model for a specified number of ticks, recording the time taken for each phase.
This method initializes the start time, iterates over the number of ticks specified in the model parameters, and for each tick, it executes each phase of the model while recording the time taken for each phase.
The metrics for each tick are stored in a list. After completing all ticks, it records the finish time and, logs a summary of the timing metrics.
- Variables:
tstart (datetime) – The start time of the model execution.
tfinish (datetime) – The finish time of the model execution.
metrics (list) – A list of timing metrics for each tick and phase.
- Returns:
None
laser_cholera.metapop.params module¶
- class laser_cholera.metapop.params.PseEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]¶
Bases:
JSONEncoder
- default(obj)[source]¶
Implement this method in a subclass such that it returns a serializable object for
o
, or calls the base implementation (to raise aTypeError
).For example, to support arbitrary iterators, you could implement default like this:
def default(self, o): try: iterable = iter(o) except TypeError: pass else: return list(iterable) # Let the base class default method raise the TypeError return JSONEncoder.default(self, o)
- laser_cholera.metapop.params.dict_to_propertysetex(parameters: dict) PropertySetEx [source]¶
- laser_cholera.metapop.params.get_parameters(paramsource: str | Path | dict | None = None, do_validation: bool = True, overrides: dict | None = None) PropertySetEx [source]¶
- laser_cholera.metapop.params.load_compressed_hdf5_parameters(filename: str | Path) PropertySetEx [source]¶
- laser_cholera.metapop.params.load_compressed_json_parameters(filename: str | Path) PropertySetEx [source]¶
- laser_cholera.metapop.params.load_hdf5(h5file) PropertySetEx [source]¶
- laser_cholera.metapop.params.load_hdf5_parameters(filename: str | Path) PropertySetEx [source]¶
- laser_cholera.metapop.params.load_json_parameters(filename: str | Path) PropertySetEx [source]¶
- laser_cholera.metapop.params.validate_parameters(params: PropertySetEx) None [source]¶
laser_cholera.metapop.recorder module¶
laser_cholera.metapop.recovered module¶
laser_cholera.metapop.scenario module¶
laser_cholera.metapop.susceptible module¶
laser_cholera.metapop.utils module¶
- laser_cholera.metapop.utils.fourier_series_double(t, beta0, a1, b1, a2, b2, p)[source]¶
Computes the value of a Fourier series with two harmonics at a given time.
- Parameters:
t (array-like) – Time values.
beta0 (float) – Constant term of the Fourier series.
a1 (array-like) – Amplitudes of the first harmonic (cosine component).
b1 (array-like) – Amplitudes of the first harmonic (sine component).
a2 (array-like) – Amplitudes of the second harmonic (cosine component).
b2 (array-like) – Amplitudes of the second harmonic (sine component).
p (float) – Period of the Fourier series.
- Returns:
numpy.ndarray – The computed Fourier series values at the given time points.