patchsim 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. patchsim-0.1.0/.gitignore +188 -0
  2. patchsim-0.1.0/CHANGELOG.md +69 -0
  3. patchsim-0.1.0/CITATION.cff +29 -0
  4. patchsim-0.1.0/LICENSE +674 -0
  5. patchsim-0.1.0/PKG-INFO +917 -0
  6. patchsim-0.1.0/README.md +186 -0
  7. patchsim-0.1.0/pyproject.toml +117 -0
  8. patchsim-0.1.0/src/patchsim/__init__.py +27 -0
  9. patchsim-0.1.0/src/patchsim/calibration.py +834 -0
  10. patchsim-0.1.0/src/patchsim/cli.py +393 -0
  11. patchsim-0.1.0/src/patchsim/core/__init__.py +0 -0
  12. patchsim-0.1.0/src/patchsim/core/expressions.py +144 -0
  13. patchsim-0.1.0/src/patchsim/core/model.py +362 -0
  14. patchsim-0.1.0/src/patchsim/core/model_runner.py +44 -0
  15. patchsim-0.1.0/src/patchsim/core/simulation.py +878 -0
  16. patchsim-0.1.0/src/patchsim/models/__init__.py +1 -0
  17. patchsim-0.1.0/src/patchsim/sensitivity.py +420 -0
  18. patchsim-0.1.0/src/patchsim/templates/models/seir.yaml +10 -0
  19. patchsim-0.1.0/src/patchsim/templates/models/sir.yaml +8 -0
  20. patchsim-0.1.0/src/patchsim/templates/models/sirs.yaml +10 -0
  21. patchsim-0.1.0/src/patchsim/templates/models/sis.yaml +8 -0
  22. patchsim-0.1.0/src/patchsim/templates/project/config.yaml +33 -0
  23. patchsim-0.1.0/src/patchsim/templates/project/data/networks/network-static.csv +5 -0
  24. patchsim-0.1.0/src/patchsim/templates/project/data/patch/patch-population.csv +3 -0
  25. patchsim-0.1.0/src/patchsim/templates/project/data/seeds/seed-initial.csv +3 -0
  26. patchsim-0.1.0/src/patchsim/templates/project/output/.gitkeep +0 -0
  27. patchsim-0.1.0/src/patchsim/utils/__init__.py +0 -0
  28. patchsim-0.1.0/src/patchsim/utils/geo.py +527 -0
  29. patchsim-0.1.0/src/patchsim/utils/loader.py +6 -0
  30. patchsim-0.1.0/src/patchsim/utils/logger.py +76 -0
  31. patchsim-0.1.0/src/patchsim/utils/viz.py +65 -0
@@ -0,0 +1,188 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ *.vscode
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ build/
14
+ develop-eggs/
15
+ dist/
16
+ downloads/
17
+ eggs/
18
+ .eggs/
19
+ lib/
20
+ lib64/
21
+ parts/
22
+ sdist/
23
+ var/
24
+ wheels/
25
+ pip-wheel-metadata/
26
+ share/python-wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py,cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ pytest_cache/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ target/
79
+
80
+ # Jupyter Notebook
81
+ .ipynb_checkpoints
82
+
83
+ # IPython
84
+ profile_default/
85
+ ipython_config.py
86
+
87
+ # pyenv
88
+ # .python-version is tracked for CI reproducibility
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
98
+ __pypackages__/
99
+
100
+ # Celery stuff
101
+ celerybeat-schedule
102
+ celerybeat.pid
103
+
104
+ # SageMath parsed files
105
+ *.sage.py
106
+
107
+ # Environments
108
+ .env
109
+ .venv
110
+ env/
111
+ venv/
112
+ ENV/
113
+ env.bak/
114
+ venv.bak/
115
+ .venv/
116
+
117
+ # Spyder project settings
118
+ .spyderproject
119
+ .spyproject
120
+
121
+ # Rope project settings
122
+ .ropeproject
123
+
124
+ # mkdocs documentation
125
+ /site
126
+
127
+ # mypy
128
+ .mypy_cache/
129
+ .dmypy.json
130
+ dmypy.json
131
+
132
+ # Pyre type checker
133
+ .pyre/
134
+ **__pycache__
135
+ **/__pycache__/
136
+
137
+ # PyCharm
138
+ .idea/
139
+
140
+ # RStudio project files
141
+ **.Rproj.user/
142
+ **.Rproj.user*
143
+ **.Rproj
144
+ **.Rhistory
145
+
146
+ # MacOS
147
+ .DS_Store
148
+
149
+ # Data file types
150
+ *.csv
151
+ *.txt
152
+ *.xlsx
153
+ output/**
154
+
155
+ # Keep package template scaffold files tracked
156
+ !src/patchsim/templates/project/data/
157
+ !src/patchsim/templates/project/data/networks/
158
+ !src/patchsim/templates/project/data/networks/*.csv
159
+ !src/patchsim/templates/project/data/patch/
160
+ !src/patchsim/templates/project/data/patch/*.csv
161
+ !src/patchsim/templates/project/data/seeds/
162
+ !src/patchsim/templates/project/data/seeds/*.csv
163
+ !src/patchsim/templates/project/output/.gitkeep
164
+
165
+ # Additions for GeoJSON, .zip files, and shapefiles
166
+ *.geojson
167
+ *.zip
168
+ *.shp
169
+ *.shx
170
+ *.dbf
171
+ *.prj
172
+
173
+ # Added entries for pytest cache, venv, pdm-build, and other relevant directories
174
+ .pdm-build/
175
+
176
+ # Exception for .png files in assets/
177
+ !assets/*.png
178
+
179
+ # Allow tracked data CSVs
180
+ !data/
181
+ !data/networks/
182
+ !data/networks/*.csv
183
+
184
+ !data/patch/
185
+ !data/patch/*.csv
186
+
187
+ !data/seeds/
188
+ !data/seeds/*.csv
@@ -0,0 +1,69 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.1.0] - 2026-08-22
6
+
7
+ ### Added
8
+
9
+ - Configuration-selectable adaptive ODE and deterministic explicit-Euler solvers that
10
+ share reporting grids and derivative logic.
11
+ - Validated distance- and gravity-based spatial contact generation with explicit units,
12
+ normalization settings, and a physical-validation report.
13
+ - Generic within-patch group stratification using modeller-supplied interaction matrices.
14
+ - Seeded first-order and total-order Sobol sensitivity studies with verified artifact
15
+ reuse and compact provenance.
16
+ - Bounded multi-start least-squares calibration for prepared observations, including
17
+ optional population-conserving fitted initial states and local diagnostics.
18
+ - A side-effect-free `patchsim.simulate()` API for external analysis and fitting code.
19
+ - SIS model template, complete workflow documentation, and the JOSS manuscript source.
20
+
21
+ ### Changed
22
+
23
+ - SALib is available through the optional `analysis` dependency group rather than the
24
+ base simulation installation.
25
+ - Run artifacts identify the selected solver, and the CLI exposes validation, contact
26
+ generation, sensitivity, and calibration workflows.
27
+ - Documentation now states the implemented network orientation, transition semantics,
28
+ solver behavior, validation limits, and artifact contracts.
29
+ - **Breaking:** `NetworkModel.simulate_discrete()` uses each interval's width and rejects
30
+ invalid time grids or divergent steps instead of assuming unit spacing.
31
+ - **Breaking:** transition expressions reject floor division and modulo because they
32
+ introduce discontinuities into rate arithmetic.
33
+
34
+ ### Security
35
+
36
+ - Transition rate expressions are now parsed and evaluated against an arithmetic-only
37
+ allowlist instead of `eval`. Expressions come from user-supplied YAML, and configs are
38
+ shared as self-contained project directories, so a config could previously execute
39
+ arbitrary code when a simulation was run.
40
+
41
+ ### Fixed
42
+
43
+ - Rate expressions that overflow, divide by zero, or produce a complex value are now
44
+ rejected instead of returning `inf` or a complex number into the simulation.
45
+ - Rate expressions accept numpy scalars of any dtype; previously only `float64` worked,
46
+ because it is the one numpy type that subclasses Python's `float`.
47
+ - Patch-specific parameter overrides now affect CLI ODE runs instead of being parsed
48
+ and ignored.
49
+ - Model validation rejects global or patch-specific parameter names that duplicate a
50
+ compartment name.
51
+ - Explicit-Euler roundoff checks scale with each compartment update rather than unrelated
52
+ population magnitudes.
53
+
54
+ ## 0.1.0b1 - 2026-04-08
55
+
56
+ ### Added
57
+ - Config-relative path resolution for `PatchFile`, `SeedFile`, `NetworkFile`, and `OutputDir`.
58
+ - Built-in YAML model templates for `sir`, `seir`, and `sirs` under package templates.
59
+ - `list-models` now reports both Python reference models and YAML templates.
60
+
61
+ ### Changed
62
+ - Validation now checks transition source/target compartments explicitly.
63
+ - Validation now checks transition expression identifiers against `compartments ∪ Parameters`.
64
+ - Compartment source-of-truth reconciled: when `compartments` is provided in config, it must match `SeedFile` columns.
65
+ - Package metadata updated to `Development Status :: 4 - Beta`.
66
+ - Runtime dependencies now include conservative minimum version floors.
67
+
68
+ ### Removed
69
+ - Removed unused `patchsim.utils.loader` module and its documentation reference.
@@ -0,0 +1,29 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use PatchSim, please cite the software using this metadata."
3
+ type: software
4
+ title: "PatchSim: a modular simulation framework for patch-based metapopulation epidemiology"
5
+ version: 0.1.0
6
+ abstract: >-
7
+ PatchSim is a Python framework for simulating compartmental infectious disease
8
+ dynamics across spatial patches and optional population groups.
9
+ authors:
10
+ - family-names: Illikkal
11
+ given-names: Adish Assain
12
+ orcid: "https://orcid.org/0009-0001-1009-4560"
13
+ affiliation: "AI and Robotics Technology Park (ARTPARK), Indian Institute of Science, Bengaluru, India"
14
+ - family-names: Mukherjee
15
+ given-names: Shreya
16
+ orcid: "https://orcid.org/0009-0008-3629-0376"
17
+ affiliation: "AI and Robotics Technology Park (ARTPARK), Indian Institute of Science, Bengaluru, India"
18
+ - family-names: S
19
+ given-names: Sneha
20
+ orcid: "https://orcid.org/0009-0009-1854-6443"
21
+ affiliation: "AI and Robotics Technology Park (ARTPARK), Indian Institute of Science, Bengaluru, India"
22
+ repository-code: "https://github.com/dsih-artpark/patchsim"
23
+ url: "https://patchsim.readthedocs.io/"
24
+ license: GPL-3.0-only
25
+ keywords:
26
+ - epidemiology
27
+ - metapopulation
28
+ - compartmental models
29
+ - spatial networks