API Documentation

An example Python package, illustrating current best-practises.

kingman.simulate(sample_size, random_seed=None)

Simulates the Kingman coalescent for the specified sample size and random seed.

Returns a tuple (parent, time) which describes the simulated history of the sample as an oriented forest. parent is a list of integers, in which the parent of node j is parent[j]. time an array of floating point values in which the time at which node j was created is time[j]. See http://jeromekelleher.github.io/ercs/#oriented-trees-and-forests for further information on oriented forests.

Time is measured in units of 4Ne generations, following Hudson’s ms.

Parameters:
  • sample_size (integer) – The sample size; must be >= 2.
  • random_seed (integer or None) – The random seed for simulations
Return type:

(list, list)