Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 6e7af52

Browse files
authored
Merge pull request #521 from juanchopanza/issue-520
Add tests for section_tortuosity special case.
2 parents 1b5b420 + 9d6beb0 commit 6e7af52

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

neurom/fst/tests/test_sectionfunc.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ def test_setion_tortuosity_empty_section():
9494
nt.eq_(_sf.section_tortuosity(sec), 1.0)
9595

9696

97+
def test_section_tortuosity_looping_section():
98+
99+
sec = Section([
100+
(0, 0, 0), (1, 0, 0), (1, 2, 0), (0, 2, 0), (0, 0, 0)
101+
])
102+
103+
# is infinity
104+
nt.eq_(_sf.section_tortuosity(sec), np.inf)
105+
nt.ok_(math.isinf(_sf.section_tortuosity(sec)))
106+
nt.ok_(np.isinf(_sf.section_tortuosity(sec)))
107+
108+
# is not NaN
109+
nt.ok_(not math.isnan(_sf.section_tortuosity(sec)))
110+
nt.ok_(not np.isnan(_sf.section_tortuosity(sec)))
111+
112+
97113
def test_section_meander_angles():
98114

99115
s0 = Section(np.array([[0, 0, 0],

0 commit comments

Comments
 (0)