Skip to content

Commit be7d84f

Browse files
hyanwongmergify[bot]
authored andcommitted
Clarify Tree.samples() behaviour w/ isolated nodes
Just to make it clear that this still works when a node is not "in" the tree topology.
1 parent 7ddcc95 commit be7d84f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

python/tskit/trees.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,9 +2181,12 @@ def _sample_generator(self, u):
21812181
def samples(self, u=None):
21822182
"""
21832183
Returns an iterator over the numerical IDs of all the sample nodes in
2184-
this tree that are underneath node ``u``. If ``u`` is a sample, it is
2185-
included in the returned iterator. If u is not specified, return all
2186-
sample node IDs in the tree.
2184+
this tree that are underneath the node with ID ``u``. If ``u`` is a sample,
2185+
it is included in the returned iterator. If ``u`` is not a sample, it is
2186+
possible for the returned iterator to be empty, for example if ``u`` is an
2187+
:meth:`isolated<Tree.is_isolated>` node that is not part of the the current
2188+
topology. If u is not specified, return all sample node IDs in the tree
2189+
(equivalent to all the sample node IDs in the tree sequence).
21872190
21882191
If the :meth:`TreeSequence.trees` method is called with
21892192
``sample_lists=True``, this method uses an efficient algorithm to find

0 commit comments

Comments
 (0)