Configuration#

Lineage and locus configuration classes.

class LineageConfig(n: int | Dict[str, int] | List[int] | ndarray)[source]#

Bases: object

Class to hold the configuration for the number of lineages.

__init__(n: int | Dict[str, int] | List[int] | ndarray)[source]#

Initialize the population configuration.

Parameters:

n (Union[int, Dict[str, int], List[int], ndarray]) – Number of lineages. Either a single integer if only one population, or a list of integers or dictionary with population names as keys and number of lineages as values for multiple populations. By default, the populations are named ‘pop_0’, ‘pop_1’, etc.

lineages: ndarray#

Number of lineages per deme.

n: int#

Total number of lineages.

n_pops: int#

Number of populations.

pop_names: List[str]#

Names of populations.

property lineage_dict: Dict[str, int]#

Get a dictionary with the number of lineages per population.

Returns:

Number of lineages per population.

class LocusConfig(n: int = 1, n_unlinked: int = 0, recombination_rate: float = 0)[source]#

Bases: object

Class to hold the configuration of the number of loci and with how many independent loci to start.

__init__(n: int = 1, n_unlinked: int = 0, recombination_rate: float = 0)[source]#

Initialize the locus configuration.

Parameters:
  • n (int) – Number of loci. Either 1 or 2.

  • n_unlinked (int) – Number of lineages that are initially unlinked between loci. Defaults to 0 meaning that all lineages are initially linked between loci so that the loci are completely linked.

  • recombination_rate (float) – Recombination rate between loci.

n: int#

Number of loci.

n_unlinked: int#

Number of loci to start with.

recombination_rate: float#

Recombination rate.