Releases: epistorm/epydemix
Release list
v1.3.1
Fixed
pyproject.tomlnow listsnumbaas an optional extra (pip install epydemix[numba]), restoring the JIT-compiled speedup for_multinomial_probs(the hot path in stochastic simulation) advertised in the 1.2.0 changelog entry.requirements.txtandsetup.pyhave listednumba>=0.57.0since 1.2.0, butpyproject.toml'sdependencieswas never updated to match — since PyPI installs are driven bypyproject.toml,pip install epydemixnever actually installednumba, silently falling back to the un-JIT'd Python path (no crash:utils.pyalready wraps the import in atry/exceptwith a no-op decorator fallback).numba's own hard dependency,llvmlite, bundles LLVM and is 40-60MB per wheel, so it's exposed as an opt-in extra rather than a base dependency.
Full changelog: https://github.com/epistorm/epydemix/blob/main/CHANGELOG.md#131---2026-07-02
v1.3.0
What's new
Changed
- Breaking:
add_outcomenow interpretsmortality_rate/hospitalization_rateas the fraction of the Infected outflow that goes to Dead / Hospitalized, rescaling the existing Infected outflow (e.g.Infected → Recovered) by(1 - rate). Previously these were independent day⁻¹ rates competing withrecovery_ratefor the same Infected pool. This matches the branching-fraction convention already used byasymptomatic_fractionincreate_seiar. If you useoutcome=, pass the intended fraction (e.g.0.02for "2% hospitalized") rather than a standalone rate.
Fixed
add_vaccinationnow routes breakthrough infections (Vaccinated → ...) to Exposed when the backbone has an Exposed compartment (SEIR,SEIAR), instead of always jumping straight toInfected. Vaccinated individuals who get infected now correctly re-enter the incubation stage. Behavior forSIR/SISis unchanged.apply_initial_conditionsnow raises a clearValueErrorwheninitial_conditions_dictcontains a compartment name not present in the model, instead of silently ignoring the mismatched key and leaving the intended compartment at 0 population. Fixes #20.stochastic_simulationno longer double-counts recorded transition counts when a model has two or more transitions sharing the same(source, target)pair (e.g.SEIAR'sSusceptible → Exposed, mediated by bothInfectedandAsymptomatic). Compartment populations were never affected — only the recorded transition trajectory (previously ~2x the true flow for the affected pair).- Fixed a flaky calibration test caused by an unseeded population fixture that could occasionally sample a zero-population age group.
Full Changelog: https://github.com/epistorm/epydemix/blob/main/CHANGELOG.md
v1.2.1
What's new
Added
- New
SEIARbackbone model: symptomatic + asymptomatic infectious compartments, with parametersasymptomatic_fraction,asymptomatic_recovery_rate, andasymptomatic_relative_infectivity. - Three orthogonal modular extensions composable on any backbone via
load_predefined_modelflags:waning_immunity=True— adds R → S transition (SIRS, SEIRS dynamics);waning_ratedefaults to1/365(~1 year of immunity)vaccination=True— adds a Vaccinated compartment with S → V → I at reduced rate controlled byvaccine_efficacyoutcome="deaths"oroutcome="hospitalization"— adds Dead or Hospitalized compartment branching from Infected
SUPPORTED_MODELSupdated to["SIR", "SEIR", "SIS", "SEIAR"].- All new rate parameters accept scalars, 1D time-varying arrays
(T,), or 2D age-stratified arrays(T, G). - Tutorial 12: Predefined Epidemic Models — demonstrates all backbones and modular extensions.
Fixed
create_default_initial_conditionsnow correctly seeds all new model combinations: deduplicates transition sources, excludes accumulator compartments (Vaccinated, Exposed, Hospitalized, Dead) from initial population, and handles waning-immunity models where Susceptible is both a source and a target.
v1.2.0
What's Changed
Added
- US county-level geographies (~3,144 locations) from epydemix-data v1.2.0. Counties are stored using the
Country__State__County_Namenaming convention (e.g.,United_States__Alabama__Autauga_County). locations.csvnew columns:level(0=country, 1=state/province/region, 2=US county) andiso_code(ISO 3166-1 alpha-2 for countries, ISO 3166-2 for states, 5-digit FIPS for counties).get_available_locations()levelfilter: optional parameter to filter by geographic level. Backward-compatible withdata_version="v1.1.0".- Numba JIT compilation for the multinomial probability computation (
_multinomial_probsinutils.py), eliminating interpreter overhead on the hot simulation path.
Changed
- Location names now use
_for spaces within a name and__as a hierarchy separator (e.g.,United_States__Alabama__Autauga_County). Existing country and state names have been renamed consistently. - Default
data_versionbumped from"v1.1.0"to"v1.2.0"acrossload_epydemix_population(),get_available_locations(), and allEpiModelmethods. validate_population_name()error message now includes naming convention guidance and points users toget_available_locations().- Optimized
compute_spontaneous_transition_rate()andcompute_mediated_transition_rate()inepimodel.pyto avoid unnecessarydeepcopyon the hot simulation path.
Quick start
from epydemix.population import get_available_locations, load_epydemix_population
# Browse all 3,600+ geographies
get_available_locations() # all levels
get_available_locations(level=0) # countries only
get_available_locations(level=1) # states / provinces
get_available_locations(level=2) # US counties
# Load a US county
pop = load_epydemix_population("United_States__New_York__New_York_County")Full changelog: https://github.com/epistorm/epydemix/blob/main/CHANGELOG.md
Release 1.1.0
What's Changed
- Migrate lint/format to Ruff, add CONTRIBUTING.md by @Giuzzilla in #5
- Add
ignore_nanparameter to handle NaN values in quantile computations by @mu373 in #6 - Add
variablesparameter to trajectory and quantile methods for memory efficiency by @mu373 in #7 - Add per-simulation time/budget checks to ABC-SMC by @mu373 in #9
- Bug fix: Skip non-numeric arrays in quantile computation by @mu373 in #10
- Fix inconsistent
data_versiondefault documentation across docstrings and CHANGELOG by @Copilot in #13 - New pop structure by @ngozzi in #12
- Version 1.1.0 by @mu373 in #11
New Contributors
- @Giuzzilla made their first contribution in #5
- @Copilot made their first contribution in #13
Full Changelog: v.1.02...v1.1.0
v.1.02
[1.0.2] – 2025-10-30
Added
-
Custom multinomial sampling implementation: replaces
numpy.random.multinomial()to improve the calculation of transition probabilities.- Transition rate functions now return rates instead of risks, as the conversion is automatically handled during multinomial sampling.
- Users can enable linear approximation to the probabilities using the
apply_linear_approximationargument insimulate()andEpiModel.run_simulations().
-
Support for reproducible random generation: both
simulate()andEpiModel.run_simulations()now include anrngargument accepting anumpy.random.Generatorobject.- By default, it is set to
None, in which casenumpy.random.default_rng()is used. - Users can supply a custom generator to ensure reproducibility.
- By default, it is set to
-
Expanded
simulate()arguments to optimize the execution time ofEpiModel.run_simulations(). -
ABCSampler.run_projections()improvement: now incorporates ABC weights when sampling parameter sets from the approximate posterior distribution. -
Improved
epydemix.visualization.plot_quantiles(): added thedata_date_columnargument (default:"date") to allow users to specify the name of the date column in the provided data frame. -
Added a new utils function to create initial conditions dictionary (
utils.get_initial_conditions_dict).
Changed
- Internal handling of transition rate functions adjusted to reflect the new multinomial sampling mechanism (e.g.,
compute_mediated_transition_rate()andcompute_spontaneous_transition_rate()). Advanced users defining custom transition types should review their rate functions accordingly.
Tutorials
-
Added three new tutorials:
- Modeling of multiple pathogen strains using a two-virus SIR-like model.
- Implementation of a realistic vaccination campaign rollout, including age-specific dose administration and a new transition type for vaccinations.
- Speeding up simulations and calibration using
multiprocess.
Data
- Updated U.S. national and state population data in the epydemix_data repository using the more recent estimates from the U.S. Census Bureau.
Compatibility
- These updates do not introduce breaking changes. Existing code written for previous versions remains compatible.