A discrete-time epidemic simulation modeling the spread of an infectious disease across a 150×150 grid representing New York City.
The simulator uses an SIR-style state model and probabilistic transitions to study how infection, recovery, and mortality evolve over time.
This project simulates disease dynamics using a simplified but expressive epidemiological model.
Each cell in the grid represents a population unit and can exist in one of three states:
- S — Susceptible: healthy and vulnerable to infection
- I — Infected: currently infected and capable of spreading the disease
- R — Removed / Resistant: recovered or deceased and no longer susceptible
Time advances in discrete steps, allowing the simulation to track how local interactions and probabilistic events shape global outbreak behavior.
- Grid size: 150 × 150 (22,500 cells)
- State model: SIR (Susceptible → Infected → Removed)
- Infection spread:
Infected cells may transmit disease to adjacent neighbors based on a configurable virality probability. - Recovery:
Infected cells recover after a fixed number of time steps. - Mortality:
Death probability follows a normal distribution, modeling time-dependent mortality risk. - Simulation scale:
Visualizes outbreak dynamics over hundreds of discrete time steps.
The simulation is visualized directly in Jupyter Notebook using matplotlib.
- Green cells represent susceptible populations
- Red cells represent infected populations
- Gray cells represent removed or resistant populations
This makes it easy to observe how parameter changes affect spread speed, peak infection, and total mortality.
simulator.ipynb— Main Jupyter Notebook containing the full simulation, analysis, and visualizationREADME.md— Project documentationrequirements.txt— Minimal Python dependencies
-
Clone the repository:
git clone https://github.com/tahalahlou/epidemic-simulation.git cd epidemic-simulation -
(Optional) Install dependencies:
pip install -r requirements.txt
-
Open the notebook:
jupyter notebook simulator.ipynb
-
Run all cells top-to-bottom to execute the simulation and view visualizations