MixingPool#

class MixingPool(pars=None, **kwargs)[source]#

Bases: Route

Define a single mixing pool; can be used as a drop-in replacement for a network.

Parameters:
  • diseases (str) – the diseases that transmit via this mixing pool

  • src (inds) – source agents; can be AgeGroup(), ss.uids(), or lambda(sim); None indicates all alive agents

  • dst (inds) – destination agents; as above

  • beta (float) – overall transmission

  • contacts (Dist) – the number of effective contacts of the destination agents

Example:

import starsim as ss

# Set the parameters
mp_pars = dict(
    src = lambda sim: sim.people.male, # only males are infectious
    dst = None, # all agents are susceptible
    beta = ss.beta(0.2),
    contacts = ss.poisson(lam=4),
)

# Seed 5% of the male population
def p_init(self, sim, uids):
    return 0.05*sim.people.male

# Create and run the sim
sis = ss.SIS(init_prev=p_init)
mp = ss.MixingPool(mp_pars)
sim = ss.Sim(diseases=sis, networks=mp)
sim.run()
sim.plot()

Attributes

now

Shortcut to self.t.now()

states

Return a flat list of all states

statesdict

Return a flat dictionary (objdict) of all states

ti

Get the current module timestep

timevec

Shortcut to self.t.timevec

Methods

remove_uids(uids)[source]#

If UIDs are supplied explicitly, remove them if people die