Skip to content

Commit

Permalink
Merge pull request #384 from w-k-jones/fix_numba_pbc_dist_func
Browse files Browse the repository at this point in the history
Fix issue with numba and PBC dist func
  • Loading branch information
w-k-jones authored Dec 8, 2023
2 parents 08f84b2 + 17e12d2 commit 81ea461
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
11 changes: 11 additions & 0 deletions tobac/tests/test_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,17 @@ def test_build_distance_function():
1.4142135
)

test_func = tobac.tracking.build_distance_function(0, 10, None, None, "hdim_1")
assert test_func(np.array((0, 9, 9)), np.array((0, 0, 9))) == pytest.approx(1)

test_func = tobac.tracking.build_distance_function(None, None, 0, 10, "hdim_2")
assert test_func(np.array((0, 9, 9)), np.array((0, 9, 0))) == pytest.approx(1)

test_func = tobac.tracking.build_distance_function(None, None, None, None, "none")
assert test_func(np.array((0, 9, 9)), np.array((0, 0, 0))) == pytest.approx(
(2 * 81) ** 0.5
)


@pytest.mark.parametrize(
"point_init, speed, dxy, actual_dz, v_max, use_dz, features_connected",
Expand Down
8 changes: 4 additions & 4 deletions tobac/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,9 @@ def build_distance_function(min_h1, max_h1, min_h2, max_h2, PBC_flag):

return functools.partial(
pbc_utils.calc_distance_coords_pbc,
min_h1=min_h1,
max_h1=max_h1,
min_h2=min_h2,
max_h2=max_h2,
min_h1=min_h1 if min_h1 is not None else 0,
max_h1=max_h1 if max_h1 is not None else 0,
min_h2=min_h2 if min_h2 is not None else 0,
max_h2=max_h2 if max_h2 is not None else 0,
PBC_flag=PBC_flag,
)

0 comments on commit 81ea461

Please sign in to comment.