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. 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.

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-1.2.0.tar.gz (2.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

metawards-1.2.0-cp38-cp38-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.8Windows x86-64

metawards-1.2.0-cp38-cp38-manylinux1_x86_64.whl (6.7 MB view details)

Uploaded CPython 3.8

metawards-1.2.0-cp38-cp38-macosx_10_14_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.8macOS 10.14+ x86-64

metawards-1.2.0-cp37-cp37m-win_amd64.whl (1.8 MB view details)

Uploaded CPython 3.7mWindows x86-64

metawards-1.2.0-cp37-cp37m-manylinux1_x86_64.whl (6.4 MB view details)

Uploaded CPython 3.7m

metawards-1.2.0-cp37-cp37m-macosx_10_14_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.7mmacOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: metawards-1.2.0.tar.gz
  • Upload date:
  • Size: 2.3 MB
  • 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 metawards-1.2.0.tar.gz
Algorithm Hash digest
SHA256 f6af96a7592f2a5f36001bd75193fd7d1913f32bbb97203cb92478e85dc44014
MD5 ef5b73c883d54a92a3388b6a1908a7dd
BLAKE2b-256 38cf72f48d6be646fc9606926f001e03194c00f46bd4a8d624ef691279508bce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metawards-1.2.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.8 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/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for metawards-1.2.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 1ed894193998b8c7985c7d84e05f0a0616d5bdfd51a198ff4afcbdedb55ab67a
MD5 7a5b04f73a9504d27c04ebf869fcb447
BLAKE2b-256 2d6e8218f18bbff4cd8b6d6ecfbe0f0d7e88b989ca4f82a3abe2db6fffa05b54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metawards-1.2.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 6.7 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/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for metawards-1.2.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 590ea7edeccaf2882fd0c276d4bcd412bca4e8f38b40ba29990d02139468fb21
MD5 882701efa924dfa779e113e2423ff7ea
BLAKE2b-256 6c2965cbc8e88c18fd053ede50d3b60bdc23dc184106248f4b01b63781a14bd4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metawards-1.2.0-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 2.0 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/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for metawards-1.2.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 5e69429cdfc5a2cc23f1a69ba21ac8ac909f57493686f622aa946369774b1973
MD5 2aa58d9ed9d15a74150470de61761e98
BLAKE2b-256 19c5a0a3922ee2b20d0f0a39e29e4d0f9c728813b8313a9eaa8a6aa3ccf1413f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metawards-1.2.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 1.8 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/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for metawards-1.2.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 87754773a005efe5e617c9680c5e97aeeaa4df5570ce941508dea9f85dd8e011
MD5 6234e3957c340521bee8e2cbf74211e4
BLAKE2b-256 306a5813368b8af7532851291e7a03a148ef30fc6cd88d07bc1e92dcca353ce7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metawards-1.2.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 6.4 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/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for metawards-1.2.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 2c23bd868f46bb94c0cab8961a7641eccadc2960a54def1453db7d04d8137598
MD5 3c5156bf1126dc6b7dca875262be2032
BLAKE2b-256 e093d4d32ae500f3728e2544de60d21cd50176c3528b316f943eaadfbb01f797

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metawards-1.2.0-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 2.0 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/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for metawards-1.2.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 f89a8ab9612810d6627e3f02025d4d86fcabe73801ae2e3f0787df3d540cbcbc
MD5 eac4a70aa308a250727932388273eb99
BLAKE2b-256 3e44c95664cfc90c0e79b3795521a186edb7e8dce5531a3dfc33c9777cfb4c68

See more details on using hashes here.

Supported by

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