Function documentation#

fwdpy11.infinite_sites(rng, pop, mu)#
Parameters:
Returns:

Number of mutations added

Return type:

int

fwdpy11.simplify_tables(tables, samples)#

Simplify a TableCollection.

Parameters:
Returns:

A simplified TableCollection and an array containing remapped sample ids.

Return type:

tuple

New in version 0.3.0.

fwdpy11.evolvets(rng, pop, params, simplification_interval, recorder=None, *, post_simplification_recorder=None, suppress_table_indexing=None, record_gvalue_matrix=False, stopping_criterion=None, track_mutation_counts=False, remove_extinct_variants=True, preserve_first_generation=False)#

Evolve a population with tree sequence recording

Parameters:
  • rng (fwdpy11.GSLrng) – random number generator

  • pop (fwdpy11.DiploidPopulation) – A population

  • params (fwdpy11.ModelParams) – simulation parameters

  • simplification_interval (int) – Number of generations between simplifications.

  • recorder (Callable) – (None) A temporal sampler/data recorder.

  • post_simplification_recorder (Callable) – (None) A temporal sampler

  • suppress_table_indexing (Optional[bool]) – (None) Prevents edge table indexing until end of simulation. The default value (None) will be interpreted as True

  • record_gvalue_matrix (bool) – (False) Whether to record genetic values into fwdpy11.DiploidPopulation.genetic_values.

  • preserve_first_generation (bool) – (False) Whether to record generation 0 as ancient samples. Must be True for tree sequence “recapitation”. See Finishing a simulation with msprime.

The recording of genetic values into fwdpy11.DiploidPopulation.genetic_values is suppressed by default. First, it is redundant with fwdpy11.DiploidMetadata.g for the common case of mutational effects on a single trait. Second, we save some memory by not tracking these matrices. However, it is useful to track these data for some cases when simulating multivariate mutational effects (pleiotropy).

Note

If recorder is None, then fwdpy11.NoAncientSamples will be used.

If post_simplification_recorder is None, then fwdpy11.RecordNothing will be used.

Changed in version 0.5.2: Added post_simplification_recorder.

Changed in version 0.7.1: Added preserve_first_generation.

Changed in version 0.8.0: Update to refactored ModelParams. Added check_demographic_event_timings.

fwdpy11.data_matrix_from_tables(tables, samples, *, record_neutral=True, record_selected=True, include_fixations=False, begin=0.0, end=None)#

Create a fwdpy11.DataMatrix from a table collection.

Parameters:
  • tables (fwdpy11.TableCollection) – A TableCollection

  • samples (list or numpy.ndarray) – A list of sample nodes

  • record_neutral (bool) – (True) If True, generate data for neutral variants

  • record_selected (bool) – (True) If True, generate data for selected variants

  • include_selected (bool) – (False) Whether to include variants fixed in the sample

  • begin – (0.0) Start of range, inclusive

  • end – (max float) End of range, exclusive

Return type:

fwdpy11.DataMatrix

New in version 0.3.0.

Changed in version 0.4.1: Add begin, end options as floats

Changed in version 0.5.0: No longer requires fwdpy11.MutationVector argument