EMSA - Epidemic Modeling, Sensitivity Analysis
Introduction
EMSA is a Python package designed to simplify and optimize sensitivity analysis for deterministic compartmental epidemic models. By leveraging CUDA for parallel processing, EMSA allows users to efficiently evaluate how different parameters affect model outcomes, making it a powerful tool for researchers and public health officials. Potential applications include outbreak forecasting, intervention planning, and understanding the impact of varying disease parameters.
Sensitivity analysis is performed using Latin Hypercube Sampling (LHS) for parameter sampling
and Partial Rank Correlation Coefficient (PRCC) as a metric for sensitivity. For evaluation of the model
we use the package torchode, and we represent the ODE system corresponding to the model with matrix operations,
enabling parallel evaluation of the sampled parameter configurations.
If you get stuck at some point, you think the library should have an example on x or you want to suggest some other type of improvement, please open an issue on github.
Installation
The current dependency set supports Python 3.10 and 3.11. You can install the published package via pip:
pip install emsa
Or clone the development version using git:
git clone https://github.com/KKol21/epimodel_sensitivity
From the repository root, install the development checkout with:
python -m pip install --upgrade pip
python -m pip install -r requirements-dev.txt
For CPU execution on Linux or Windows, install the CPU PyTorch wheel first, then install EMSA and the extras you need:
python -m pip install --upgrade pip
python -m pip install torch==2.3.1 --index-url https://download.pytorch.org/whl/cpu
python -m pip install -e ".[dev,notebook]"
The CPU index and version follow the PyTorch installation instructions.
Runtime dependencies live in pyproject.toml; requirements.txt installs the package,
requirements-dev.txt adds development tools, and docs/requirements.txt adds the
documentation tools. Run these requirements commands from the repository root.
See RELEASING.md for automatic version bumps and publishing.
Pipeline Overview
EMSA requires the following inputs:
- Model Parameters: Key values that define the dynamics of the epidemic model.
- Model Structure: The compartments and transitions between them.
- Sampling Configuration: Initial values of the simulation, sampled parameters and their ranges, etc.
- Age Vector: Age distribution of the population.
- Contact Matrix: Interaction rates between different population groups.
These inputs are processed through the following steps:
- Parameter Sampling: Latin Hypercube Sampling (LHS) generates parameter sets.
- Model Evaluation: Each parameter set is evaluated using the specified epidemic model.
- Sensitivity Measure: Partial Rank Correlation Coefficient (PRCC) is calculated to assess parameter sensitivity.
Documentation and Examples
Full documentation is available on Read the Docs.
Start with the executable package walkthrough. It defines a
SIR model, plots a trajectory, checks numerical convergence, and runs reproducible
LHS/PRCC analysis entirely in memory. From a checkout, install with
python -m pip install -e ".[notebook]", then open the notebook in JupyterLab or your IDE
and select that Python environment.
SimulationGeneric(data, model_struct, sampling_config, save_results=False).run()
accepts dictionaries and returns a mapping of scenario names to NumPy arrays under
samples, targets, prcc, p_values, plus metadata. JSON paths and the existing
sampling/analysis methods remain supported. Set output_dir and save_results=True
to export CSV files and metadata. Use a separate output directory per concurrent run;
reusing a directory replaces files with the same scenario names.
Empty scenario names add no extra separator: for example, prcc_i_max.csv and
metadata.json. Existing CSV exports with the older extra underscore remain readable.
Sampling configuration accepts seed and solver. Solver settings include method
(euler or dopri5), step_size, rtol, atol, max_steps and
negative_tolerance. Euler retains the original one-day default; choose a smaller
step for faster dynamics. For Dopri5, step_size caps the adaptive step size.
Solver failures, non-finite states and populations below -negative_tolerance
(default 1e-4 people) raise errors. These checks do not replace convergence checks
for your model, particularly for time-dependent interventions.
Explore the emsa_examples/ directory to see how EMSA can be applied to various epidemic models,
or check out the
"Introduction to EMSA"
Google Collaboratory notebook to get started. For general usage, try the
"EMSA template"
notebook!
License
EMSA is licensed under the MIT license.
Acknowledgements
EMSA was developed as part of the National Laboratory for Health Security project, supported by the National Research, Development and Innovation Office, Hungary, grant RRF-2.3.1-21-2022-00006.
Contributing
We welcome contributions to EMSA! To contribute, please open an issue first to discuss the proposed changes. Afterwards you can fork the repository, and create a merge request in order for your changes to be merged into the package.
Metadata
Release files for emsa 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| emsa-1.0.4.tar.gz | 381.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| emsa-1.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 416.6 kB
Release files / emsa-1.0.4.tar.gz
| Download URL | emsa-1.0.4.tar.gz |
|---|---|
| Size | 381.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c232069f1a84a67664a5de1e455b79c007c50dcf559d6ed76fbf3a81c88ed969
|
|
BLAKE2b-256 checksum How to use checksums |
970c973c85d3796a0a9463b5c46cb64f2f4ec17f229666eaa70d1b658b74f135
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.
Transparency logRelease files / emsa-1.0.4-py3-none-any.whl
| Download URL | emsa-1.0.4-py3-none-any.whl |
|---|---|
| Size | 34.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c7c2a60535426c64051d2c66e5709d3bc7e8f3099d5f308f86b0eea74aad2eb
|
|
BLAKE2b-256 checksum How to use checksums |
45ed06a72be88a3d55e2173d771c017874e3b97465180a5425d2cd9a91426ecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.
Transparency logSecurity for emsa 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for emsa-1.0.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.