Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_calc_end_idx():
end_idx = scrimp.calc_end_idx(5, 0, 1, 2)
expecected_idx = 0
assert(end_idx == expecected_idx)
end_idx = scrimp.calc_end_idx(5, 1, 1, 2)
expecected_idx = 1
assert(end_idx == expecected_idx)
end_idx = scrimp.calc_end_idx(5, 2, 1, 2)
expecected_idx = 2
assert(end_idx == expecected_idx)
def test_calc_end_idx():
end_idx = scrimp.calc_end_idx(5, 0, 1, 2)
expecected_idx = 0
assert(end_idx == expecected_idx)
end_idx = scrimp.calc_end_idx(5, 1, 1, 2)
expecected_idx = 1
assert(end_idx == expecected_idx)
end_idx = scrimp.calc_end_idx(5, 2, 1, 2)
expecected_idx = 2
assert(end_idx == expecected_idx)
step_size = 0.25
# test index 0
idx = 0
profile_len = scrimp.calc_profile_len(len(ts), m)
exclusion_zone = scrimp.calc_exclusion_zone(m)
subsequence = scrimp.next_subsequence(ts, idx, m)
X, n, sumx2, sumx, meanx, sigmax2, sigmax = scrimp.fast_find_nn_pre(ts, m)
dp = scrimp.calc_distance_profile(X, subsequence, n, m, meanx, sigmax)
dp = scrimp.apply_exclusion_zone(idx, exclusion_zone, profile_len, dp)
mp = np.zeros(profile_len)
mp_index = np.zeros(profile_len, dtype='int32')
mp, mp_index, idx_nn = scrimp.find_and_store_nn(0, idx, mp, mp_index, dp)
idx_diff = scrimp.calc_idx_diff(idx, idx_nn)
step_size = scrimp.calc_step_size(m, step_size)
endidx = scrimp.calc_end_idx(profile_len, idx, step_size, idx_diff)
refine_distance = np.full(profile_len, np.inf)
result = scrimp.calc_refine_distance_end_idx(
refine_distance, dp, idx, endidx, meanx, sigmax, idx_nn, idx_diff, m)
expected_result = np.array([np.inf, np.inf, np.inf, np.inf, np.inf])
np.testing.assert_almost_equal(result, expected_result)
def test_calc_end_idx():
end_idx = scrimp.calc_end_idx(5, 0, 1, 2)
expecected_idx = 0
assert(end_idx == expecected_idx)
end_idx = scrimp.calc_end_idx(5, 1, 1, 2)
expecected_idx = 1
assert(end_idx == expecected_idx)
end_idx = scrimp.calc_end_idx(5, 2, 1, 2)
expecected_idx = 2
assert(end_idx == expecected_idx)