Skip to content

Commit

Permalink
modify curve index function so that warnings are not output when leng…
Browse files Browse the repository at this point in the history
…ths are not valid
  • Loading branch information
eberrigan committed Jun 27, 2024
1 parent 7a95c8b commit 27ac126
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion sleap_roots/lengths.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def get_curve_index(
& (~np.isnan(base_tip_dists))
& (lengths > 0)
& (lengths >= base_tip_dists),
(lengths - base_tip_dists) / lengths,
(lengths - base_tip_dists) / np.where(lengths != 0, lengths, np.nan),
np.nan,
)

Expand Down
1 change: 0 additions & 1 deletion tests/test_lengths.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,6 @@ def test_invalid_scalar_values():
assert np.isnan(get_curve_index(0, 8))


# tests for `get_root_lengths`
def test_curve_index_float():
assert get_curve_index(10.0, 5.0) == 0.5

Expand Down

0 comments on commit 27ac126

Please sign in to comment.