tracts.demography.base_parametrized_demography.FounderEvent#
- class FounderEvent(found_time, source_populations, remainder_population, end_time=None, pulse_pops=[])#
Bases:
BaseFounderEventA class that sets up a founder event. See
BaseFounderEventfor details.- found_time#
The name of the parameter defining the time of the founder event.
- Type:
str
- source_populations#
A dict mapping source population names to their contribution proportions.
- Type:
dict[str, str]
- remainder_population#
The population that contributes the remaining proportion to the new population after the source populations have contributed according to their specified proportions.
- Type:
str
- end_time#
The name of the parameter defining the end time of the founder event. If None, the founder event is a pulse event. If not None, the founder event is a continuous event that starts at
found_timeand ends atend_time.- Type:
str | None
- logger#
The logger.
- Type:
logging.Logger
- __init__(found_time, source_populations, remainder_population, end_time=None, pulse_pops=[])#
Initializes the founder event.
- Parameters:
found_time (
str) – The name of the parameter defining the time of the founder event.source_populations (
dict[str,str]) – A dict mapping source population names to their contribution proportions.remainder_population (
str) – The population that contributes the remaining proportion to the new population after the source populations have contributed according to their specified proportions.end_time (
str|None) – The name of the parameter defining the end time of the founder event. If None, the founder event is a pulse event. If not None, the founder event is a continuous event that starts atfound_timeand ends atend_time.
- execute(parametrized_demography, params, rate_tol=0.0001)#
Executes the founder event by modifying the migration matrix of the demography according to the parameters of the founder event.
- Parameters:
parametrized_demography (
BaseParametrizedDemography) – The demography object that the founder event is being executed on. The migration matrix of the demography will be modified according to the parameters of the founder event.params (
list[float]) – The list of parameters for the founder event.rate_tol (
float) – The tolerance to check whether the migration rates sum to more than 1. This is used to allow for some numerical imprecision in the migration rates. If the migration rates sum to more than 1 by more than this tolerance, a warning is logged.
- Returns:
The migration matrix of the demography after the founder event has been executed.
- Return type:
np.ndarray