MixingPools#

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

Bases: Route

A container for creating a rectangular array of MixingPool instances

By default, separates the population into <15 and >15 age groups.

Parameters:
  • diseases (str) – the diseases that transmit via these mixing pools

  • 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 via these mixing pools

  • contacts (array) – the relative connectivity between different mixing pools (can be float or Dist)

Example:

import starsim as ss
mps = ss.MixingPools(
    diseases = 'sis',
    beta = 0.1,
    src = {'0-15': ss.AgeGroup(0, 15), '15+': ss.AgeGroup(15, None)},
    dst = {'0-15': ss.AgeGroup(0, 15), '15+': ss.AgeGroup(15, None)},
    contacts = [[2.4, 0.49], [0.91, 0.16]],
)
sim = ss.Sim(diseases='sis', networks=mps).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

validate_pars()[source]#

Check that src and dst have correct types, and contacts is the correct shape

init_post()[source]#

Initialize each mixing pool

step()[source]#

Step each mixing pool

remove_uids(uids)[source]#

Remove UIDs from each mixing pool