CTNS, Contact Tracing Network Simulator: a tool to simulate contact tracing in a population where a disease is spreading
pip install ctns==1.0.1
Contact Tracing Network Simulator, a tool to simulate digital contact networks beetween people in a population where a disease is spreading. The simulation is highly customizable and will return (or dump) a time series of networks. We suggest to use https://gitlab.com/migliouni/ctns_visualizer to analize the results. If you prefer to interact with this library througt a web app, you can take a look to https://gitlab.com/migliouni/ctns_simulator, which provides a web interface to run simulation and some summary plots.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
The easiest way to install this library is simply run:
pip install ctns
on you terminal.
To run a simulation, you first need to import this library in your python code:
from ctns.contact_network_simulator import run_simulation
and then simply call the function run_simulation.
If you would like to launch the tool directly from Terminal/CMD, you can just type
ctns
from Linux terminal or
ctns.bat
from Windows CMD/Power Shell.
Remember to specify a path to a file for the network dump.
You can alternatively clone the repo, navigate to the ctns/ctns folder and run
python3 contact_network_simulator.py
The networks are igraph networks that will have nodes (representing people) and weighed edges (representing contacts). Each node will have the following relevant attributes:
Please note that you will find other attributes used in the simulation process.
Each edge will have a weight, representing the duration of the contact between two people and a category, that can be either family, frequent, occasional or random.