stisim.networks module#

Define sexual network for STI transmission.

Overview:

  • Risk groups: agents are randomly assigned into one of 3 main risk groups:

    • 0 = marry and remain married to a single partner throughout their lifetime

    • 1 = marry and then divorce or who have concurrent partner(s) during their marriage

    • 2 = never marry

  • In addition, a proportion of each of the groups above engages in sex work.

class stisim.networks.StructuredSexual(pars=None, key_dict=None, condom_data=None, name=None, **kwargs)[source]#

Bases: SexualNetwork

Structured sexual network

static process_condom_data(condom_data)[source]#
get_age_risk_pars(uids, par)[source]#
init_pre(sim)[source]#

Perform initialization steps

This method is called once, as part of initializing a Sim. Note: after initialization, initialized=False until init_vals() is called (which is after distributions are initialized).

init_results()[source]#

Store network length by default

init_post()[source]#

Initialize the values of the states; the last step of initialization

set_network_states(upper_age=None)[source]#

Many network states depend on properties of people – e.g. MSM depends on being male, age of debut varies by sex and over time, and participation rates vary by age. Each time states are dynamically grown, this function should be called to set the network states that depend on other states.

over_debut()[source]#
set_risk_groups(upper_age=None)[source]#

Assign each person to a risk group

set_concurrency(upper_age=None)[source]#

Assign each person a preferred number of simultaneous partners

set_sex_work(upper_age=None)[source]#
set_debut(upper_age=None)[source]#
match_pairs(ppl)[source]#

Match pairs by age

add_pairs(ti=None)[source]#

Add pairs

match_sex_workers(ppl)[source]#

Match sex workers to clients

end_pairs()[source]#
update_results()[source]#

Store the number of edges in the network

net_beta(disease_beta=None, uids=None, disease=None)[source]#

Calculate the beta for the given disease and network

set_condom_use()[source]#

Set condom use

count_partners()[source]#

Count the number of partners each person has had over the past 3/12 months

step()[source]#

Define how the module updates over time – the key part of Starsim!!

class stisim.networks.FastStructuredSexual(**kwargs)[source]#

Bases: StructuredSexual

match_pairs(ppl)[source]#

Match pairs by age, using sorting rather than the linear sum assignment

class stisim.networks.AgeMatchedMSM(**kwargs)[source]#

Bases: StructuredSexual

match_pairs(ppl)[source]#

Match males by age using sorting

class stisim.networks.AgeApproxMSM(**kwargs)[source]#

Bases: StructuredSexual

match_pairs(ppl)[source]#

Match