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 inmodel.params;define_parameters()declares them up front. - Reproducible simulations: every model accepts
seed/rng; aMetaEpiModelshares one generator across travel and sub-populations. - Multi-group / vector-borne models via
add_groups(), withfrom_group=Truebirths. - Within-host models:
norm=Falseinteractions andadd_viral_generation(). - Birth and death modes:
fixed,global_rate, per-compartment. - Model files:
save_model(),load_model(),list_models()anddownload_model()read and write a YAML format covering demographics, groups, vaccination and viral generation; six ready-made models ship inmodels/and are fetched from themainbranch. NetworkEpiModelsupports vaccination, arbitrary node labels,t_min/susceptiblearguments and parallel interaction edges.MetaEpiModel.plot()/plot_peaks()accept acompartmentargument;add_birth_rate,add_death_rate,add_groupsandadd_viral_generationare 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 (matchingintegrate());NetworkEpiModel.simulate()indexes results fromt_minand 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 nowtimesteps=...(old name deprecated) and every call starts fresh.add_vaccination(source, target, rate, start)argument order.- Python 3.9+;
pyyamlis 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.
NetworkEpiModeltruncated 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,seasonalitywas ignored, histories accumulated across runs.R0()returnedNonefor SIRS-type models, depended on unrelated edges with leaky vaccination, and hid errors;plot()ignoredax; 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.