コード例 #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[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]))
コード例 #2
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]))
コード例 #3
0
ファイル: neuronfunc.py プロジェクト: adrien-berchet/NeuroM
def trunk_section_lengths(nrn, neurite_type=NeuriteType.all):
    """List of lengths of trunk sections of neurites in a neuron."""
    neurite_filter = is_type(neurite_type)
    return [
        morphmath.section_length(s.root_node.points) for s in nrn.neurites
        if neurite_filter(s)
    ]
コード例 #4
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]))
コード例 #5
0
def section_tortuosity(section):
    '''Tortuosity of a section

    The tortuosity is defined as the ratio of the path length of a section
    and the euclidian distnce between its end points.

    The path length is the sum of distances between consecutive points.

    If the section contains less than 2 points, the value 1 is returned.
    '''
    pts = section.points
    return 1 if len(pts) < 2 else mm.section_length(pts) / mm.point_dist(pts[-1], pts[0])
コード例 #6
0
ファイル: test_sectionfunc.py プロジェクト: yamagatm/NeuroM
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]))
コード例 #7
0
ファイル: neuron_checks.py プロジェクト: juanchopanza/NeuroM
def has_all_nonzero_section_lengths(neuron, threshold=0.0):
    '''Check presence of neuron sections with length not above threshold

    Arguments:
        neuron: Neuron object whose segments will be tested
        threshold: value above which a section length is considered to be non-zero

    Return:
        status and list of ids bad sections
    '''
    bad_ids = [s.id for s in _nf.iter_sections(neuron.neurites)
               if section_length(s.points) <= threshold]

    return CheckResult(len(bad_ids) == 0, bad_ids)
コード例 #8
0
ファイル: neuron_checks.py プロジェクト: jdcourcol/NeuroM
def has_all_nonzero_section_lengths(neuron, threshold=0.0):
    '''Check presence of neuron sections with length not above threshold

    Arguments:
        neuron(Neuron): The neuron object to test
        threshold(float): value above which a section length is considered
        to be non-zero

    Returns:
        CheckResult with result including list of ids bad sections
    '''
    bad_ids = [s.id for s in _nf.iter_sections(neuron.neurites)
               if section_length(s.points) <= threshold]

    return CheckResult(len(bad_ids) == 0, bad_ids)
コード例 #9
0
ファイル: neuron_checks.py プロジェクト: sbahsoun/NeuroM
def has_all_nonzero_section_lengths(neuron, threshold=0.0):
    '''Check presence of neuron sections with length not above threshold

    Arguments:
        neuron(Neuron): The neuron object to test
        threshold(float): value above which a section length is considered
        to be non-zero

    Returns:
        CheckResult with result including list of ids of bad sections
    '''
    bad_ids = [s.id for s in _nf.iter_sections(neuron.neurites)
               if section_length(s.points) <= threshold]

    return CheckResult(len(bad_ids) == 0, bad_ids)
コード例 #10
0
ファイル: _neuron.py プロジェクト: ZeitgeberH/NeuroM
 def length(self):
     """Return the path length of this section."""
     return morphmath.section_length(self.points)
コード例 #11
0
ファイル: _neuritefunc.py プロジェクト: jdcourcol/NeuroM
 def _seclen(sec, **kwargs):
     """get section length of `sec`"""
     return morphmath.section_length(sec.points, **kwargs)
コード例 #12
0
def trunk_section_lengths(nrn, neurite_type=NeuriteType.all):
    '''list of lengths of trunk sections of neurites in a neuron'''
    neurite_filter = is_type(neurite_type)
    return [mm.section_length(s.root_node.points) for s in nrn.neurites if neurite_filter(s)]
コード例 #13
0
def _section_length(section):
    """Get section length of `section`."""
    return morphmath.section_length(section.points)
コード例 #14
0
 def sec_len(sec):
     """Return the length of a section."""
     return mm.section_length(sec.points)
コード例 #15
0
ファイル: sections.py プロジェクト: juanchopanza/NeuroM
def length(section):
    '''Return the length of a section'''
    return mm.section_length(section)
コード例 #16
0
def sec_len(sec):
    '''Return the length of a section'''
    return mm.section_length(sec.points)
コード例 #17
0
ファイル: _neuron.py プロジェクト: BlueBrain/NeuroM
 def length(self):
     '''Return the path length of this section.'''
     return morphmath.section_length(self.points)
コード例 #18
0
ファイル: _neuron.py プロジェクト: boazmohar/NeuroM
 def length(self):
     '''Return the path length of this section.'''
     return morphmath.section_length(self.points)
コード例 #19
0
 def _seclen(sec, **kwargs):
     '''get section length of `sec`'''
     return morphmath.section_length(sec.points, **kwargs)
コード例 #20
0
ファイル: _neuritefunc.py プロジェクト: BlueBrain/NeuroM
def _section_length(section):
    '''get section length of `section`'''
    return morphmath.section_length(section.points)
コード例 #21
0
ファイル: sectionfunc.py プロジェクト: juanchopanza/NeuroM
def section_path_length(section):
    '''Path length from section to root'''
    return sum(mm.section_length(s.points) for s in section.iupstream())
コード例 #22
0
ファイル: _neuritefunc.py プロジェクト: nagyistge/NeuroM
def _section_length(section):
    '''get section length of `section`'''
    return morphmath.section_length(section.points)
コード例 #23
0
 def sec_len(sec):
     '''Return the length of a section'''
     return mm.section_length(sec.points)