emodpy_hiv.demographics.HIVDemographics module

This module contains the classes and functions for creating demographics files for HIV simulations. For more information on EMOD demographics files, see Demographics file.

class emodpy_hiv.demographics.HIVDemographics.HIVDemographics(nodes, idref='Gridded world grump2.5arcmin', base_file=None)[source]

Bases: Demographics

This class is derived from emod_api.demographics.Demographics.Demographics and sets certain defaults for HIV in construction.

Parameters:
  • nodes – The number of nodes to create.

  • idref – Method describing how the latitude and longitude values are created for each of the nodes in a simulation. “Gridded world” values use a grid overlaid across the globe at some arcsec resolution. You may also generate the grid using another tool or coordinate system. For more information, see Metadata.

  • base_file – A basic demographics file used as a starting point for creating more complicated demographics files. For example, using a single node file to create a multi-node file for spatial simulations.

  • init_prev – The initial HIV prevalence of the population.

Returns:

None

fertility(path_to_csv, verbose=False)[source]

Set fertility based on data. Simulation shall concist of individual pregnancies with rates by woman’s age and year-of-simulation using data from provided csv.

mortality(file_male, file_female, interval_fit=None, which_point='mid', predict_horizon=2050, csv_out=False, n=0, results_scale_factor=0.0027397260273972603)[source]

For back-compat. This function can go away.

apply_assortivity(rel_type, matrix=None)[source]

Add an assortivity matrix to Pair-Forming Algo. Right now only applies to RISK IP.

Parameters:
  • rel_type – “COMMERCIAL”, “INFORMAL”, “MARITAL”, or “TRANSITORY”

  • matrix – 3x3 matrix of assortivity values, row represents male, column represents female.

Returns:

N/A.

set_concurrency_params_by_type_and_risk(rel_type, ip_value, max_simul_rels_male=None, max_simul_rels_female=None, prob_xtra_rel_male=None, prob_xtra_rel_female=None)[source]

Set concurrent relationship formation params for a given relationship type and risk group.

Parameters:
  • rel_type – Relationship category: “COMMERCIAL”, “MARITAL”, “INFORMAL” or “TRANS”

  • ip_value – Usually Risk Group but based on defined IP. “High”, “Medium”, or “Low”

  • max_simul_rels_male – Sets Max_Simultaneous_Relationships_Male.

  • max_simul_rels_female – Sets Max_Simultaneous_Relationships_Female.

  • prob_xtra_rel_male – Sets Prob_Extra_Relationship_Male.

  • prob_xtra_rel_female – Sets Prob_Extra_Relationship_Female.

Returns:

Nothing.

set_pair_form_params(rel_type, new_constant_rate=None)[source]

Set Formation_Rate_Constant value for the specified relationship type.

Parameters:
  • rel_type – Relationship Type. E.g., “MARITAL”

  • new_constant_rate – New value for Formation_Rate_Constant for the relationship type.

set_coital_act_rate(rel_type, rate=None)[source]

Set Coital_Act_Rate value for the specified relationship type.

Parameters:
  • rel_type – Relationship Type. E.g., “MARITAL”

  • rate – New value for Coital_Act_Rate for the relationship type.

set_condom_usage_probs(rel_type, min=None, mid=None, max=None, rate=None)[source]

Set Condom_Usage_Probability values for the specified relationship type using 4 values to configure a sigmoid.

Parameters:
  • rel_type – Relationship Type. E.g., “MARITAL”

  • min – “Min” (a probability)

  • mid – “Mid” (a year)

  • max – “Max” (a probability)

  • rate – “Rate” (a probability)

set_relationship_duration(rel_type, weibull_scale=None, weibull_heterogeneity=None)[source]

Set the Weibull configuration values for the draw that determines the duration of relationships of the specified type.

Parameters:
  • rel_type – Relationship Type. E.g., “MARITAL”

  • weibull_scale – value of Duration_Weibull_Scale

  • weibull_heterogeneity – value of Duration_Weibull_Heterogeneity

add_or_update_initial_risk_distribution(distribution=None)[source]
emodpy_hiv.demographics.HIVDemographics.from_template_node(lat=0, lon=0, pop=1000000.0, name=1, forced_id=1)[source]

Create a single-node HIVDemographics instance from the parameters you supply.

Parameters:
  • lat – Latitude of the centroid of the node to create.

  • lon – Longitude of the centroid of the node to create.

  • pop – Human population of the node.

  • name – The name of the node. This may be a characteristic of the node, such as “rural” or “urban”, or an identifying integer.

  • forced_id – The node ID for the single node.

Returns:

A HIVDemographics instance.

emodpy_hiv.demographics.HIVDemographics.from_pop_csv(pop_filename_in, pop_filename_out='spatial_gridded_pop_dir', site='No_Site')[source]

Create a multi-node HIVDemographics instance from a CSV file describing a population.

Parameters:
  • pop_filename_in – The path to the demographics file to ingest.

  • pop_filename_out – The path to the file to output.

  • site – A string to identify the country, village, or trial site.

Returns:

A HIVDemographics instance.

emodpy_hiv.demographics.HIVDemographics.from_params(tot_pop=1000000.0, num_nodes=100, frac_rural=0.3, id_ref='from_params')[source]

Create a multi-node HIVDemographics instance as a synthetic population based on a few parameters.

Parameters:
  • tot_pop – The total human population in the node.

  • num_nodes – The number of nodes to create.

  • frac_rural – The fraction of the population that is rural.

  • id_ref – Method describing how the latitude and longitude values are created for each of the nodes in a simulation. “Gridded world” values use a grid overlaid across the globe at some arcsec resolution. You may also generate the grid using another tool or coordinate system. For more information, see Metadata.

Returns:

A HIVDemographics instance.