Skip to content

epidemik 0.2.0

Latest

Choose a tag to compare

@bmtgoncalves bmtgoncalves released this 15 Sep 04:19
· 10 commits to main since this release

epidemik 0.2.0 reconciles the two lines of development (the vector-borne vector branch and the main branch that PyPI 0.1.3.x was built from), fixes a long list of bugs, and ships with a full test suite (110 tests, 100% line coverage) and rewritten documentation at https://epidemik.readthedocs.io/.

New features

  • Named parameters: rates can be numbers, keywords (beta=0.3) or expressions of other parameters (mu="beta/2"), stored in model.params; define_parameters() declares them up front.
  • Reproducible simulations: every model accepts seed/rng; a MetaEpiModel shares one generator across travel and sub-populations.
  • Multi-group / vector-borne models via add_groups(), with from_group=True births.
  • Within-host models: norm=False interactions and add_viral_generation().
  • Birth and death modes: fixed, global_rate, per-compartment.
  • Model files: save_model(), load_model(), list_models() and download_model() read and write a YAML format covering demographics, groups, vaccination and viral generation; six ready-made models ship in models/ and are fetched from the main branch.
  • NetworkEpiModel supports vaccination, arbitrary node labels, t_min/susceptible arguments and parallel interaction edges.
  • MetaEpiModel.plot()/plot_peaks() accept a compartment argument; add_birth_rate, add_death_rate, add_groups and add_viral_generation are forwarded to every sub-population.
  • EpiModel.reset(), EpiModel(name=...), single_step() continuing from the current state.

Breaking changes

  • print(model) produces the YAML model format; edge/node attributes hold parameter names, not numbers.
  • simulate() stores the initial conditions in its first row (matching integrate()); NetworkEpiModel.simulate() indexes results from t_min and labels columns by node.
  • add_birth_rate() defaults to births proportional to the total population; its first positional argument is the rate.
  • MetaEpiModel.simulate(timestamp=...) is now timesteps=... (old name deprecated) and every call starts fresh.
  • add_vaccination(source, target, rate, start) argument order.
  • Python 3.9+; pyyaml is a dependency. Built with hatchling, developed with uv.

Bug fixes

  • Stochastic simulation could crash on large rates, on age-structured models and on empty groups, dropped parallel transitions, and could drive compartments negative through deaths.
  • NetworkEpiModel truncated compartment names to one character, kept only the last spontaneous transition, ignored non-integer node labels and never vaccinated susceptible nodes.
  • MetaEpiModel.plot() required a sub-population named "NY", draw_model() crashed, seasonality was ignored, histories accumulated across runs.
  • R0() returned None for SIRS-type models, depended on unrelated edges with leaky vaccination, and hid errors; plot() ignored ax; agent-only compartments crashed integration; numpy array rates were mutated in place; age-structured integration was non-deterministic.

See docs/changelog.rst for the complete list.