Skip to content

Commit b99f2f6

Browse files
hyanwongbenjeffery
authored andcommitted
Doc syntax correction for embedded backtick
I think you need to have a `\ ` after a backtick within a string oc characters
1 parent 13e56d6 commit b99f2f6

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

python/tskit/trees.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8823,36 +8823,38 @@ def pca(
88238823
:math:`M_{ij}` the output of
88248824
:meth:`genetic_relatedness <.TreeSequence.genetic_relatedness>`
88258825
between sample :math:`i` and sample :math:`j`, then by default this returns
8826-
the top `num_components` eigenvectors of :math:`M`, so that
8827-
`output.factors[i,k]` is the position of sample `i` on the `k`th PC.
8828-
If `samples` or `individuals` are provided, then this does the same thing,
8829-
except with :math:`M_{ij}` either the relatedness between `samples[i]`
8830-
and `samples[j]` or the nodes of `individuals[i]` and `individuals[j]`,
8826+
the top ``num_components`` eigenvectors of :math:`M`, so that
8827+
``output.factors[i,k]`` is the position of sample `i` on the `k` th PC.
8828+
If ``samples`` or ``individuals`` are provided, then this does the same thing,
8829+
except with :math:`M_{ij}` either the relatedness between ``samples[i]``
8830+
and ``samples[j]`` or the nodes of ``individuals[i]`` and ``individuals[j]``,
88318831
respectively.
88328832
8833-
The parameters `centre` and `mode` are passed to
8833+
The parameters ``centre`` and ``mode`` are passed to
88348834
:meth:`genetic_relatedness <.TreeSequence.genetic_relatedness>`;
8835-
if `windows` are provided then PCA is carried out separately in each window.
8836-
If `time_windows` is provided, then genetic relatedness is measured using only
8835+
if ``windows`` are provided then PCA is carried out separately in each window.
8836+
If ``time_windows`` is provided, then genetic relatedness is measured using only
88378837
ancestral material within the given time window (see
88388838
:meth:`decapitate <.TreeSequence.decapitate>` for how this is defined).
88398839
88408840
So that the method scales to large tree sequences, the underlying method
88418841
relies on a randomized SVD algorithm, using
88428842
:meth:`genetic_relatedness_vector <.TreeSequence.genetic_relatedness_vector>`).
8843-
Larger values of `num_iterations` and
8844-
`num_oversamples` should produce better approximations to the true eigenvalues,
8843+
Larger values of ``num_iterations`` and
8844+
``num_oversamples`` should produce better approximations to the true eigenvalues,
88458845
at the cost of greater compute times and/or memory usage. The method relies on
8846-
constructing `range_sketch`, a low-dimensional approximation to the range
8847-
of :math:`M`, so that the result of a previous call to `pca()` may be passed in.
8846+
constructing ``range_sketch``, a low-dimensional approximation to the range
8847+
of :math:`M`, so that the result of a previous call to ``pca()`` may be passed
8848+
in.
8849+
88488850
To check for convergence, compare
8849-
`pc1 = ts.pca()` and `pc2 = ts.pca(range_sketch=pc1.range_sketch)`; the
8850-
difference between `pc1.factors` and `pc2.factors` provides a
8851+
``pc1 = ts.pca()`` and ``pc2 = ts.pca(range_sketch=pc1.range_sketch)``; the
8852+
difference between ``pc1.factors`` and ``pc2.factors`` provides a
88518853
diagnostic of the convergence of the algorithm (i.e., if they are close
8852-
then it has likely converged). Alternatively, the output value of `error_bound`
8854+
then it has likely converged). Alternatively, the output value of ``error_bound``
88538855
gives an approximate upper bound for the spectral norm of the difference
88548856
between :math:`M` and the projection of :math:`M` into the space spanned by
8855-
the columns of `range_sketch`.
8857+
the columns of ``range_sketch``.
88568858
Algorithms are based on Algorithms 8
88578859
and 9 in Martinsson and Tropp, https://arxiv.org/pdf/2002.01387 .
88588860
@@ -8861,7 +8863,7 @@ def pca(
88618863
to compute the statistic in (default: the entire genome).
88628864
:param numpy.ndarray samples: Samples to perform PCA with (default: all samples).
88638865
:param numpy.ndarray individuals: Individuals to perform PCA with. Cannot specify
8864-
both `samples` and `individuals`.
8866+
both ``samples`` and ``individuals``.
88658867
:param numpy.ndarray time_windows: The time interval on which to apply PCA:
88668868
currently, this must be either None (default, covers all time)
88678869
or a single interval.

0 commit comments

Comments
 (0)