emod_api.demographics.DemographicsTemplates module

class emod_api.demographics.DemographicsTemplates.CrudeRate(init_rate)[source]

Bases: object

get_dtk_rate()[source]
class emod_api.demographics.DemographicsTemplates.YearlyRate(init_rate)[source]

Bases: emod_api.demographics.DemographicsTemplates.CrudeRate

class emod_api.demographics.DemographicsTemplates.DtkRate(init_rate)[source]

Bases: emod_api.demographics.DemographicsTemplates.CrudeRate

emod_api.demographics.DemographicsTemplates.NoRisk()[source]

NoRisk puts everyone at 0 risk.

emod_api.demographics.DemographicsTemplates.FullRisk(demog, description='')[source]

FullRisk puts everyone at 100% risk.

emod_api.demographics.DemographicsTemplates.InitRiskUniform(demog, min_lim=0, max_lim=1, description='')[source]

InitRiskUniform puts everyone at somewhere between 0% risk and 100% risk, drawn uniformly.

Parameters
  • min (float) – Low end of uniform distribution. Must be >=0, <1.

  • max (float) – High end of uniform distribution. Must be >=min, <=1.

  • description – Why were these values chosen?

Returns

json object aka python dict that can be directly passed to Demographics::SetDefaultFromTemplate

Raises

None

emod_api.demographics.DemographicsTemplates.InitRiskLogNormal(demog, mean=0.0, sigma=1.0)[source]

InitRiskLogNormal puts everyone at somewhere between 0% risk and 100% risk, drawn from LogNormal.

Parameters
  • mean (float) – Mean of lognormal distribution.

  • sigma (float) – Sigma of lognormal distribution.

Returns

json object aka python dict that can be directly passed to Demographics::SetDefaultFromTemplate

Raises

None

emod_api.demographics.DemographicsTemplates.InitRiskExponential(demog, mean=1.0)[source]

InitRiskExponential puts everyone at somewhere between 0% risk and 100% risk, drawn from Exponential.

Parameters

mean (float) – Mean of exponential distribution.

Returns

json object aka python dict that can be directly passed to Demographics::SetDefaultFromTemplate

Raises

None

emod_api.demographics.DemographicsTemplates.NoInitialPrevalence(demog)[source]

NoInitialPrevalence disables initial prevalence; outbreak seeding must be done from an Outbreak intervention (or serialized population).

Parameters

demog – emod-api.demographics.Demographics instance.

Returns

None

Raises

None

emod_api.demographics.DemographicsTemplates.InitPrevUniform(demog, low_prev, high_prev, description='')[source]
emod_api.demographics.DemographicsTemplates.InitSusceptConstant(demog)[source]
emod_api.demographics.DemographicsTemplates.EveryoneInitiallySusceptible(demog, setting=1.0)[source]
emod_api.demographics.DemographicsTemplates.StepFunctionSusceptibility(demog, protected_setting=0.0, threshold_age=1825.0)[source]
emod_api.demographics.DemographicsTemplates.SimpleSusceptibilityDistribution(demog, meanAgeAtInfection=2.5)[source]
emod_api.demographics.DemographicsTemplates.DefaultSusceptibilityDistribution(demog)[source]
emod_api.demographics.DemographicsTemplates.MortalityRateByAge(demog, age_bins, mort_rates)[source]

Set (non-disease) mortality rates by age bins. No checks are done on input arrays.

Parameters
  • age_bins – list of age bins, with ages in years.

  • mort_rates – list of mortality rates, where mortality rate is daily probability of dying..

Returns

N/A.

emod_api.demographics.DemographicsTemplates.MortalityStructureNigeriaDHS(demog)[source]
emod_api.demographics.DemographicsTemplates.get_fert_dist_from_rates(rates)[source]

Create dictionary with DTK-compatible distributions from input vectors of fertility (crude) rates.

Parameters

rates – Array/vector of crude rates for whole population, for a range of years.

emod_api.demographics.DemographicsTemplates.get_fert_dist(path_to_csv)[source]

This function takes a fertility csv file (by year and age bin) and populates a DTK demographics.json file, and the corresponding config file to do individual pregnancies by age and year from data.

Parameters
  • demog – emod_api.demographics.Demographics instance.

  • path_to_csv – absolute path to csv input file. The file should have columns for 5-year age bins

  • "1950-1955". (labelled "15-19", etc. up to "45-49", and a column named "Years" with values like) –

  • anywhere. (There can be extra columns and the columns can be) –

Returns

(complex) dictionary. fertility distribution, ready to be added to demographics file.

emod_api.demographics.DemographicsTemplates.InitAgeUniform(demog)[source]
emod_api.demographics.DemographicsTemplates.AgeStructureUNWPP(demog)[source]