Skip to main content

API

analyzers Analyzers, which record more than a sim records by default, as it runs
connectors Connectors, which link modules as the sim runs: e.g. one disease making another more likely
data Data by place: ages, populations, birth and death rates, contact matrices, and administrative units
demographics Births, deaths, migration, and pregnancy
diseases Diseases: the base class (ss.Disease), diseases with transmission written as code (ss.AgentDisease), the record of who infected whom (InfectionLog), and the textbook models (ss.SIR, ss.SIS, ss.SEIR)
distributions The distributions to choose from: ss.uniform, ss.normal, ss.poisson, and so on, each a random-number-safe ss.Dist
geo Places and the movement between them: a geography (ss.geo.geography), and movement between its places: a movement model (ss.geo.gravity, ss.geo.radiation), a matrix (ss.geo.Mobility), or a register of moves on given dates (ss.geo.register)
interventions Interventions, which change the course of a sim during a run
networks Networks and mixing pools: who meets whom, and so who can infect whom
people The people in a sim (ss.People), lazy references to their properties (ss.person), and how they are made
products Products: vaccines, treatments, and diagnostics, and the protection people hold from them
results Results: the values a sim records at each time point (ss.Result), the containers that hold them (ss.Results), and how they are compared with data (ss.SimData)
run Running many sims: ss.parallel() and ss.MultiSim
settings Options for Starsim, and the plotting style
sim The sim (ss.Sim)
strains Strains of a disease (ss.Strains), and protection between them (ss.immunity)
utils Numerical utilities and other helper functions

Converters

Importing models from other frameworks, and exporting sims to them.

converters Import models from other frameworks, and export sims to them

Internals

How Starsim works under the hood, for developers rather than modelers.

internals.arrays Arrays of agents’ values: states such as age or infection status, and the UIDs that index them
internals.conditions Conditions: who something applies to
internals.dates Dates: ss.date, an array of them (ss.DateArray), and calendar durations (datedur)
internals.debugtools Tools for debugging and profiling Starsim runs: sim.profile(), detailed diagnostics, and mock objects for testing a module without a sim
internals.dimensions Dimensions: how a model is divided into groups by the properties of people (age, sex, place, …)
internals.display Not for the user: how a model is shown: describe(), diagram(), and equations(); and how a sim is (sim.describe(), sim.what_modifies(), sim.check_dt())
internals.dists The machinery of random-number-safe distributions: ss.Dist, and how the distributions of a sim are found, seeded, and drawn from
internals.errors Errors, warnings, and notes.
internals.expressions Expressions: the parameters (ss.par), counts, and arithmetic that rates, results, and conditions are made of, and how they are evaluated and printed
internals.fitting Fitting sims to data: likelihoods, particle filters, samplers, and what sim.fit() runs
internals.gradients Not for the user: the ODE run in JAX: gradients of results with respect to parameters, and many runs at once
internals.graph Not for the user: the graph of one module: its states, transitions, and parameters, collected, named, completed with defaults (each guess recorded), and checked
internals.loop The integration loop: the order in which each module’s code runs in each timestep
internals.modules The base classes of the parts of a sim: ss.modules.Base and ss.Module, which diseases, networks, interventions, and the rest inherit from
internals.parameters Parameters: the container of a module’s or sim’s parameters (ss.Pars), and values that vary by level or in time (ss.by, ss.timeseries, ss.seasonal)
internals.time Durations and rates, each with its unit (ss.days, ss.peryear, ss.probperyear, …), and plotting dates and durations with Matplotlib
internals.timeline Timelines: the time vectors of a sim and of each of its modules
internals.transitions States, transitions, and the expressions that drive them.

Library

Example and reference modules that build on core Starsim but are not part of it. Import as import starsim.library as ssl. These modules are illustrative rather than validated; see the user guide for details.

library.diseases Example disease models: cholera, COVID, dengue, Ebola, gonorrhea, HIV, influenza, malaria, measles, pertussis,
library.econ Health economics: the costs of a sim, disability-adjusted life years, discounting, and incremental cost-effectiveness ratios.
library.mnch Maternal, newborn, and child health (MNCH) example modules.
library.networks Additional network types: household, cluster, spatial, and theoretical.

Solvers

The engines that run declared models, as compartments or as agents.

solvers.agents Not for the user: the agent engine: a declared model run as agents (abm)
solvers.choose The solvers to choose from (ss.solvers.ode(), binomial(), gillespie(), tau(), and abm(), each with its options), and, not for the user, choosing the solver: which engine runs a declared model, and why (choose_solver()), and the steps that build a declared model before it is run (parameters by name, births and deaths of the population, a named population, the unit, life tables)
solvers.compartmental Not for the user: the compartmental engine: a declared model run as groups of people (ode, ide, binomial, gillespie, and tau)
solvers.deliveries Not for the user: deliveries in a compartmental run
solvers.engine Not for the user: the base of the engines that run a declared model (Engine), and what they share
solvers.joint_states Not for the user: diseases whose states are tracked jointly in a compartmental run
solvers.mixing Not for the user: who meets whom in a compartmental run: the contact rates between groups that the networks become
solvers.particles Not for the user: many runs of a compartmental program stepped forward together: the particles of a particle filter