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

Summer: compartmental disease modelling in Python

Automated Tests

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

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

Installation and Quickstart

This project is tested with Python 3.6. Install the summerepi package from PyPI

pip install summerepi

Then you can use the library to build and run models. See here for some code examples.

Performance Note

You will find a significant performance improvement in the ODE solver if you set OMP_NUM_THREADS before importing summer or numpy.

# Set this in your Python script
os.environ["OMP_NUM_THREADS"] = "1"

# Do it before importing summer or numpy
import summer
# ...

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.1.0: Add stochastic integrator
  • 2.0.1:
    • Rename fractional flow to transition flow
    • Remove sojourn flow
    • Add vectorized backend and other performance improvements

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

Documentation

Sphinx is used to automatically build reference documentation for this library. The documentation is automatically built and deployed to summerepi.com whenever code is pushed to master.

To run or edit the code examples in the documentation, start a jupyter notebook server as follows:

jupyter notebook --config docs/jupyter_notebook_config.py
# Go to http://localhost:8888/tree/docs/examples in your web browser.

You can clean outputs from all the example notbooks with

./docs/scripts/clean.sh

To build and deploy

./docs/scripts/build.sh
./docs/scripts/deploy.sh

To work on docs locally

./docs/scripts/watch.sh

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

summerepi-2.0.1.tar.gz (58.8 kB view details)

Uploaded Source

Built Distribution

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

summerepi-2.0.1-py3-none-any.whl (75.2 kB view details)

Uploaded Python 3

File details

Details for the file summerepi-2.0.1.tar.gz.

File metadata

  • Download URL: summerepi-2.0.1.tar.gz
  • Upload date:
  • Size: 58.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.6.13 Windows/10

File hashes

Hashes for summerepi-2.0.1.tar.gz
Algorithm Hash digest
SHA256 0a4041a8ee1b4ae38cbe72a4ca059e782269f4054f34014e2c00907ad89e7a82
MD5 2c3e17afaf5c0287b52865725f3e6a18
BLAKE2b-256 e47447b4e01ede708ba3b13d3c721f57342ef4c42994338ca9fb4735b8852525

See more details on using hashes here.

File details

Details for the file summerepi-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: summerepi-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 75.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.5 CPython/3.6.13 Windows/10

File hashes

Hashes for summerepi-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef9c952fbf7d334b0ec39aefb10cc239e7ac33cc19616ddda82a73315abe407d
MD5 4322b8efd49bc1171e52bacfadeb6db2
BLAKE2b-256 10e1baea987daf63eb7d7f3f223d544924320d1b8bcf6945aeb848249d9a5184

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