Skip to main content

MetaWards disease metapopulation modelling

Project description

MetaWards

Build status PyPI version PyPI Downloads GitHub commit activity License

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;

  1. Set the METAWARDSDATA environment variable to point to this directory, e.g. export METAWARDSDATA=$HOME/GitHub/MetaWards

  2. Pass the repository variable to the input data classes Disease, InputFiles and Parameters

  3. 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, and requires no other dependencies to install. For development you will need cython 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.

Full instructions for running on a cluster are here

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

metawards-0.12.0.tar.gz (2.0 MB view details)

Uploaded Source

Built Distributions

metawards-0.12.0-cp38-cp38-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.8 Windows x86-64

metawards-0.12.0-cp38-cp38-manylinux1_x86_64.whl (5.5 MB view details)

Uploaded CPython 3.8

metawards-0.12.0-cp38-cp38-macosx_10_14_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

metawards-0.12.0-cp37-cp37m-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.7m Windows x86-64

metawards-0.12.0-cp37-cp37m-manylinux1_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.7m

metawards-0.12.0-cp37-cp37m-macosx_10_14_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

File details

Details for the file metawards-0.12.0.tar.gz.

File metadata

  • Download URL: metawards-0.12.0.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.6

File hashes

Hashes for metawards-0.12.0.tar.gz
Algorithm Hash digest
SHA256 3c83d7d6ea9bd04f3b729f0ba23b31febb6619c06626e5b89f87210f51a12f6e
MD5 6211d1972f612a484a33176072720389
BLAKE2b-256 b3632a1f30f3e15a8d7ecbf6a65431a04dcc09407982c265ee48d0c696db3dd9

See more details on using hashes here.

File details

Details for the file metawards-0.12.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: metawards-0.12.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.6

File hashes

Hashes for metawards-0.12.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 502eaf1445cc7b18d52c9a2c4a2934b21a4801bfe9802bddf70d57ef90187f3e
MD5 ac9bdbcd4ee4a315b6c7e9e9e1a7a4d8
BLAKE2b-256 28f339843a6ef79fdb047a2fa992646ee2c63f78988a1e0169031191e24fd22f

See more details on using hashes here.

File details

Details for the file metawards-0.12.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: metawards-0.12.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 5.5 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.6

File hashes

Hashes for metawards-0.12.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4ebb7c5c090f67609c979caad78739a2e30233a89bc7da88ee0706b7be3373ff
MD5 1caf8ab4ebb8540fedafbfcaa2553956
BLAKE2b-256 2ace1837c93ae511f151d0e05743114a60f737e1b425c69590a45f60a30e47b6

See more details on using hashes here.

File details

Details for the file metawards-0.12.0-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: metawards-0.12.0-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.6

File hashes

Hashes for metawards-0.12.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 2ccb1e95f246b9b24fda0c49c90bdf4bb33c888c7c03c713002a5a6c85ed8dfe
MD5 42aaf1810dacf0e9513ac68e937016d9
BLAKE2b-256 e6d94e37d5a15c4452a679fa0f48667809d081ecc336c56dec80ac169e11ca64

See more details on using hashes here.

File details

Details for the file metawards-0.12.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: metawards-0.12.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.6

File hashes

Hashes for metawards-0.12.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 782cd9038e1ed23aa7bc3e838dbf59cc6aeecca040997df4a05cd331f7de71d8
MD5 ef6539ddcbe1f368c62e1a8b07b34bb3
BLAKE2b-256 b39999a3e8ce85e81d9faa330e8113f18259d4f7db8c7af5af9bfafbb23cd827

See more details on using hashes here.

File details

Details for the file metawards-0.12.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: metawards-0.12.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 5.3 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.6

File hashes

Hashes for metawards-0.12.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 19a9855679b88e1025fdf5e02844844e5d0316d3ba2cb1c9d8747622f54c4078
MD5 e2edffc6da7bdebf64872fffa8f11a8c
BLAKE2b-256 8f9d05a9337fd132f73d775e6f1549d1137329a3337fc6542ae5c0ff9da613fa

See more details on using hashes here.

File details

Details for the file metawards-0.12.0-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: metawards-0.12.0-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.6

File hashes

Hashes for metawards-0.12.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 f0b40389e5dc8ddd07d3879f9fb11fe384add25e872de17724c826806e3108e9
MD5 112c5908d18591b73f96812907f18d85
BLAKE2b-256 59ae555222b46bf7e6a85d99f36ee021818ddbcfd0b4decf07443a51123f0b3d

See more details on using hashes here.

Supported by

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