DecantingPhyloTracker
- class DecantingPhyloTracker
Data structure to enable perfect tracking over a fixed-size population with synchronous generations.
Generally less performant than GarbageCollectingPhyloGracker; represents organism records as independent objects (which each require an independent allocations and, on lineage extinction, deletions). Uses a decanting buffer to reduce object creation overhead by only allocating record objects for organisms that produce extant lineages beyond a threshold length.
Does not include organism population loc and trait values in phylogenetic record.
- __init__(population_size: int, buffer_size: int = 10, share_common_ancestor: bool = True) None [source]
Initialize data structure to perfectly track phylogenetic history of a population.
Parameters
- population_sizeint
How many locations are available within the tracked fixed-size population?
- buffer_sizeint, optional
How many generations should lineages be decanted before creating record objects for organisms with extant lineages?
- share_common_ancestorbool, default True
Should a dummy common ancestor be inserted as the first entry in the tracker?
If True, all initial population members will be recorded as children of this dummy ancestor. If False, all initial population members will be recorded as having no parent.
Methods
- CompilePhylogeny(progress_wrap=<function DecantingPhyloTracker.<lambda>>) DataFrame [source]
Generate full phylogenetic record of extant organisms.
Parameters
- progress_wrapCallable, default identity function
Wrapper applied around record row iterator; pass tqdm or equivalent to display progress bar for compilation process.
Returns
- pandas.DataFrame
Full phylogenetic record of extant organisms alife standard format.
Notes
This operation is non-destructive; further record-keeping may be performed on the tracker object afterwards.
- ElapseGeneration(parent_locs: List[int]) None [source]
Append generational turnover to the phylogenetic record.
Parameters
- parent_locsarray_like of int
Parent’s population loc for each population loc.
Position within array corresponds to post-turnover population members’ population positions. Values within array correspond to those members’ parents’ population positions within the pre- turnover population.
- __init__(population_size: int, buffer_size: int = 10, share_common_ancestor: bool = True) None [source]
Initialize data structure to perfectly track phylogenetic history of a population.
Parameters
- population_sizeint
How many locations are available within the tracked fixed-size population?
- buffer_sizeint, optional
How many generations should lineages be decanted before creating record objects for organisms with extant lineages?
- share_common_ancestorbool, default True
Should a dummy common ancestor be inserted as the first entry in the tracker?
If True, all initial population members will be recorded as children of this dummy ancestor. If False, all initial population members will be recorded as having no parent.