def test_section_tortuosity(): sec_a = load_neuron(StringIO(u""" ((CellBody) (0 0 0 2)) ((Dendrite) (0 0 0 2) (1 0 0 2) (2 0 0 2) (3 0 0 2))"""), reader='asc').sections[1] sec_b = load_neuron(StringIO(u""" ((CellBody) (0 0 0 2)) ((Dendrite) (0 0 0 2) (1 0 0 2) (1 2 0 2) (0 2 0 2))"""), reader='asc').sections[1] nt.eq_(_sf.section_tortuosity(sec_a), 1.0) nt.eq_(_sf.section_tortuosity(sec_b), 4.0 / 2.0) for s in _nf.iter_sections(NRN): nt.eq_( _sf.section_tortuosity(s), mmth.section_length(s.points) / mmth.point_dist(s.points[0], s.points[-1]))
def test_section_tortuosity(): sec_a = load_neuron(StringIO(u""" ((CellBody) (0 0 0 2)) ((Dendrite) (0 0 0 2) (1 0 0 2) (2 0 0 2) (3 0 0 2))"""), reader='asc').sections[SECTION_ID] sec_b = load_neuron(StringIO(u""" ((CellBody) (0 0 0 2)) ((Dendrite) (0 0 0 2) (1 0 0 2) (1 2 0 2) (0 2 0 2))"""), reader='asc').sections[SECTION_ID] assert _sf.section_tortuosity(sec_a) == 1.0 assert _sf.section_tortuosity(sec_b) == 4.0 / 2.0 for s in _nf.iter_sections(NRN): assert (_sf.section_tortuosity(s) == mmth.section_length(s.points) / mmth.point_dist(s.points[0], s.points[-1]))
def test_section_tortuosity_looping_section(): sec = load_neuron(StringIO(u""" ((CellBody) (0 0 0 2)) ((Dendrite) (0 0 0 2) (1 0 0 2) (1 2 0 2) (0 2 0 2) (0 0 0 2))"""), reader='asc').sections[SECTION_ID] with warnings.catch_warnings(record=True): nt.eq_(_sf.section_tortuosity(sec), np.inf)
def test_setion_tortuosity_single_point(): sec = load_neuron(StringIO(u"""((CellBody) (0 0 0 2)) ((Dendrite) (1 2 3 2))"""), reader='asc').sections[SECTION_ID] nt.eq_(_sf.section_tortuosity(sec), 1.0)