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_stumped_self_join(T_A, T_B, dask_client):
m = 3
zone = int(np.ceil(m / 4))
left = np.array(
[
naive_mass(Q, T_B, m, i, zone, True)
for i, Q in enumerate(core.rolling_window(T_B, m))
],
dtype=object,
)
right = stumped(dask_client, T_B, m, ignore_trivial=True)
replace_inf(left)
replace_inf(right)
npt.assert_almost_equal(left, right)
def test_stumped_A_B_join_df(T_A, T_B, dask_client):
m = 3
left = np.array(
[naive_mass(Q, T_A, m) for Q in core.rolling_window(T_B, m)], dtype=object
)
right = stumped(
dask_client, pd.Series(T_A), m, pd.Series(T_B), ignore_trivial=False
)
replace_inf(left)
replace_inf(right)
npt.assert_almost_equal(left, right)
def test_stumped_self_join_df(T_A, T_B, dask_client):
m = 3
zone = int(np.ceil(m / 4))
left = np.array(
[
naive_mass(Q, T_B, m, i, zone, True)
for i, Q in enumerate(core.rolling_window(T_B, m))
],
dtype=object,
)
right = stumped(dask_client, pd.Series(T_B), m, ignore_trivial=True)
replace_inf(left)
replace_inf(right)
npt.assert_almost_equal(left, right)
def test_stump_self_join_larger_window_df(T_A, T_B, dask_client):
for m in [8, 16, 32]:
if len(T_B) > m:
zone = int(np.ceil(m / 4))
left = np.array(
[
naive_mass(Q, T_B, m, i, zone, True)
for i, Q in enumerate(core.rolling_window(T_B, m))
],
dtype=object,
)
right = stumped(dask_client, pd.Series(T_B), m, ignore_trivial=True)
replace_inf(left)
replace_inf(right)
npt.assert_almost_equal(left, right)
def test_stumped_A_B_join(T_A, T_B, dask_client):
m = 3
left = np.array(
[naive_mass(Q, T_A, m) for Q in core.rolling_window(T_B, m)], dtype=object
)
right = stumped(dask_client, T_A, m, T_B, ignore_trivial=False)
replace_inf(left)
replace_inf(right)
npt.assert_almost_equal(left, right)
def test_stump_self_join_larger_window(T_A, T_B, dask_client):
for m in [8, 16, 32]:
if len(T_B) > m:
zone = int(np.ceil(m / 4))
left = np.array(
[
naive_mass(Q, T_B, m, i, zone, True)
for i, Q in enumerate(core.rolling_window(T_B, m))
],
dtype=object,
)
right = stumped(dask_client, T_B, m, ignore_trivial=True)
replace_inf(left)
replace_inf(right)
npt.assert_almost_equal(left, right)