Esempio n. 1
0
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]))
Esempio n. 2
0
def test_section_tortuosity_looping_section():
    sec = Section([(0, 0, 0), (1, 0, 0), (1, 2, 0), (0, 2, 0), (0, 0, 0)])

    # is infinity
    nt.eq_(_sf.section_tortuosity(sec), np.inf)
    nt.ok_(math.isinf(_sf.section_tortuosity(sec)))
    nt.ok_(np.isinf(_sf.section_tortuosity(sec)))

    # is not NaN
    nt.ok_(not math.isnan(_sf.section_tortuosity(sec)))
    nt.ok_(not np.isnan(_sf.section_tortuosity(sec)))
Esempio n. 3
0
def test_section_tortuosity():

    sec_a = Section([(0, 0, 0), (1, 0, 0), (2, 0, 0), (3, 0, 0)])

    sec_b = Section([(0, 0, 0), (1, 0, 0), (1, 2, 0), (0, 2, 0)])

    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]))
Esempio n. 4
0
def test_section_tortuosity_looping_section():

    sec = Section([(0, 0, 0), (1, 0, 0), (1, 2, 0), (0, 2, 0), (0, 0, 0)])

    # is infinity
    nt.eq_(_sf.section_tortuosity(sec), np.inf)
    nt.ok_(math.isinf(_sf.section_tortuosity(sec)))
    nt.ok_(np.isinf(_sf.section_tortuosity(sec)))

    # is not NaN
    nt.ok_(not math.isnan(_sf.section_tortuosity(sec)))
    nt.ok_(not np.isnan(_sf.section_tortuosity(sec)))
Esempio n. 5
0
def test_section_tortuosity():
    sec_a = Section([(0, 0, 0), (1, 0, 0), (2, 0, 0), (3, 0, 0)])

    sec_b = Section([(0, 0, 0), (1, 0, 0), (1, 2, 0), (0, 2, 0)])

    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]))
Esempio n. 6
0
def test_section_tortuosity_looping_section():
    sec = Section([
        (0, 0, 0), (1, 0, 0), (1, 2, 0), (0, 2, 0), (0, 0, 0)
    ])

    with warnings.catch_warnings(record=True):
        nt.eq_(_sf.section_tortuosity(sec), np.inf)
Esempio n. 7
0
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[1]
    with warnings.catch_warnings(record=True):
        nt.eq_(_sf.section_tortuosity(sec), np.inf)
Esempio n. 8
0
def test_setion_tortuosity_empty_section():
    sec = Section([])
    nt.eq_(_sf.section_tortuosity(sec), 1.0)
Esempio n. 9
0
def test_setion_tortuosity_single_point():
    sec = Section([(1, 2, 3)])
    nt.eq_(_sf.section_tortuosity(sec), 1.0)
Esempio n. 10
0
def test_setion_tortuosity_empty_section():
    sec = Section([])
    nt.eq_(_sf.section_tortuosity(sec), 1.0)
Esempio n. 11
0
def test_setion_tortuosity_single_point():
    sec = Section([(1, 2, 3)])
    nt.eq_(_sf.section_tortuosity(sec), 1.0)