Skip to content

Latest commit

 

History

History
81 lines (62 loc) · 3.18 KB

README.md

File metadata and controls

81 lines (62 loc) · 3.18 KB

simpar

PyPI pyversions CircleCI Documentation Status codecov

simpar (SIMulate PAndemic Response) simulates the spread of a disease through a heterogeneous population using an SIR model. The groups module can be used to manage a heterogeneous population comprised of "meta-groups" with varying contact levels. The tool focuses on providing functionality for assessing pandemic response strategies such as isolation protocols, testing regimes (with varying tests), and vaccination requirements. The Strategy class is used to define a potential strategy. The Scenario class is used to manage the parameters pertaining to a scenario under which a disease is spreading. This consists of a population, environment parameters (e.g. outside rate of infection), and disease parameters (e.g. symptomatic rate). Lastly, the Trajectory class offers methods to compute metrics on a simulation of some strategy applied to a scenario. For more details, see the Documentation.

Installation

The quickest way to get started is with a pip install.

pip install simpar

Development

We welcome contributions from the community for this project! Clone the repository as follows. See Development for more details.

git clone https://github.com/cornell-covid-modeling/simpar
cd simpar
git config --local include.path ../.gitconfig

Note: The final line adds functionality for stripping Jupyter notebook output and metadata for version management.

Usage

# imports
import yaml
import numpy as np
from simpar.scenario import Scenario
from simpar.strategy import strategies_from_dictionary
from simpar.trajectory import Trajectory
import matplotlib.pyplot as plt

# load scenario and strategy
with open("example_scenario.yaml", "r") as f:
    yaml_file = yaml.safe_load(f)
    scenario = Scenario.from_dictionary(yaml_file)

with open("example_strategy.yaml", "r") as f:
    yaml_file = yaml.safe_load(f)
    strategy = strategies_from_dictionary(yaml_file, scenario.tests)["ex"]

# simulate and create trajectory
sim = scenario.simulate_strategy(strategy)
trajectory = Trajectory(scenario, strategy, sim)

See the example directory for the example scenario and strategy YAML files as well as a Jupyter notebook with the above example code.

License

Licensed under the MIT License