Skip to content

Simple visualization of how fast a virus can spread among population.

License

Notifications You must be signed in to change notification settings

smtr42/simple-virus-spread-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Virus spread simulation

Simple visualization of how fast a virus can spread among population.

Table of Contents

About The Project

During the Covid-19 outbreak I saw a very nice article from the Washington Post explaining how a virus spread among people. It includes nice embedded visuals made by Harry Stevens. I wanted, as a personal challenge and as an aspiring programmer, to write a similar simple program but in python 3.

The collision algorithm was heavily inspired (copied) from Peter Collingridge python 2 physics simulation and his very nice tutorial.

State

It's a simple simulation. There is yet no chart implementation.

The algorithm is quite expensive, so above a few hundred particles the simulation is not usable.

It's a quick side project, optimisation, PEP compliance, documentation and general code readability will be worked in the future.

Example

Getting Started

Installation

I used Python 3.7. I use pipenv to manage dependencies.

Pipenv

  • Clone the repo
git clone https://github.com/smtr42/spread.git
  • Install required dependencies
pipenv install

Virtual env

  • Create a virtual environment
python3 -m venv env
  • Install requirements
pip install -r requirements.txt

Usage

Open a Command Line Interface and launch the main.py script with Python.

python -m main

To modify the parameters, open the main.py file :

sim.add_particle(n=150, speed=6, freezed=93, killer=4)
  • n is the number of particles
  • speed is the initial speed of a particle
  • freezed is the percentage of particles fixed in space
  • killer is the number of particles sick at the start

Depending on how much particles is instantiated, one should modify the speed for better render. Note that the algorithm is O(n²) and for large n this simulation doesn't work.

Authors

Project Link: [https://github.com/smtr42/P5_openfoodfact]

  • Simonnet T - Initial work - smtr42

    linkedin

Inspired from Peter Collingridge physics simulation and his very nice tutorial. Photo by Markus Spiske on Unsplash

About

Simple visualization of how fast a virus can spread among population.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages