autosim.simulations.epidemic

autosim.simulations.epidemic#

SIR epidemic simulator and ODE helper functions.

class Epidemic(parameters_range=None, output_names=None, log_level='progress_bar')[source]#

Bases: Simulator

Simulator of infectious disease spread using the SIR model.

The compartment dynamics are:

\[\begin{split}\begin{aligned} \frac{dS}{dt} &= -\beta S I / N \\ \frac{dI}{dt} &= \beta S I / N - \gamma I \\ \frac{dR}{dt} &= \gamma I \end{aligned}\end{split}\]

The simulator returns the peak infection rate as a fraction of the total population.

Parameters:

log_level (str)

simulate_epidemic(x, N=1000, I0=1)[source]#

Simulate an epidemic using the SIR model.

The compartment dynamics are:

\[\begin{split}\begin{aligned} \frac{dS}{dt} &= -\beta S I / N \\ \frac{dI}{dt} &= \beta S I / N - \gamma I \\ \frac{dR}{dt} &= \gamma I \end{aligned}\end{split}\]
Parameters:
  • x (ndarray) – The parameters of the SIR model. The first element is the transmission rate (beta) and the second element is the recovery rate (gamma).

  • N (int) – The total population size. Defaults to 1000.

  • I0 (int) – The initial number of infected individuals. Defaults to 1.

Returns:

The peak infection rate as a fraction of the total population.

Return type:

float