Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def naive_mass(Q, T, m, trivial_idx, excl_zone):
D = np.linalg.norm(
core.z_norm(core.rolling_window(T, m), 1) - core.z_norm(Q), axis=1
)
start = max(0, trivial_idx - excl_zone)
stop = min(T.shape[0] - Q.shape[0] + 1, trivial_idx + excl_zone)
D[start:stop] = np.inf
return D
def test_mueen_calculate_distance_profile(Q, T):
m = Q.shape[0]
left = np.linalg.norm(
core.z_norm(core.rolling_window(T, m), 1) - core.z_norm(Q), axis=1
)
right = core.mueen_calculate_distance_profile(Q, T)
npt.assert_almost_equal(left, right)