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 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, sojourn, fractional, 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
Documentation here with code examples.
Available on PyPi as summerepi
.
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 examples:
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. You will need to install poetry to work on this codebase. Some common things to do as a developer working on this codebase:
# Install requirements
poetry config virtualenvs.in-project true
poetry shell
poetry install
# Get a virtualenv for running other stuff
poetry shell
# Publish to PyPI - use your PyPI credentials
poetry publish --build
# Add a new package
poetry add
# Run tests
poetry shell
pytest -vv
# Format Python code
black .
Releases
TODO
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 build and deploy
./docs/scripts/build.sh
./docs/scripts/deploy.sh
To work on docs locally
# ./docs/scripts/watch.sh # FIXME - endless recursion
./docs/scripts/build.sh
# In a separate terminal
./docs/scripts/serve.sh
# Visit http://localhost:8000/
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
Hashes for summerepi-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bfb8045493ba85f9274cfb1b087d506e6da73a9cb3d7dca4e8aa31a40b150520 |
|
MD5 | 40358ce4c56084a64996524ecf1d2705 |
|
BLAKE2b-256 | 91f26d14995444bcedc7908d1f35b074c207e4c557dd5741e25d42cdeebbfab8 |