(
Q,
T,
m,
include=None,
discords=False,
T_subseq_isconstant=None,
Q_subseq_isconstant=None,
)
| 456 | |
| 457 | |
| 458 | def multi_mass( |
| 459 | Q, |
| 460 | T, |
| 461 | m, |
| 462 | include=None, |
| 463 | discords=False, |
| 464 | T_subseq_isconstant=None, |
| 465 | Q_subseq_isconstant=None, |
| 466 | ): |
| 467 | T_inf = np.isinf(T) |
| 468 | if np.any(T_inf): |
| 469 | T = T.copy() |
| 470 | T[T_inf] = np.nan |
| 471 | |
| 472 | Q_inf = np.isinf(Q) |
| 473 | if np.any(Q_inf): |
| 474 | Q = Q.copy() |
| 475 | Q[Q_inf] = np.nan |
| 476 | |
| 477 | T_subseq_isconstant = rolling_isconstant(T, m, T_subseq_isconstant) |
| 478 | Q_subseq_isconstant = rolling_isconstant(Q, m, Q_subseq_isconstant) |
| 479 | |
| 480 | d, n = T.shape |
| 481 | D = np.empty((d, n - m + 1)) |
| 482 | for i in range(d): |
| 483 | D[i] = distance_profile(Q[i], T[i], m) |
| 484 | for j in range(len(D[i])): |
| 485 | if np.isfinite(D[i, j]): |
| 486 | if Q_subseq_isconstant[i] and T_subseq_isconstant[i, j]: |
| 487 | D[i, j] = 0 |
| 488 | elif Q_subseq_isconstant[i] or T_subseq_isconstant[i, j]: |
| 489 | D[i, j] = np.sqrt(m) |
| 490 | else: # pragma: no cover |
| 491 | pass |
| 492 | |
| 493 | D[np.isnan(D)] = np.inf |
| 494 | |
| 495 | return D |
| 496 | |
| 497 | |
| 498 | def multi_mass_absolute(Q, T, m, include=None, discords=False, p=2.0): |
no test coverage detected