emod_api.utils module#

file that has various utility functions that are general to EMOD

class emod_api.utils.Distributions[source]#

Bases: object

Class with methods that return the configured distribution dictionaries. It is up to user to pipe the parameters to correct prefix variables. For example, if your variable names are ‘Sample_Size_Distribution’ etc. then you would add the prefix ‘Sample_Size with the trailing underscore’ to the keys of the dictionary to add to campaign/config and pass to EMOD.

static constant(constant: float) dict[source]#

This function configures and returns dictionary of the parameters for CONSTANT_DISTRIBUTION.

Parameters:

constant – Each instance will receive this constant/fixed value.

Returns:

Dictionary of the distribution parameters that needs specific parameter prefix to pass to EMOD

static uniform(uniform_min: float, uniform_max: float) dict[source]#

This function configures and returns dictionary of the parameters for UNIFORM_DISTRIBUTION.

Parameters:
  • uniform_min – The minimum value of the uniform distribution.

  • uniform_max – The maximum of the uniform distribution.

Returns:

Dictionary of the distribution parameters that needs specific parameter prefix to pass to EMOD

static gaussian(gaussian_mean: float, gaussian_std_dev: float) dict[source]#

This function configures and returns dictionary of the parameters for GAUSSIAN_DISTRIBUTION.

Parameters:
  • gaussian_mean – The mean for the Gaussian distribution.

  • gaussian_std_dev – The standard deviation for the Gaussian distribution.

Returns:

Dictionary of the distribution parameters that needs specific parameter prefix to pass to EMOD

static exponential(exponential_mean: float) dict[source]#

This function configures and returns dictionary of the parameters for EXPONENTIAL_DISTRIBUTION.

Parameters:

exponential_mean – The mean for the exponential distribution.

Returns:

Dictionary of the distribution parameters that needs specific parameter prefix to pass to EMOD

static log_normal(mu: float, sigma: float) dict[source]#

This function configures and returns dictionary of the parameters for LOG_NORMAL_DISTRIBUTION.

Parameters:
  • mu – The mean for the log-normal distribution.

  • sigma – The width for the log-normal distribution.

Returns:

Dictionary of the distribution parameters that needs specific parameter prefix to pass to EMOD

static poisson(poisson_mean: float) dict[source]#

This function configures and returns dictionary of the parameters for POISSON_DISTRIBUTION.

Parameters:

poisson_mean – The mean for the Poisson distribution.

Returns:

Dictionary of the distribution parameters that needs specific parameter prefix to pass to EMOD

static dual_constant(proportion_0: float, peak_2_value: float) dict[source]#

This function configures and returns dictionary of the parameters for DUAL_CONSTANT_DISTRIBUTION.

Parameters:
  • proportion_0 – The proportion of outcomes to assign a value of zero.

  • peak_2_value – The value to assign to the remaining outcomes.

Returns:

Dictionary of the distribution parameters that needs specific parameter prefix to pass to EMOD

static weibull(weibull_lambda: float, weibull_kappa: float) dict[source]#

This function configures and returns dictionary of the parameters for WEIBULL_DISTRIBUTION.

Parameters:
  • weibull_lambda – The scale value in the Weibull distribution

  • weibull_kappa – The shape value in a Weibull distribution.

Returns:

Dictionary of the distribution parameters that needs specific parameter prefix to pass to EMOD

static dual_exponential(mean_1: float, proportion_1: float, mean_2: float) dict[source]#

This function configures and returns dictionary of the parameters for DUAL_EXPONENTIAL_DISTRIBUTION.

Parameters:
  • mean_1 – The mean of the first exponential distribution.

  • proportion_1 – The proportion of outcomes to assign to the first exponential distribution.

  • mean_2 – The mean of the second exponential distribution.

Returns:

Dictionary of the distribution parameters that needs specific parameter prefix to pass to EMOD

static set_distribution_parameters(distribution_containing_obj: ReadOnlyDict, distribution: dict, prefix: str) None[source]#

This function sets the distribution parameters in the schema_to_class-created dictionary.

Parameters:
  • distribution_containing_obj – ReadOnlyDict: Schema-based smart dictionary representing the structure (intervention or demographics or config) that we’re setting the distribution parameters for.

  • distribution – The distribution dictionary, generated by one of the distribution functions or user defined.

  • prefix – The prefix to be used for the distribution parameters in this intervention.

Returns:

Nothing. The intervention dictionary is updated in place.