Skip to content

Commit bb917fd

Browse files
committed
merge model support
2 parents 6b6da81 + 3b7f586 commit bb917fd

20 files changed

Lines changed: 1977 additions & 89 deletions

.github/workflows/python-package.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
19+
python-version: ["3.9", "3.10", "3.11"]
2020

2121
steps:
2222
- uses: actions/checkout@v3
@@ -27,8 +27,8 @@ jobs:
2727
- name: Install dependencies
2828
run: |
2929
python -m pip install --upgrade pip
30-
python -m pip install flake8 pytest
31-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
30+
python -m pip install flake8 pytest poetry
31+
poetry install
3232
- name: Lint with flake8
3333
run: |
3434
# stop the build if there are Python syntax errors or undefined names
@@ -37,4 +37,4 @@ jobs:
3737
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
3838
- name: Test with pytest
3939
run: |
40-
pytest tests/test_*
40+
poetry run pytest tests/test_*

docs/conf.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import os
2+
import sys
3+
4+
sys.path.insert(0, os.path.abspath("../src/epidemik/"))
5+
import epidemik
6+
7+
# Configuration file for the Sphinx documentation builder.
8+
#
9+
# For the full list of built-in configuration values, see the documentation:
10+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
11+
12+
# -- Project information -----------------------------------------------------
13+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
14+
15+
project = "epidemik"
16+
copyright = "2024, Bruno Gonçalves"
17+
author = "Bruno Gonçalves"
18+
release = epidemik.__version__
19+
20+
# -- General configuration ---------------------------------------------------
21+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
22+
23+
extensions = [
24+
"sphinx_rtd_theme",
25+
"sphinx.ext.duration",
26+
"sphinx.ext.doctest",
27+
"sphinx.ext.autodoc",
28+
"sphinx.ext.autosummary",
29+
]
30+
31+
templates_path = ["_templates"]
32+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
33+
34+
35+
# -- Options for HTML output -------------------------------------------------
36+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
37+
38+
html_theme = "sphinx_rtd_theme"
39+
html_static_path = ["_static"]
40+
html_theme_options = {
41+
"analytics_id": "G-HKWS10TRJ1",
42+
"analytics_anonymize_ip": False,
43+
"logo_only": False,
44+
"display_version": True,
45+
"prev_next_buttons_location": "bottom",
46+
"style_external_links": True,
47+
"vcs_pageview_mode": "",
48+
"style_nav_header_background": "white",
49+
# Toc options
50+
"collapse_navigation": True,
51+
"sticky_navigation": True,
52+
"navigation_depth": 4,
53+
"includehidden": True,
54+
"titles_only": False,
55+
}

models/SEIIR.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Epidemic Model with 5 compartments and 6 transitions:
2+
Name: SEIIR
3+
4+
Parameters:
5+
rate : 0.166667
6+
beta : 0.222222
7+
epsilon_a : 0.160000
8+
epsilon_s : 0.240000
9+
mu : 0.100000
10+
11+
12+
Transitions:
13+
- S + Ia = E rate
14+
- S + Is = E beta
15+
- E -> Ia epsilon_a
16+
- E -> Is epsilon_s
17+
- Ia -> R mu
18+
- Is -> R mu
19+
20+
# R0=2.00

models/SEIIRD.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Epidemic Model with 6 compartments and 7 transitions:
2+
Name: SEIIRD
3+
4+
Parameters:
5+
rbeta : 0.166667
6+
beta : 0.222222
7+
epsilon_a : 0.160000
8+
epsilon_s : 0.240000
9+
mu : 0.100000
10+
mu_nd : 0.090000
11+
mu_d : 0.010000
12+
13+
14+
Transitions:
15+
- S + Ia = E rbeta
16+
- S + Is = E beta
17+
- E -> Ia epsilon_a
18+
- E -> Is epsilon_s
19+
- Ia -> R mu
20+
- Is -> R mu_nd
21+
- Is -> D mu_d
22+
23+
# R0=2.00

models/SEIR.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Epidemic Model with 4 compartments and 3 transitions:
2+
Name: SEIR
3+
4+
Parameters:
5+
beta : 0.200000
6+
epsilon : 0.400000
7+
mu : 0.100000
8+
9+
10+
Transitions:
11+
- S + I = E beta
12+
- E -> I epsilon
13+
- I -> R mu
14+
15+
# R0=2.00

models/SEIRS.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Epidemic Model with 4 compartments and 4 transitions:
2+
Name: SEIRS
3+
4+
Parameters:
5+
beta : 0.200000
6+
epsilon : 0.400000
7+
mu : 0.100000
8+
rho : 0.300000
9+
10+
11+
Transitions:
12+
- S + I = E beta
13+
- E -> I epsilon
14+
- I -> R mu
15+
- R -> S rho

models/SI.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Epidemic Model with 2 compartments and 1 transitions:
2+
3+
Parameters:
4+
beta : 0.200000
5+
6+
7+
Transitions:
8+
- S + I = I beta

models/model_list.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SEIIR.yaml
2+
SEIIRD.yaml
3+
SEIR.yaml
4+
SEIRS.yaml
5+
SI.yaml
6+
SIR.yaml

poetry.lock

Lines changed: 1244 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ authors = [
77
]
88
description = "A package to simulate compartmental epidemic models"
99
readme = "README.md"
10-
requires-python = ">=3.8"
10+
requires-python = ">=3.9"
1111
classifiers = [
1212
"Programming Language :: Python :: 3",
1313
"License :: OSI Approved :: MIT License",
@@ -20,7 +20,9 @@ dependencies = [
2020
"pandas>=2.0",
2121
"scipy>=1.7",
2222
"tqdm>=4",
23-
"pyyaml (>=6.0.2,<7.0.0)"
23+
"pyyaml (>=6.0.2,<7.0.0)",
24+
"seaborn (>=0.13.2,<0.14.0)",
25+
"scikit-learn (>=1.6.1,<2.0.0)",
2426
]
2527
[project.urls]
2628
Homepage = "https://github.com/DataForScience/epidemik"
@@ -30,8 +32,12 @@ Documentation = "https://epidemik.readthedocs.io/"
3032
[tool.poetry-dynamic-versioning]
3133
enable = true
3234

35+
[tool.poetry.group.dev.dependencies]
36+
pytest = "^8.3.4"
37+
pytest-cov = "^6.0.0"
38+
3339
[build-system]
34-
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
40+
requires = ["poetry-core>=2.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
3541
build-backend = "poetry_dynamic_versioning.backend"
3642

3743
[tool.poetry-dynamic-versioning.from-file]
@@ -40,4 +46,4 @@ source = "src/epidemik/__init__.py"
4046
[tool.pytest.ini_options]
4147
pythonpath = [
4248
".", "src",
43-
]
49+
]

0 commit comments

Comments
 (0)