Model parameters

class fwdpy11.ModelParams(*, nregions=NOTHING, sregions=NOTHING, recregions=NOTHING, rates, gvalue=None, demography=fwdpy11.DiscreteDemography(mass_migrations=None, set_growth_rates=None, set_deme_sizes=None, set_selfing_rates=None, migmatrix=None, set_migration_rates=None), simlen=0, prune_selected: bool = True, pself: float = 0.0, popsizes=NOTHING)

This class stores and validates the parameters of a simulation. Instances of this class are constructed using kwargs and instance attributes are immutable once initialized.

This class accepts the following kwargs, which are also the attribute names for instances:

Parameters

The following kwargs/attributes are pending deprecation along with simulations without tree sequence recording:

Parameters
  • pself – The probabilility that an individual selfs. For simulations with tree sequence recording, this parameter has no effect. Instead, use the methods described here.

  • popsizes (numpy.ndarray) – A list of population sizes over time. For simulations with tree sequence recording, this parameter has no effect. Instead, use the methods described here.

Note

To initialize the rates field, we require an instance of fwdpy11.MutationAndRecombinationRates or a list of length three (3) specifying the three rates. The two mutation rates must be non-negative floats. For the recombination rate, the third value must also be a non-negative float if all objects in recrates are instances of fwdpy11.Region. However, if they are instead instances of fwdpy11.GeneticMapUnit, then the final element in rates must be None. See the section on setting recombination rates for details.

New in version 0.1.1.

Changed in version 0.2.0: Changed this from a horrible class hierarchy into a much simpler, single class.

Changed in version 0.6.0: Updated to support fwdpy11.DiscreteDemography

Changed in version 0.8.0: Refactored class internals using attrs. Mutation and recombination rates now stored in fwdpy11.MutationAndRecombinationRates

__init__(*, nregions=NOTHING, sregions=NOTHING, recregions=NOTHING, rates, gvalue=None, demography=fwdpy11.DiscreteDemography(mass_migrations=None, set_growth_rates=None, set_deme_sizes=None, set_selfing_rates=None, migmatrix=None, set_migration_rates=None), simlen=0, prune_selected: bool = True, pself: float = 0.0, popsizes=NOTHING)None

Initialize self. See help(type(self)) for accurate signature.

asblack()

Return a string representation formatted with black

asdict()

Return dict representation

classmethod fromdict(d)

Build an instance from a dictionary

class fwdpy11.MutationAndRecombinationRates(*, neutral_mutation_rate, selected_mutation_rate, recombination_rate)

Stores and validates the mutation and recombination rate parameters of a simulation.

Instances of this class are created by kwargs that populate attributes of the same name:

Parameters
  • neutral_mutation_rate (float) –

  • selected_mutation_rate (float) –

  • recombination_rate (float or None) –

Instances of this class are passed as the rates kwarg to fwdpy11.ModelParams.

New in version 0.8.0.

__init__(*, neutral_mutation_rate, selected_mutation_rate, recombination_rate)None

Initialize self. See help(type(self)) for accurate signature.

asblack()

Return a string representation formatted with black

asdict()

Return dict representation

classmethod fromdict(d)

Build an instance from a dictionary