Skip to content

Commit

Permalink
Undocument Tree.sample_size
Browse files Browse the repository at this point in the history
Fixes #1966
  • Loading branch information
hyanwong authored Nov 29, 2021
1 parent 1e15ea0 commit 64cb77d
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions python/tskit/trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -1554,28 +1554,14 @@ def span(self):
"""
return self.interval.span

# The sample_size (or num_samples) is really a property of the tree sequence,
# and so we should provide access to this via a tree.tree_sequence.num_samples
# property access. However, we can't just remove the method as a lot of code
# may depend on it. To complicate things a bit more, sample_size has been
# changed to num_samples elsewhere for consistency. We can't do this here
# because there is already a num_samples method which returns the number of
# samples below a particular node. The best thing to do is probably to
# undocument the sample_size property, but keep it around for ever.

def get_sample_size(self):
# Deprecated alias for self.sample_size
return self.sample_size

@property
def sample_size(self):
"""
Returns the sample size for this tree. This is the number of sample
nodes in the tree.
:return: The number of sample nodes in the tree.
:rtype: int
"""
# Deliberately undocumented but kept for backwards compatibility.
# The proper way to access this is via tree.tree_sequence.num_samples
return self._ll_tree.get_sample_size()

def draw_text(
Expand Down

0 comments on commit 64cb77d

Please sign in to comment.