epidemik documentation
epidemik is a Python package for building, exploring and visualising
compartmental epidemic models. It supports three flavours of model:
EpiModel– a classical homogeneously mixed compartmental model that can be either integrated as a system of ODEs or simulated stochastically.NetworkEpiModel– a stochastic compartmental model that lives on top of a contact network supplied as anetworkx.Graph.MetaEpiModel– a metapopulation model that couples severalEpiModelinstances together through a travel matrix.
All three classes share the same fluent API for declaring compartments and transitions, so moving from a homogeneous mixing model to a network or metapopulation variant is mostly a matter of swapping the class.
from epidemik import EpiModel
SIR = EpiModel()
SIR.add_interaction("S", "I", "I", 0.2)
SIR.add_spontaneous("I", "R", 0.1)
SIR.integrate(365, S=9_990, I=10, R=0)
SIR.plot()
User guide
Reference
Project