Post-processors

Overview

We use the phrase “post-processors” to auxilliary actions you want to perform each generation that aren’t statistics. This includes actions such as writing phenotypes or haplotypes to disk and erasing data from previous generations to limit memory use. We go through these features below

Limiting memory use

We can use xft.proc.LimitMemory to delete data that we no longer require at the end of each generation. Usage is straightforward following the docstring:

[3]:
import xftsim as xft

?xft.proc.LimitMemory
Init signature:
xft.proc.LimitMemory(
    n_haplotype_generations: int = -1,
    n_phenotype_generations: int = -1,
)
Docstring:
Class to limit the amount of memory used by the simulation by deleting old haplotype and/or phenotype data.
Parameters:
-----------
n_haplotype_generations: int, optional
    The number of haplotype generations to keep. If -1, keep all generations. Default is -1.
n_phenotype_generations: int, optional
    The number of phenotype generations to keep. If -1, keep all generations. Default is -1.

Methods:
--------
processor(sim: xft.sim.Simulation) -> None:
    Deletes old haplotype and/or phenotype data from the simulation.
File:           ~/Dropbox/ftsim/xftsim/xftsim/proc.py
Type:           type
Subclasses:

Saving output to disk

This feature is coming soon. For now, we recommend running simulations one generation at a time and saving when desired. For information on writing data to disk, see the founder data tutorial.