Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CODE: Docstring #76

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tstrait/genetic_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def sim_genetic(ts, trait_df, alpha=0, random_seed=None):

Examples
--------
See :ref:`genetic` for worked examples.
See :ref:`genetic_value` for worked examples.
"""

ts = _check_instance(ts, "ts", tskit.TreeSequence)
Expand Down
2 changes: 1 addition & 1 deletion tstrait/simulate_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def sim_env(genetic_df, h2, random_seed=None):

Examples
--------
See :ref:`environment` for worked examples.
See :ref:`environment_noise` for worked examples.
"""
genetic_df = _check_dataframe(
genetic_df, ["trait_id", "individual_id", "genetic_value"], "genetic_df"
Expand Down
34 changes: 18 additions & 16 deletions tstrait/trait_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TraitModel(metaclass=ABCMeta):
"""
Superclass of the trait model.

Parameters
Attributes
----------
name : str
Name of the trait model.
Expand Down Expand Up @@ -479,64 +479,66 @@ def trait_model(distribution, **kwargs):

Examples
--------
>>> import tstrait

Constructing a normal distribution trait model with mean :math:`0` and
variance :math:`1`.

>>> import tstrait
>>> model = tstrait.trait_model(distribution="normal", mean=0, var=1)
>>> model.name
"normal"
'normal'

Constructing a student's t-distribution trait model with mean :math:`0`,
variance :math:`1` and degrees of freedom :math:`1`.

>>> model = tstrait.trait_model(distribution="t", mean=0, var=1, df=1)
>>> model.name
"t"
't'

Constructing a fixed value trait model with value :math:`1`.

>>> model = tstrait.trait_model(distribution="fixed", value=1)
>>> model.name
"fixed"
'fixed'

Constructing an exponential distribution trait model with scale
:math:`1`.

>>> model = tstrait.trait_model(distribution="exponential", scale=1)
>>> model.name
"exponential"
'exponential'

Constructing an exponential distribution trait model with scale
:math:`1`, and enable simulation of negative values.

>>> model = tstrait.trait_model(distribution="exponential", scale=1,
>>> ... negative=True)
>>> model = tstrait.trait_model(distribution="exponential", scale=1, \
negative=True)

Constructing a gamma distribution trait model with shape :math:`1`
and scale :math:`2`.

>>> model = tstrait.trait_model(distribution="gamma", shape=1,
>>> ... scale=2)
>>> model = tstrait.trait_model(distribution="gamma", shape=1, scale=2)
>>> model.name
"gamma"
'gamma'

Constructing a gamma distribution trait model with shape :math:`1`,
scale :math:`2`, and allow simulation of negative values.

>>> model = tstrait.trait_model(distribution="gamma", shape=1,
>>> ... scale=2, negative=True)
>>> model = tstrait.trait_model(distribution="gamma", shape=1, scale=2, \
negative=True)
>>> model.name
"gamma"
'gamma'

Constructing a multivariate normal distribution trait model with
mean vector :math:`[0, 0]` and covariance matrix being an
identity matrix.

>>> import numpy as np
>>> model = tstrait.trait_model(distribution="multi_normal",
>>> ... mean=np.zeros(2), cov=np.eye(2))
>>> model = tstrait.trait_model(distribution="multi_normal", \
mean=np.zeros(2), cov=np.eye(2))
>>> model.name
"multi_normal"
'multi_normal'
>>> model.num_trait
2
"""
Expand Down
Loading