population

population

Defines functions for making the population.

Functions

Name Description
make_contacts Make contacts for a single layer as an edgelist. This will select sexually
make_people Make the people for the simulation.

make_contacts

population.make_contacts(
    lno=None,
    tind=None,
    partners=None,
    current_partners=None,
    ages=None,
    debuts=None,
    is_female=None,
    is_active=None,
    mixing=None,
    layer_probs=None,
    f_cross_layer=None,
    m_cross_layer=None,
    durations=None,
    acts=None,
    age_act_pars=None,
    cluster=None,
    add_mixing=None,
)

Make contacts for a single layer as an edgelist. This will select sexually active male partners for sexually active females using age structure if given.

make_people

population.make_people(
    sim,
    popdict=None,
    reset=False,
    verbose=None,
    use_age_data=True,
    sex_ratio=0.5,
    dt_round_age=True,
    microstructure=None,
    age_data=None,
    pop_trend=None,
    pop_age_trend=None,
    **kwargs,
)

Make the people for the simulation.

Usually called via hpvsim.sim.Sim.initialize.

Parameters

Name Type Description Default
sim (Sim) the simulation object; population parameters are taken from the sim object required
popdict (any) if supplied, use this population dictionary instead of generating a new one; can be a dict or People object required
reset (bool) whether to force population creation even if self.popdict/self.people exists required
verbose (bool) level of detail to print required
use_age_data bool True
sex_ratio bool 0.5
dt_round_age bool whether to round people’s ages to the nearest timestep (default true) True

Returns

Name Type Description
people People people