tspop is a convenience library that makes it easy to to extract local ancestry from tree sequence genealogies, using the efficient link-ancestors method provided by tskit.

pop_ancestry = tspop.get_pop_ancestry(ts, census_time=100.01)
print(pop_ancestry)

Contributors