make_synthpop#

class make_synthpop(sim=None, popdict=None, layer_mapping=None, community_contacts=None, **kwargs)[source]#

Make a population using SynthPops, including contacts.

Usually called automatically, but can also be called manually. Either a simulation object or a population must be supplied; if a population is supplied, transform it into the correct format; otherwise, create the population and then transform it.

Parameters:
  • sim (Sim) – a Covasim simulation object

  • popdict (dict/Pop/People) – a pre-generated SynthPops population (otherwise, create a new one)

  • layer_mapping (dict) – a custom mapping from SynthPops layers to Covasim layers

  • community_contacts (int) – if a simulation is not supplied, create this many community contacts on average

  • kwargs (dict) – passed to sp.make_population()

Example:

sim = cv.Sim(pop_type='synthpops')
sim.popdict = cv.make_synthpop(sim)
sim.run()