Skip to content

Commit

Permalink
Make has_no_back_tracking() compatible with generate_annotation()
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-berchet committed Apr 12, 2024
1 parent 8fbf63d commit ec05fff
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion neurom/check/morphology_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,5 +359,9 @@ def has_no_single_children(morph):

def has_no_back_tracking(morph):
"""Check if the morphology has sections with back-tracks."""
bad_ids = [i for neurite in iter_neurites(morph) for i in back_tracking_segments(neurite)]
bad_ids = [
(i, morph.section(i[0]).points[np.newaxis, i[1]])
for neurite in iter_neurites(morph)
for i in back_tracking_segments(neurite)
]
return CheckResult(len(bad_ids) == 0, bad_ids)
6 changes: 5 additions & 1 deletion tests/check/test_morphology_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,4 +483,8 @@ def test_has_no_back_tracking():
""", "asc")
result = morphology_checks.has_no_back_tracking(m)
assert result.status is False
assert result.info == [(2, 1, 0), (2, 1, 1)]
info = result.info
assert_array_equal(info[0][0], [2, 1, 0])
assert_array_equal(info[0][1], [[1, -3, 0]])
assert_array_equal(info[1][0], [2, 1, 1])
assert_array_equal(info[1][1], [[1, -3, 0]])

0 comments on commit ec05fff

Please sign in to comment.