Skip to content

tahalahlou/epidemic-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Epidemic Simulation (SIR Model)

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.


Overview

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.


Model Details

  • 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.

Visualization

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.


Files

  • simulator.ipynb — Main Jupyter Notebook containing the full simulation, analysis, and visualization
  • README.md — Project documentation
  • requirements.txt — Minimal Python dependencies

How to Run

  1. Clone the repository:

    git clone https://github.com/tahalahlou/epidemic-simulation.git
    cd epidemic-simulation
    
  2. (Optional) Install dependencies:

    pip install -r requirements.txt
  3. Open the notebook:

    jupyter notebook simulator.ipynb
  4. Run all cells top-to-bottom to execute the simulation and view visualizations

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors