Skip to content

Commit f582dcc

Browse files
authored
Merge pull request #1563 from hyanwong/patch-26
Add an extra note about np.nan etc
2 parents 6ed8957 + 6ce2364 commit f582dcc

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

python/tskit/util.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,17 @@ def canonical_json(obj):
5959
def is_unknown_time(time):
6060
"""
6161
As the default unknown mutation time (:const:`UNKNOWN_TIME`) is a specific NAN value,
62-
equality always fails. This method compares the bitfield such that unknown times can
63-
be detected. Either single floats can be passed or lists/arrays.
62+
equality always fails (A NAN value is not equal to itself by definition).
63+
This method compares the bitfield such that unknown times can be detected. Either
64+
single floats can be passed or lists/arrays.
65+
66+
Note that NANs are a set of floating-point values. `tskit.UNKNOWN_TIME` is a specific
67+
value in this set. `np.nan` is a differing value, but both are NAN.
68+
See https://en.wikipedia.org/wiki/NaN
69+
70+
This function only returns true for ``tskit.is_unknown_time(tskit.UNKNOWN_TIME)``
71+
and will return false for ``tskit.is_unknown_time(np.nan)`` or any other NAN or
72+
non-NAN value.
6473
6574
:param time: Value or array to check.
6675
:type time: Union[float, array-like]

0 commit comments

Comments
 (0)