Skip to content

Creating a deterministic model of an infectious disease

License

Notifications You must be signed in to change notification settings

ManuMBhat/py-pandemic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Py-Pandemic

A pandemic simulator based on the SIR (Susceptible, Infectious, Recovered/Dead) compartmental model in epidemiology.

Currently supported features

  • Population shuffling
  • Obtain people in contact with an individual
  • Scalable from communities to cities
  • Support for travellers
  • R0s based on social distancing parameters
  • Recovery time based on health care parameters
  • Contact tracing
  • Hotspots

Dependencies

Example

To simulate a city of population 1000, create a City object. Currently the community size is fixed to 100.

blore = City("Bangalore", 1000, gdp=1e9, healthCare=1)

Before calling the updateCity() method make sure there's at least one infected person in each community of the city.

for _ in range(len(blore.Communities)):
        currentCommunity = blore.Communities[_]
        pZero = random.randint(0, currentCommunity.grid.size - 1)
        currentCommunity.people[pZero].state = 'I'

You can call updateCity() a few times until everyone reaches state R. Other helpful methods such as getNumInfected() and getNumSusceptible() let you track infectious and susceptible people respectively during each iteration.

About

Creating a deterministic model of an infectious disease

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages