GithubHelp home page GithubHelp logo

riddhitanna / testing-strategies Goto Github PK

View Code? Open in Web Editor NEW

This project forked from qykong/testing-strategies

0.0 0.0 0.0 53 KB

Code for paper "Contact Tracing: Computational Bounds, Limitations and Implications"

License: MIT License

Python 81.34% R 18.66%

testing-strategies's Introduction

Epidemic simulations and testing

This repository hosts source code for the paper submission "Contact Tracing: Computational Bounds, Limitations and Implications". The code can be used to simulate compartmental epidemic models over random networks. The simulation code was originally from this work with modifications for including tracing and testing of epidemics.

Quick tour

We implement some parts of the simulation code in Cython in order to leverage its high performance. For this reason, before running the simualtions, you would need to compile the Cython scripts first.

python pyscripts/setup.py build_ext --inplace

After this, we will be able to run the main.py. Here is an example

python3 main.py -pf parameters/abstract/SIR_with_Ho.json -num_tracers 100 -nI 10 -oracle_type forward -rate_I2R 0.0475 -rate_I2Ho 0.0025 -pCT 1 -seed 190 -simIts 50 -nxIts 10 -pQ 1 -pRT 1 -N 10000 -parallel 1  -return_full_data True -save_limited_data False -nt er -np '{"p_without_N": 2.708333}' -rate_IS2II 0.6

where p_without_N=R0/(beta/(beta+gamma)). This command runs SIR simulations with standard forward contact tracing and given parameters. Here's a quick look at the output of this simulations

This file will be used: parameters/abstract/SIR_with_Ho.json
An abstract model file is provided.
The following parameters will be applied:
{'nI': 10, 'maxdays': 1000, 'N': 10000, 'pC2T': 1.0, 'pQ': 1.0, 'pCT': 1.0, 'pRT': 1.0, 'tlist_size': 0, 'type': 'abstract', 'p2bCTs': {'S': 1.0, 'I': 1.0, 'R': 1.0, 'Ho': 0}, 'p2bRTs': {'S': 1.0, 'I': 1.0, 'R': 1.0, 'Ho': 0}, 'positive_instantaneous': ['Ho'], 'positive_induced': ['I'], 'to_trace_instantaneous': ['I'], 'recovered': ['R', 'Ho'], 'infected': ['I'], 'return_statuses': ('S', 'I', 'R', 'Ho'), 'gH': <networkx.classes.digraph.DiGraph object at 0x7fb12860f2e0>, 'J': <networkx.classes.digraph.DiGraph object at 0x7fb12860f190>, 'required_rates': ['rate_I2R', 'rate_IS2II', 'rate_I2Ho'], '_comment1': 'From paper: Estimation of the Basic Reproduction Number of Novel Influenza A (H1N1) pdm09 in Elementary Schools Using the SIR Model', '_comment2': 'reported R0: 1.33', 'seed': 190, 'network_type': 'er', 'network_params': '{"p_without_N": 2.708333}', 'oracle_type': 'forward', 'num_tracers': 100, 'nxIts': 10, 'simIts': 50, 'return_full_data': True, 'parallel': True, 'num_nodes': 0, 'reintroduction_nums': 0, 'rate_I2R': 0.0475, 'rate_IS2II': 0.6, 'rate_I2Ho': 0.0025}
Using random seed: 190
Start simulating loops...

Average Ratio of total infected 0.9522613211219033
Average Ratio of max infected 0.7308121562051657
Average Days to Epidemic End 24.535519080909193
Average Ratio of quarantined 0.23671631519437236
No secondary infection counted
Average Ratio of Positive Contact Tracing 0.20283854098340812
Average Ratio of Positive Random Tracing 0.007462874786371902

A complete list of arguments that are avaialbe from main.py can be found with python3 main.py -pf parameters/abstract/SIR_with_Ho.json -h.

usage: main.py [-h] [-seed SEED] [-nt NETWORK_TYPE] [-np NETWORK_PARAMS] [-oracle_type ORACLE_TYPE] [-num_tracers NUM_TRACERS] [-nxIts NXITS] [-simIts SIMITS] [-of OF] [-return_full_data RETURN_FULL_DATA]
               [-parallel PARALLEL] [-num_nodes NUM_NODES] [-pC2T PC2T] [-pQ PQ] [-pCT PCT] [-pRT PRT] [-tlist_size TLIST_SIZE] [-nI NI] [-maxdays MAXDAYS] [-N N] -rate_I2R RATE_I2R -rate_IS2II RATE_IS2II -rate_I2Ho
               RATE_I2HO

optional arguments:
  -h, --help            show this help message and exit
  -seed SEED            seed (if not specified seed is random
  -nt NETWORK_TYPE, --network-type NETWORK_TYPE
                        specify the network simulator to use
  -np NETWORK_PARAMS, --network-params NETWORK_PARAMS
                        specify the network parameter to use
  -oracle_type ORACLE_TYPE
                        type of oracle to use, one of "backward", "forward", "oracletracer", "globaloracle", "random"
  -num_tracers NUM_TRACERS
                        number of tracers
  -nxIts NXITS          number of iterations of random networks
  -simIts SIMITS        number of simulations per random network
  -of OF                path to the file to save results
  -return_full_data RETURN_FULL_DATA
                        Determine if individual transimissions are tracked (This will introduce additional computational overhead)
  -parallel PARALLEL    Run simulation in parallel.
  -num_nodes NUM_NODES  number of first set of nodes selected for computing secondary infections
  -pC2T PC2T
  -pQ PQ
  -pCT PCT
  -pRT PRT
  -tlist_size TLIST_SIZE
  -nI NI
  -maxdays MAXDAYS
  -N N
  -rate_I2R RATE_I2R
  -rate_IS2II RATE_IS2II
  -rate_I2Ho RATE_I2HO

testing-strategies's People

Contributors

qykong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.