MetaWards disease metapopulation modelling
Project description
MetaWards
For the most accurate and up to date information please visit the project website.
This is a Python port of the MetaWards package originally written by Leon Danon. The port is kept in sync with the original C code, with checks in place to ensure that the two codes give identical results. This improves the robustness of both codes, as it minimises the footprint to bugs that can evade both C and Python.
The aim of this port is to make it easier for others to contribute to the program, to improve robustness by adding in unit and integration test, and to also open up scope for further optimisation and parallelisation.
The package makes heavy use of cython which is used with OpenMP to compile bottleneck parts of the code to parallelised C. This enables this Python port to run at approximately the same speed as the original C program on one core, and to run several times faster across multiple cores.
The program compiles on any system that has a working C compiler that supports OpenMP, and a working Python >= 3.7. This include X86-64 and ARM64 servers.
The software supports running over a cluster using MPI (via mpi4py) or via simple networking (via scoop).
Full instructions on how to use the program, plus example job submission scripts can be found on the project website.
Data
The data and input parameters needed to use this package are stored in the MetaWardsData repository. Please make sure that you clone this repository to your computer and supply the full path to that repository to the program when it runs. There are three ways to do this;
-
Set the
METAWARDSDATA
environment variable to point to this directory, e.g.export METAWARDSDATA=$HOME/GitHub/MetaWards
-
Pass the
repository
variable to the input data classes Disease, InputFiles and Parameters -
Or simply make sure you clone into the directory
$HOME/GitHub/MetaWardsData
as this is the default path.
References
These are the references behind the original C code are;
-
"Individual identity and movement networks for disease metapopulations" Matt J. Keeling, Leon Danon, Matthew C. Vernon, Thomas A. House Proceedings of the National Academy of Sciences May 2010, 107 (19) 8866-8870; DOI: 10.1073/pnas.1000416107
-
"A spatial model of CoVID-19 transmission in England and Wales: early spread and peak timing" Leon Danon, Ellen Brooks-Pollock, Mick Bailey, Matt J Keeling medRxiv 2020.02.12.20022566; doi: 10.1101/2020.02.12.20022566
Dependencies
The code requires Python 3.7 or above. For development you will need cython and a working C compiler to build the code, plus pytest for running the tests.
Installation
Full installation instructions are here.
As you are here, I guess you want to install the latest code from GitHub ;-)
To do that, type;
git clone https://github.com/metawards/MetaWards
cd MetaWards
pip install -r requirements-dev.txt
CYTHONIZE=1 python setup.py build
CYTHONIZE=1 python setup.py install
Alternatively, you can also use the makefile, e.g.
make
make install
(assuming that python
is version 3.7 or above)
You can run tests using pytest, e.g.
METAWARDSDATA="/path/to/MetaWardsData" pytest tests
You can generate the docs using
make docs
Running
Full usage instructions are here
You can either load and use the Python classes directly, or you can
run the metawards
front-end command line program that is automatically installed.
metawards --help
will print out all of the help for the program. For example;
metawards --input tests/data/ncovparams.csv --seed 15324 --nsteps 30 --nthreads 1
This will duplicate the run of the MetaWards C program that is bundled in this repository that was run using;
./original/metawards 15324 tests/data/ncovparams.csv 0 1.0
The original C code, command line and expected output are in the original directory that is bundled in this repo.
Running an ensemble
This program supports parallel running of an ensemble of jobs using multiprocessing for single-node jobs, and mpi4py or scoop for multi-node cluster jobs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for metawards-1.1.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd3236a43c241dc21e0afba291c6c7ce6172b9dd80a4e2d21ddaf95f703ce754 |
|
MD5 | 63fe8fb94d7b40776f1a05efbfda92a7 |
|
BLAKE2b-256 | 48be39f0a96bcab93666edc08a9961d04d7cc446fc51223aafb118028d55a26f |
Hashes for metawards-1.1.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78fd3661502f0054b529a6feeaa15d8ee6fa9be9c7a9805b545502ce106cd215 |
|
MD5 | 3da7856b21b280f7e6832529e9079661 |
|
BLAKE2b-256 | 6086f4f00787552733b26d77d0a62f18da74b828acb708c92662f5473755996f |
Hashes for metawards-1.1.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af34ee61d39148b75279314ddbc08408cb78decf224546aa50feeecdeb52b6c4 |
|
MD5 | b2813ed0452893d3e9447b481214967d |
|
BLAKE2b-256 | 07dfd02008ae106080cbae2a15045ef69c7ed5cce475854337d96b680ad84430 |
Hashes for metawards-1.1.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35b7b598a8e0f9b9603a262e96a6143727199cd8a5c3a692dd609fd187c4e011 |
|
MD5 | 303808d75582df28363fdeb95003810f |
|
BLAKE2b-256 | d997719982e6b848d5b7e5c9fc6a961a5c596a515df46ec551dc8caf37d0acb8 |
Hashes for metawards-1.1.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2340df6494082a4822d9b250273136a912123d534b187f40ded4a2a46cd1c0be |
|
MD5 | 1bf99b1e54faf495ee1f8924017a6212 |
|
BLAKE2b-256 | e93b8fc1e33a84cc5893c17d50571ad5d2312b5bb468e3c7b634006aece5b409 |
Hashes for metawards-1.1.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 258217ca95ee7b46456b05118fc76b3068d21ce5ae3555a702bc59622a4a081d |
|
MD5 | 82084006805a9933b28b5c4e74fc4474 |
|
BLAKE2b-256 | 2ac3edfe4bd141de13a85d782d760b5a33259fe1a2273393f91662607bc7fbb3 |