@@ -3738,11 +3738,10 @@ def check_ignore_trivial(T_A, T_B, ignore_trivial):
37383738
37393739 T_B : numpy.ndarray
37403740 The time series or sequence that will be used to annotate T_A. For every
3741- subsequence in T_A, its nearest neighbor in T_B will be recorded. Default is
3742- `None` which corresponds to a self-join.
3741+ subsequence in T_A, its nearest neighbor in T_B will be recorded.
37433742
37443743 ignore_trivial : bool
3745- Set to `True` if this is a self-join. Otherwise, for AB-join, set this
3744+ Set to `True` if this is a self-join. Otherwise, for an AB-join, set this
37463745 to `False`.
37473746
37483747 Returns
@@ -3752,7 +3751,7 @@ def check_ignore_trivial(T_A, T_B, ignore_trivial):
37523751
37533752 Notes
37543753 -----
3755- These warnings may be supressed by using a context manager
3754+ These warnings may be suppressed by using a context manager
37563755 ```
37573756 import stumpy
37583757 import numpy as np
@@ -4509,3 +4508,40 @@ def _update_incremental_PI(D, P, I, excl_zone, n_appended=0):
45094508 _shift_insert_at_index (I [- 1 ], idx , i + n_appended )
45104509
45114510 return
4511+
4512+
4513+ def check_self_join (ignore_trivial ):
4514+ """
4515+ A simple function to check whether `ignore_trivial` is `True` for a self-join
4516+
4517+ Otherwise, warn the user.
4518+
4519+ Parameters
4520+ ----------
4521+ ignore_trivial : bool
4522+ Set to True if this is a self-join. Otherwise, for AB-join, set this to False.
4523+
4524+ Returns
4525+ -------
4526+ None
4527+
4528+ Notes
4529+ -----
4530+ These warnings may be suppressed by using a context manager
4531+ ```
4532+ import stumpy
4533+ import numpy as np
4534+ import warnings
4535+
4536+ T = np.random.rand(10_000)
4537+ m = 50
4538+ with warnings.catch_warnings():
4539+ warnings.filterwarnings("ignore", message="`ignore_trivial` cannot be `False`")
4540+ for _ in range(5):
4541+ stumpy.stump(T, m, ignore_trivial=False)
4542+ ```
4543+ """
4544+ if ignore_trivial is False :
4545+ msg = "`ignore_trivial` cannot be `False` for a self-join and "
4546+ msg += "has been automatically overridden and set to `True`."
4547+ warnings .warn (msg )
0 commit comments