Skip to main content

Summer is a compartmental disease modelling framework, written in Python. It provides a high-level API to build and run models.

Project description

summer2: compartmental disease modelling in Python

Automated Tests

summer2 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:

Installation and Quickstart

This project requires at least Python 3.8

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. It is strongly recommended that you use WSL, but in instances were you are unable to do so, an unofficial build of jax can be installed by running the following command

pip install jax[cpu]==0.3.24 -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
  • 1.2.1
    • Dropped support for Python 3.7. Variety of bugfixes and expanded features, see documentation
  • 1.2.2
    • Added capture utils
    • Removed inner jit in model building to improve debugging
  • 1.2.4
    • CompartmentValues not functioning previously; include more comprehensive check in graph split
  • 1.2.5
    • Previous issue was not resolved correctly; bugfix-bugfix release
  • 1.2.6
    • Make full (comparment) outputs optional for jax runners
  • 1.2.8
    • Improve time varying functions (allow GraphObjects in x values)
  • 1.2.9
    • Derived output functions matching pandas.Series functionality (rolling, diff)
  • 1.3.0
    • Support initializing whole population via GraphObject
  • 1.3.1
    • Enforce jax minimum version in requirements
  • 1.3.2
    • Fix parameter bug in test models
  • 1.3.3
    • Fix issue with binary search for piecewise functions
  • 1.3.4
    • Update import in ode.py for changed jax API

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

summerepi2-1.3.4.tar.gz (64.9 kB view details)

Uploaded Source

Built Distribution

summerepi2-1.3.4-py3-none-any.whl (72.6 kB view details)

Uploaded Python 3

File details

Details for the file summerepi2-1.3.4.tar.gz.

File metadata

  • Download URL: summerepi2-1.3.4.tar.gz
  • Upload date:
  • Size: 64.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.13 Windows/10

File hashes

Hashes for summerepi2-1.3.4.tar.gz
Algorithm Hash digest
SHA256 8c8fd01f1f7cd6a4f381541457856f6dac44d7a3645f1023c01f819fba51204b
MD5 b80e1ff029adda171f536a6e8096946a
BLAKE2b-256 57c27ceee375da24e846cbc8287ae0b74b1a3c62d80432f7f09de2600d961d3a

See more details on using hashes here.

File details

Details for the file summerepi2-1.3.4-py3-none-any.whl.

File metadata

  • Download URL: summerepi2-1.3.4-py3-none-any.whl
  • Upload date:
  • Size: 72.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.10.13 Windows/10

File hashes

Hashes for summerepi2-1.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fb7bfa612307996ed77ae2cfb9467ccb2837b7df1e34c7498d0e78bd92a8d20e
MD5 d7f5c39ced4bd099175ee2d99bca17e6
BLAKE2b-256 af3c0381508c6a1fb4617c03aa3fecc1348fb2d8dfb2d64dd1b46fbc8b35e2a6

See more details on using hashes here.

Supported by

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