emodpy_malaria.demographics.MalariaDemographics module#

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

class emodpy_malaria.demographics.MalariaDemographics.MalariaDemographics(nodes, idref='Gridded world grump2.5arcmin', base_file=None, init_prev=0.0, include_biting_heterogeneity=True)[source]#

Bases: Demographics

This class is derived from emod_api.demographics.Demographics.Demographics and sets certain defaults for malaria 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 malaria prevalence of the population. Defaults to 0%.

  • include_biting_heterogeneity – variable biting rates. Defaults to on.

Returns:

None

set_risk_lowmedium()[source]#

Set initial risk for low-medium transmission settings per: https://wiki.idmod.org/display/MAL/Heterogeneous+biting+risk+in+simulations+vs+data.

set_risk_high()[source]#

Set initial risk for high transmission settings per: https://wiki.idmod.org/display/MAL/Heterogeneous+biting+risk+in+simulations+vs+data.

add_larval_habitat_multiplier(schema, hab_type, multiplier, species='ALL_SPECIES', node_id=0)[source]#

Add LarvalHabitatMultiplier to node(s).

Parameters:
  • schema – Path to schema.json.

  • hab_type – Habitat type.

  • multiplier – Multiplier or Factor.

  • species – Specific species (defaults to ALL).

  • node_id – Nodes for this LHM. Defaults to all.

Returns:

Nothing.

add_initial_vectors_per_species(init_vector_species, node_ids=None)[source]#

Add an InitialVectorsForSpecies configuration for all nodes or just a set of nodes.

Parameters:
  • init_vector_species – Dictionary of vector species (strings) to initial populations. There is no checking for coherence of species named in other input settings.

  • node_ids – Array of node ids. Defaults to None for all nodes.

Returns:

N/A.

add_initial_vectors_per_species_from_csv(csv_path)[source]#

Add initial vector species population to ‘demographics’ nodes from a csv file.

Parameters:

csv_path – Path to CSV file with the initial vector species populations for each node.

Returns:

N/A.

emodpy_malaria.demographics.MalariaDemographics.from_template_node(lat=0, lon=0, pop=1000000.0, name=1, forced_id=1, init_prev=0.2, include_biting_heterogeneity=True)[source]#

Create a single-node MalariaDemographics 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.

  • init_prev – The initial malaria prevalence of the node.

Returns:

A MalariaDemographics instance.

emodpy_malaria.demographics.MalariaDemographics.from_pop_csv(pop_filename_in, pop_filename_out='spatial_gridded_pop_dir', site='No_Site')[source]#

Create a multi-node MalariaDemographics 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 MalariaDemographics instance

emodpy_malaria.demographics.MalariaDemographics.from_csv(input_file, res=0.008333333333333333, id_ref='from_csv', init_prev=0.0, include_biting_heterogeneity=True)[source]#

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

Parameters:
  • input_file – The path to the csv file to ingest.

  • res – Resolution.

  • id_ref – A string to identify the file, needs to match other input files.

  • init_prev – The initial malaria prevalence of the population. Defaults to 0%.

  • include_biting_heterogeneity – variable biting rates. Defaults to on.

Returns:

A MalariaDemographics instance

emodpy_malaria.demographics.MalariaDemographics.from_params(tot_pop=1000000.0, num_nodes=100, frac_rural=0.3, id_ref='from_params')[source]#

Creates nodes with following logic: First node is the urban node, which contains tot_pop * (1-frac_rural) of the population, the rest of the nodes splip the left-over population with less and less people in each node.

Create a multi-node MalariaDemographics 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 will be distributed between nodes 2 and higher

  • 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 MalariaDemographics instance.