_tacoma.SR¶
-
class
_tacoma.SR¶ Base class for the simulation of an SR compartmental infection model on a temporal network (an SIR model where only initially infected have non-zero infection rate and non-zero recovery rate. All other nodes have zero infection rate and infinite recovery rate. This model can be used to measure the number of secondary infections of a single infectious seed, without higher-order infections. Pass this to
tacoma.api.gillespie_SR()to simulate and retrieve the simulation results.-
__init__(self: _tacoma.SR, N: int, t_simulation: float, infection_rate: float, recovery_rate: float, number_of_initially_infected: int = 1, number_of_initially_vaccinated: int = 0, sampling_dt: float = 0.0, seed: int = 0, save_infection_events: bool = False, stop_simulation_when_all_initially_infected_recovered: bool = False, verbose: bool = False) → None¶ Parameters: - N (int) – Number of nodes in the temporal network.
- t_simulation (float) – Maximum time for the simulation to run. Can possibly be greater than the maximum time of the temporal network in which case the temporal network is looped.
- infection_rate (float) – Infection rate per \(SI\)-link (expected number of reaction events \(SI\rightarrow II\) for a single \(SI\)-link per dimension of time).
- recovery_rate (float) – Recovery rate per infected (expected number of reaction events \(I\rightarrow R\) for a single infected node per dimension of time).
- number_of_initially_infected (int, default = 1) – Number of nodes which will be in the infected compartment at \(t = t_0\). Note that the default value 1 is not an ideal initial value as fluctuations may lead to a quick end of the simulation skewing the outcome. I generally recommend to use a number of the order of \(N/2\).
- number_of_initially_vaccinated (int, default = 0) – Number of nodes which will be in the recovered compartment at \(t = t_0\).
- sampling_dt (float, default = 0.0) – If this is
>0.0, save observables roughly every sampling_dt instead of on every change. - seed (int, default = 0) – Seed for RNG initialization. If this is 0, the seed will be initialized randomly.
- save_infection_events (bool, default = False) – If true, the edge along which each infection event occurs is saved in the variable infection_events. Will be set to True automatically if stop_simulation_when_all_initially_infected_recovered is True.
- stop_simulation_when_all_initially_infected_recovered (bool, default = False) – If true, the simulation will be stopped as soon as all initially infected have recovered. This can be used to measure the impact a single individual has. If set to true, save_infection_events will be set to True, as well, such that the infection trees can be inferred.
- verbose (bool, default = False) – Be talkative.
Methods
__init__(self, N, t_simulation, …)param N: Number of nodes in the temporal network. Attributes
IA list containing the number of infected at time \(t\). RA list containing the number of recovered at time \(t\). R0A list containing the basic reproduction number defined as \(R_0(t) = \eta\left\langle k \right\rangle(t) / \rho\) where \(\eta\) is the infection rate per link and \(\rho\) is the recovery rate per node. SIA list containing the number of \(SI\)-links at time \(t\). infection_eventsA list containing the edges along which each infection event took place, in the form (infection_source, susceptible). initially_infectedA list containing the nodes that were infected initially t_simulationAbsolute run time of the simulation. timeA list containing the time points at which one or more of the observables changed. -