Skip to content

Commit 1977825

Browse files
committed
Add code to resolve warning
1 parent 47884e6 commit 1977825

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

stumpy/core.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,6 +2254,7 @@ def preprocess_diagonal(
22542254

22552255
M_T, Σ_T = compute_mean_std(T, m)
22562256
Σ_T[T_subseq_isconstant] = 1.0 # Avoid divide by zero in next inversion step
2257+
Σ_T[~T_subseq_isfinite] = 1.0
22572258
Σ_T_inverse = 1.0 / Σ_T
22582259
M_T_m_1, _ = compute_mean_std(T, m - 1)
22592260

tests/test_core.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,9 +881,11 @@ def test_preprocess_non_normalized():
881881
def test_preprocess_diagonal():
882882
T = np.array([0, np.nan, 2, 3, 4, 5, 6, 7, np.inf, 9])
883883
m = 3
884+
T_subseq_isfinite = core.rolling_isfinite(T, m)
884885

885886
ref_T = np.array([0, 0, 2, 3, 4, 5, 6, 7, 0, 9], dtype=float)
886887
ref_M, ref_Σ = naive.compute_mean_std(ref_T, m)
888+
ref_Σ[~T_subseq_isfinite] = 1.0
887889
ref_Σ_inverse = 1.0 / ref_Σ
888890
ref_M_m_1, _ = naive.compute_mean_std(ref_T, m - 1)
889891

0 commit comments

Comments
 (0)