Summer is a compartmental disease modelling framework, written in Python. It provides a high-level API to build and run models.
Project description
Summer: compartmental disease modelling in Python
Summer is a Python-based framework for the creation and execution of compartmental (or "state-based") epidemiological models of infectious disease transmission.
It provides a range of structures for easily implementing compartmental models, including structure for some of the most common features added to basic compartmental frameworks, including:
- A variety of inter-compartmental flows (infections, transitions, births, deaths, imports)
- Force of infection multipliers (frequency, density)
- Post-processing of compartment sizes into derived outputs
- Stratification of compartments, including:
- Adjustments to flow rates based on strata
- Adjustments to infectiousness based on strata
- Heterogeneous mixing between strata
- Multiple disease strains
Some helpful links to learn more:
- Rationale for why we are building Summer
- Documentation with code examples
- Available on PyPi as
summerepi2
.
Installation and Quickstart
This project requires at least Python 3.7
Set up and activate an appropriate virtual environment, then install the summerepi2
package from PyPI
pip install summerepi2
Important note for Windows users: summerepi2 relies on the Jax framework for fast retargetable computing. This is automatically installed under Linux, OSX, and WSL environments. If you are using Windows, you can either install via WSL, or run the following command after installing
pip install jax[cpu]==0.3.14 -f https://whls.blob.core.windows.net/unstable/index.html
Then you can now use the library to build and run models. See here for some code examples.
Optional (recommended) extras
Summer has advanced interactive plotting tools built in - but they are greatly improved with the addition of the pygraphviz library.
If you are using conda, the simplest method of installation is as follows:
conda install --channel conda-forge pygraphviz
For other install methods, see https://pygraphviz.github.io/documentation/stable/install.html
Development
Poetry is used for packaging and dependency management.
Initial project setup is documented here and should work for Windows or Ubuntu, maybe for MacOS.
Some common things to do as a developer working on this codebase:
# Activate summer conda environment prior to doing other stuff (see setup docs)
conda activate summer
# Install latest requirements
poetry install
# Publish to PyPI - use your PyPI credentials
poetry publish --build
# Add a new package
poetry add
# Run tests
pytest -vv
# Format Python code
black .
isort . --profile black
Releases
Releases are numbered using Semantic Versioning
- 1.0.0/1:
- Initial release
Release process
To do a release:
- Commit any code changes and push them to GitHub
- Choose a new release number accoridng to Semantic Versioning
- Add a release note above
- Edit the
version
key inpyproject.toml
to reflect the release number - Publish the package to PyPI using Poetry, you will need a PyPI login and access to the project
- Commit the release changes and push them to GitHub (Use a commit message like "Release 1.1.0")
- Update
requirements.txt
in Autumn to use the new version of Summer
poetry build
poetry publish
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 Distribution
File details
Details for the file summerepi2-1.0.2.tar.gz
.
File metadata
- Download URL: summerepi2-1.0.2.tar.gz
- Upload date:
- Size: 60.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0 CPython/3.9.13 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 780652a27c2587c120e337ee1b0dd22fe267e4d9d924442fb85d301cbf1523b1 |
|
MD5 | 3323bf27dff3cb81261197c1a6302dd8 |
|
BLAKE2b-256 | f92bdab921243d062b358f24070eb09080bc258efdd07079dabc9d71cf90f959 |
File details
Details for the file summerepi2-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: summerepi2-1.0.2-py3-none-any.whl
- Upload date:
- Size: 71.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0 CPython/3.9.13 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8794199ce641b9bea8e1636a1c1eea37060bbaa9544c66f565fde59b3e61303a |
|
MD5 | 63e940f30616c7ca13f0c354d0198ec9 |
|
BLAKE2b-256 | 4ba64c7729f4861b45739b61a98e5e75e7a5954a6026515c03db6ca9299744cc |