The SEIR model is a compartmental model used in epidemiology to simulate the spread of infectious diseases. It divides the population into four compartments:
- S: Susceptible β individuals who can contract the disease
- E: Exposed β individuals who have been infected but are not yet infectious
- I: Infectious β individuals capable of spreading the disease
- R: Recovered β individuals who have recovered and are immune
The dynamics of the model are governed by the following system of differential equations:
Where:
-
$$\beta$$ is the transmission rate -
$$\alpha$$ is the rate at which exposed individuals become infectious -
$$\gamma$$ is the recovery rate
This repository contains a lightweight and interactive Python-based tool to explore SEIR model dynamics:
π SEIR-Interactive/
βββ π examples/
β βββ seir_simulation_default.png # A sample image showing the default SEIR simulation output
β βββ seir_logscale_enabled.png # The same simulation with logarithmic scale enabled
β
βββ π src/
β βββ SEIR.py # Interactive SEIR visualization tool
β βββ SEIR.ipynb # Simplified version in Jupyter Notebook
β
βββ README.md # Project documentation
- Implements an interactive graphical interface using
matplotlibwidgets (sliders, textboxes, checkboxes) - Allows dynamic adjustment of parameters: population size,
$$R_0$$ ,$$\alpha$$ ,$$\gamma$$ , initial E and I values, simulation length - Supports toggling between linear and logarithmic Y-axis scales
- Uses the explicit Euler method for numerical integration
- A minimal, non-interactive notebook for basic simulations
-
Clone the repository:
git clone https://github.com/alexanderk001/SEIR-Interactive.git cd SEIR-Interactive/src -
Install dependencies:
pip install matplotlib numpy
-
Run the interactive visualization:
python SEIR.py
This project is licensed under the MIT License.
