Skip to main content

MetaWards

Build status PyPI version Downloads DOI DOI

Scientific Background

MetaWards implements a stochastic metapopulation model of disease transmission. It can scale from modelling local transmission up to full national- or international-scale metapopulation models.

Please follow the quick start guide to see how to quickly get up and running using MetaWards to model your own custom disease or metapopulation model.

It is was originally developed to support modelling of disease transmission in Great Britain. The complete model description and the original C code are described here;

  • "The role of routine versus random movements on the spread of disease in Great Britain", Leon Danon, Thomas House, Matt J. Keeling, Epidemics, December 2009, 1 (4), 250-258; DOI:10.1016/j.epidem.2009.11.002

  • "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

In this model, the population is divided into electoral wards. Disease transmission between wards occurs via the daily movement of individuals. For each ward, individuals contribute to the force of infection (FOI) in their home ward during the night, and their work ward during the day.

This model was recently adapted to model CoVID-19 transmission in England and Wales, with result of the original C code published here;

  • "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, Philosophical Transactions of the Royal Society B, 376(1829); DOI:10.1098/rstb.2020.0272

This Python code is a port which can identically reproduce the outputs from the original C code as used in that work. This Python code has been optimised and parallelised, with additional testing added to ensure that development and scale-up of MetaWards has been robustly and efficiently conducted.

Program Info

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.

Installation

Full installation instructions are here.

Binary packages are uploaded to pypi for Windows, OS X and Linux (manylinux). The easiest way to install is to type in the console:

pip install metawards

(this assumes that you have pip installed and are using Python 3.7 or above - if this doesn't work please follow the full installation instructions).

Alternatively, you can also install from within R (or RStudio) by typing;

library(devtools)
install_github("metawards/rpkg")
metawards::py_install_metawards()

But, as you are here, I guess you want to install the latest code from GitHub ;-)

To do that, first clone and install the requirements;

git clone https://github.com/metawards/MetaWards
cd MetaWards
pip install -r requirements.txt
pip install -r requirements-dev.txt

Next, you can make using the standard Python setup.py script route.

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

or you can type

make test

You can generate the docs using

make doc

Running

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.

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.

Note that mpi4py and scoop are not installed by default, so you will need to install them before you run on a cluster (e.g. pip install mpi4py or pip install scoop).

Full instructions for running on a cluster are here

History

This is a Python port of the MetaWards package originally written by Leon Danon. This port has been performed with Leon's support by the Bristol Research Software Engineering Group.

Release files for metawards 1.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metawards 1.6.2
File Size Uploaded
metawards-1.6.2.tar.gz 2.7 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for metawards 1.6.2
File
metawards-1.6.2-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
metawards-1.6.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.5+ x86-64 Details
metawards-1.6.2-cp39-cp39-macosx_10_15_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.15+ x86-64 Details
metawards-1.6.2-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
metawards-1.6.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details
metawards-1.6.2-cp38-cp38-macosx_10_14_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.14+ x86-64 Details
metawards-1.6.2-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
metawards-1.6.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
metawards-1.6.2-cp37-cp37m-macosx_10_14_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64 Details

Total release size: 39.2 MB

Release files / metawards-1.6.2.tar.gz

Download URL metawards-1.6.2.tar.gz
Size 2.7 MB
Tags Source
SHA-256 checksum
How to use checksums
1e5ba67ce860816aad5f508fe66c00260f3c8d475d84fe904d7648d9d9b47bbb
BLAKE2b-256 checksum
How to use checksums
048d188278c5a19549c16765599f87e08d24eea311dcbea6e9b97a2dd9cdb30c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release files / metawards-1.6.2-cp39-cp39-win_amd64.whl

Download URL metawards-1.6.2-cp39-cp39-win_amd64.whl
Size 2.2 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
50cb548fef267c9df4f3654d7082919818c003023842b4d985c5d5c2cde6b37a
BLAKE2b-256 checksum
How to use checksums
8588107b5c9810f4105cd6bd42579a6d92e8fb9084f22f86d6362b6032b1d232
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release files / metawards-1.6.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl

Download URL metawards-1.6.2-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Size 7.3 MB
Tags CPython 3.9 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
bb1411cf555a00cd03a956da4a8d5f5691750e6af84cf6cbaf632e2480f851de
BLAKE2b-256 checksum
How to use checksums
a50fb789d32b5e4c92857783ecb7d4717473fe49f1b1f5c56f00da934b32c5da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release files / metawards-1.6.2-cp39-cp39-macosx_10_15_x86_64.whl

Download URL metawards-1.6.2-cp39-cp39-macosx_10_15_x86_64.whl
Size 2.4 MB
Tags CPython 3.9 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
fb632729e0682cdc7880ab9e7b2f6c1b140ab16fca0b02b76e5545150cea279d
BLAKE2b-256 checksum
How to use checksums
0bfb9557a6f40ae4a4ebc9a4002b8f2cedc189d488d06b331a1ff811615dd03e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release files / metawards-1.6.2-cp38-cp38-win_amd64.whl

Download URL metawards-1.6.2-cp38-cp38-win_amd64.whl
Size 2.2 MB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
85aabe84c27c542ebbf9a063ab17db1c50e7d4271858105d0eb1f78c9a009ac9
BLAKE2b-256 checksum
How to use checksums
f9e3178c6a683cf953b6683290254b2dad754c18406b71af3d63f262694a98c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release files / metawards-1.6.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl

Download URL metawards-1.6.2-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Size 7.9 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
6cc12c924633d8f2de6c44074b5286394dd05c61e0712de896444d2c9d2accfd
BLAKE2b-256 checksum
How to use checksums
3c8bec2edadec156c5652a0c83cbcf1e7541a9edfc9b22ded36251569f712e30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release files / metawards-1.6.2-cp38-cp38-macosx_10_14_x86_64.whl

Download URL metawards-1.6.2-cp38-cp38-macosx_10_14_x86_64.whl
Size 2.4 MB
Tags CPython 3.8 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
ab7c5b5b281aa82d6b3d97459d015ce812e4485a8ea2967cba8c8ac6685e3d02
BLAKE2b-256 checksum
How to use checksums
756ab3d74081a97fd597a69162f98e13c7a30b31035347c459145dad5766de32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release files / metawards-1.6.2-cp37-cp37m-win_amd64.whl

Download URL metawards-1.6.2-cp37-cp37m-win_amd64.whl
Size 2.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
0880dba45fefa00c7fe6281a833bd23f21346bf37bd03c7ad029c95b5d8c313e
BLAKE2b-256 checksum
How to use checksums
99a321593665cce79e762e90847e4da26ccaa3327cf98014dbd09cb9b956c52a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release files / metawards-1.6.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl

Download URL metawards-1.6.2-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Size 7.5 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
fe5c20eff110287fb5f962bb9d096dec6704280d4490a34a7cf0266bd10b554f
BLAKE2b-256 checksum
How to use checksums
34f7c483d4996163ae0534ee3d4c6ee3f124447f1d492477afac59ac7e930560
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12

Release files / metawards-1.6.2-cp37-cp37m-macosx_10_14_x86_64.whl

Download URL metawards-1.6.2-cp37-cp37m-macosx_10_14_x86_64.whl
Size 2.4 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
e15a051aac8540a660b0bd6f7d8fd5bc3624bfe652ffa934609d263db3c1a35d
BLAKE2b-256 checksum
How to use checksums
2171e0ec9f5aa3066d6b89150d3474230da642d95ab26dcef7ad8f416aa9f7c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page