Skip to main content

Synthetic population generation

Project description

SynthPops

SynthPops is a module designed to generate synthetic populations that are used for COVID-19 (SARS-CoV-2) epidemic analyses. SynthPops can create generic populations with different network characteristics, as well as synthetic populations that interact in different layers of a multilayer contact network.

The code was developed to explore the impact of contact tracing and testing in human contact networks in combination with our Covasim repository.

More extensive installation and usage instructions are in the SynthPops documentation.

Installation

Python >=3.6 is required. Python 2 is not supported. Virtual environments are recommended but not required.

To install, first clone the GitHub repository, and then type:

python setup.py develop

Note: while synthpops can also be installed via pypi, this method does not currently include the data files which are required to function, and thus is not recommended.

Quick Start

The following code creates a synthetic population for Seattle, Washington::

import synthpops as sp

sp.validate()

datadir = sp.datadir # this should be where your demographics data folder resides

location = 'seattle_metro'
state_location = 'Washington'
country_location = 'usa'
sheet_name = 'United States of America'
level = 'county'

npop = 10000 # how many people in your population
sp.generate_synthetic_population(npop,datadir,location=location,
                                 state_location=state_location,country_location=country_location,
                                 sheet_name=sheet_name,level=level)

Usage

In addition to the documentation, see the examples folder for usage examples.

Structure

All core modeling is in the synthpops folder; standard usage is import synthpops as sp.

data

The data folder contains demographic data needed and some pre-generated contact networks for populations of different sizes. Please update synthpops.datadir to point at this directory.

licenses

The licenses folder contains:

  • NOTICE: Third-party software notices and information
  • notice.py: Scraper to auto-generate the NOTICE file.

synthpops

The synthpops folder contains:

  • __init__.py
  • api.py
  • config.py: Methods to set where datadir points; this should be the path to the data folder.
  • contact_networks.py: Functions to create a synthetic population with demographic data and places people into households, schools, and workplaces.
  • contacts.py: Functions to create other types of contact networks and load multilayer networks.
  • plot_tools.py: Functions to plot an age-mixing matrix for a layer in the contact network.
  • synthpops.py: Functions to call in demographic data and sampling functions.
  • version.py: Version and date.

tests

The tests folder contains tests of different functions available in SynthPops.

Disclaimer

The code in this repository was developed by IDM to support our research in disease transmission and managing epidemics. We’ve made it publicly available under the Creative Commons Attribution-Noncommercial-ShareAlike 4.0 License to provide others with a better understanding of our research and an opportunity to build upon it for their own work. We make no representations that the code works as intended or that we will provide support, address issues that are found, or accept pull requests. You are welcome to create your own fork and modify the code to suit your own modeling needs as contemplated under the Creative Commons Attribution-Noncommercial-ShareAlike 4.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

synthpops-0.5.1.tar.gz (38.0 kB view details)

Uploaded Source

Built Distribution

synthpops-0.5.1-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

Details for the file synthpops-0.5.1.tar.gz.

File metadata

  • Download URL: synthpops-0.5.1.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for synthpops-0.5.1.tar.gz
Algorithm Hash digest
SHA256 b3aa02d62658e120ed996351e85eba147eb0801b7e96705f9cc55d650e96cc4e
MD5 c496a175351e4b5a24e8a8bf95881866
BLAKE2b-256 17bd1ae121d24bf014dacef16c912afcb7b7924dd3831877db23c725723b1ef1

See more details on using hashes here.

File details

Details for the file synthpops-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: synthpops-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 45.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for synthpops-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 66be01511fb584ae99b0bed8603a2e6329c651e2cf8922e063f0672b761f5dc1
MD5 a5f57990028b22b1f6adfec13a472c7f
BLAKE2b-256 61a26ae7a902c885a1fc30614b34d3779577349aa11bd24ff3c8a4842b6ffc18

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page