tracts.demography.parametrized_demography_sex_biased.SexType#

class SexType(suffix, expression)#

Bases: Enum

A class representing the sex-specific parameters in a demographic model.

suffix#

The suffix to be added to the parameter name to indicate the sex-specific parameter.

Type:

str

expression#

A function that takes in the overall rate parameter and the sex bias parameter and returns a function to compute the corresponding rate for that sex in a demography.

Type:

Callable[[str, str], Callable[[BaseParametrizedDemography, list[float]], float]]

MALE#

A tuple representing the male-specific parameters, where the first element is the suffix for male parameters and the second element is the function to compute the male-specific rate.

Type:

tuple[str, Callable[[str, str], Callable[[BaseParametrizedDemography, list[float]], float]]]

FEMALE#

A tuple representing the female-specific parameters, where the first element is the suffix for female parameters and the second element is the function to compute the female-specific rate.

Type:

tuple[str, Callable[[str, str], Callable[[BaseParametrizedDemography, list[float]], float]]]

__init__(suffix, expression)#

Initializes a SexType object.

Parameters:
  • suffix (str) – The suffix to be added to the parameter name to indicate the sex-specific parameter.

  • expression (Callable[[str, str], Callable[[BaseParametrizedDemography, list[float]], float]]) – A function that takes in the overall rate parameter and the sex bias parameter and returns a function to compute the corresponding rate for that sex in a demography.

static male_female_sex_type_function(multiplier)#

Returns a function \(f`(``[multiplier]`\)) to compute the sex-specific migration rates. Given a rate parameter and the accompanying sex bias, \(f`(``[multiplier])(rate, sex_bias)`\) will output a function to compute the corresponding rate in a demography.

Parameters:

multiplier (float) – A float parameter that indicates the sex for which the function will compute the migration rate. It should be -1 for male-specific parameters and +1 for female-specific parameters.

Returns:

A function that takes in the overall rate parameter and the sex bias parameter and returns a function to compute the corresponding rate for that sex in a demography.

Return type:

Callable[[str, str], Callable[[BaseParametrizedDemography, list[float]], float]]