Ejemplo n.º 1
0
def diameter_power_relation(bif_point, method='first'):
    """Calculate the diameter power relation at a bifurcation point.

    The diameter power relation is defined in https://www.ncbi.nlm.nih.gov/pubmed/18568015

    This quantity gives an indication of how far the branching is from
    the Rall ratio

    diameter_power_relation==1 means perfect Rall ratio
    """
    _raise_if_not_bifurcation(bif_point)

    if method not in {'first', 'mean'}:
        raise ValueError(
            'Please provide a valid method for sibling ratio, found %s' %
            method)

    if method == 'first':
        d_child = bif_point.points[-1, COLS.R]
        d_child1 = bif_point.children[0].points[0, COLS.R]
        d_child2 = bif_point.children[1].points[0, COLS.R]
    if method == 'mean':
        d_child = sectionfunc.section_mean_radius(bif_point)
        d_child1 = sectionfunc.section_mean_radius(bif_point.children[0])
        d_child2 = sectionfunc.section_mean_radius(bif_point.children[1])
    return (d_child / d_child1)**(1.5) + (d_child / d_child2)**(1.5)
Ejemplo n.º 2
0
def test_mean_radius():
    s = load_neuron(StringIO(u"""
    ((CellBody)
     (0 0 0 1))

    ((Dendrite)
    (0 0 0 0)
    (3 0 4 200)
    (6 4 4 400))"""),
                    reader='asc').neurites[0]

    nt.assert_equal(_sf.section_mean_radius(s), 100.)
Ejemplo n.º 3
0
def test_mean_radius():
    n = load_neuron(StringIO(u"""
    ((CellBody)
     (0 0 0 1))

    ((Dendrite)
    (0 0 0 0)
    (3 0 4 200)
    (6 4 4 400))"""),
                    reader='asc')

    assert (_sf.section_mean_radius(n.neurites[0]) == 100.)
Ejemplo n.º 4
0
def sibling_ratio(bif_point, method='first'):
    """Calculate the sibling ratio of a bifurcation point.

    The sibling ratio is the ratio between the diameters of the
    smallest and the largest child. It is a real number between
    0 and 1. Method argument allows one to consider mean diameters
    along the child section instead of diameter of the first point.
    """
    _raise_if_not_bifurcation(bif_point)

    if method not in {'first', 'mean'}:
        raise ValueError(
            'Please provide a valid method for sibling ratio, found %s' %
            method)

    if method == 'first':
        n = bif_point.children[0].points[0, COLS.R]
        m = bif_point.children[1].points[0, COLS.R]
    if method == 'mean':
        n = sectionfunc.section_mean_radius(bif_point.children[0])
        m = sectionfunc.section_mean_radius(bif_point.children[1])
    return min(n, m) / max(n, m)