예제 #1
0
def _generate_back_track_tree(n, dev):

    tree = Section(
        np.array([[0., 0., 0., 0.2, 1., 0.,
                   0.], [0., 1., 0., 0.15, 1., 0., 0.],
                  [0., 2., 0., 0.14, 1., 0., 0.]]))

    ch0 = Section(
        np.array([[0., 2., 0., 0.14, 1., 0.,
                   0.], [1., 3., 0., 0.15, 1., 0., 0.],
                  [2., 4., 0., 0.11, 1., 0., 0.]]))

    ch1 = Section(
        np.array([[0., 2., 0., 0.14, 1., 0., 0.],
                  [1., -3., 0., 0.15, 1., 0., 0.],
                  [2., -4., 0., 0.12, 1., 0., 0.],
                  [dev[0], dev[1], dev[2], 0.11, 1., 0., 0.],
                  [3., -5., 0., 0.1, 1., 0., 0.],
                  [4., -6., 0., 0.1, 1., 0., 0.]]))

    tree.add_child(ch0)
    tree.add_child(ch1)
    tree.children[1].points[3] += tree.children[n].points[1]
    tree.type = NeuriteType.undefined

    return Neurite(tree)
예제 #2
0
def _genetate_tree_non_monotonic_section_boundary():

    tree = Section(
        np.array([[0, 0, 0, 1.0, 0, 0], [0, 0, 0, 0.75, 0, 0],
                  [0, 0, 0, 0.5, 0, 0], [0, 0, 0, 0.25, 0, 0]]))

    ch0 = Section(
        np.array([[0, 0, 0, 0.375, 0, 0], [0, 0, 0, 0.125, 0, 0],
                  [0, 0, 0, 0.0625, 0, 0]]))

    tree.add_child(ch0)
    tree.type = NeuriteType.undefined
    return Neurite(tree)
예제 #3
0
def _genetate_tree_non_monotonic_section_boundary():

    tree = Section(np.array([[0, 0, 0, 1.0, 0, 0],
                             [0, 0, 0, 0.75, 0, 0],
                             [0, 0, 0, 0.5, 0, 0],
                             [0, 0, 0, 0.25, 0, 0]]))

    ch0 = Section(np.array([[0, 0, 0, 0.375, 0, 0],
                            [0, 0, 0, 0.125, 0, 0],
                            [0, 0, 0, 0.0625, 0, 0]]))

    tree.add_child(ch0)
    tree.type = NeuriteType.undefined
    return Neurite(tree)
예제 #4
0
def _generate_back_track_tree(n, dev):

    tree = Section(np.array([[0., 0., 0., 0.2, 1., 0., 0.],
                             [0., 1., 0., 0.15, 1., 0., 0.],
                             [0., 2., 0., 0.14, 1., 0., 0.]]))

    ch0 = Section(np.array([[0., 2., 0., 0.14, 1., 0., 0.],
                            [1., 3., 0., 0.15, 1., 0., 0.],
                            [2., 4., 0., 0.11, 1., 0., 0.]]))

    ch1 = Section(np.array([[0., 2., 0., 0.14, 1., 0., 0.],
                            [1., -3., 0., 0.15, 1., 0., 0.],
                            [2., -4., 0., 0.12, 1., 0., 0.],
                            [dev[0], dev[1], dev[2], 0.11, 1., 0., 0.],
                            [3., -5., 0., 0.1, 1., 0., 0.],
                            [4., -6., 0., 0.1, 1., 0., 0.]]))

    tree.add_child(ch0)
    tree.add_child(ch1)
    tree.children[1].points[3] += tree.children[n].points[1]
    tree.type = NeuriteType.undefined

    return Neurite(tree)
예제 #5
0
def test_principal_direction_extents():
    # test with a realistic neuron
    nrn = nm.load_neuron(os.path.join(H5_PATH, 'bio_neuron-000.h5'))

    p_ref = [
        1672.9694359427331, 142.43704397865031, 226.45895382204986,
        415.50612748523838, 429.83008974193206, 165.95410536922873,
        346.83281498399697
    ]

    p = _nf.principal_direction_extents(nrn)
    _close(np.array(p), np.array(p_ref))


s0 = Section(42)
s1 = s0.add_child(Section(42))
s2 = s0.add_child(Section(42))
s3 = s0.add_child(Section(42))
s4 = s1.add_child(Section(42))
s5 = s1.add_child(Section(42))
s6 = s4.add_child(Section(42))
s7 = s4.add_child(Section(42))


def test_n_bifurcation_points():
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s0)), 2)
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s1)), 2)
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s2)), 0)
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s3)), 0)
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s4)), 1)
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s5)), 0)
예제 #6
0
RADIUS = 4.
POINTS0 = np.array([[0., 0., 0., RADIUS], [0., 0., 1., RADIUS],
                    [0., 0., 2., RADIUS], [0., 0., 3., RADIUS],
                    [1., 0., 3., RADIUS], [2., 0., 3., RADIUS],
                    [3., 0., 3., RADIUS]])

POINTS1 = np.array([[3., 0., 3., RADIUS], [3., 0., 4., RADIUS],
                    [3., 0., 5., RADIUS], [3., 0., 6., RADIUS],
                    [4., 0., 6., RADIUS], [5., 0., 6., RADIUS],
                    [6., 0., 6., RADIUS]])

REF_LEN = 12

ROOT_NODE = Section(POINTS0)
ROOT_NODE.add_child(Section(POINTS1))


def test_init():
    nrt = Neurite(ROOT_NODE)
    nt.eq_(nrt.type, nm.NeuriteType.undefined)
    nt.eq_(len(nrt.points), 13)


def test_neurite_type():
    root_node = Section(POINTS0, section_type=nm.AXON)
    nrt = Neurite(root_node)
    nt.eq_(nrt.type, nm.AXON)

    root_node = Section(POINTS0, section_type=nm.BASAL_DENDRITE)
    nrt = Neurite(root_node)
예제 #7
0
                   [2., 0., 3., RADIUS],
                   [3., 0., 3., RADIUS]])

POINTS1 = np.array([[3., 0., 3., RADIUS],
                   [3., 0., 4., RADIUS],
                   [3., 0., 5., RADIUS],
                   [3., 0., 6., RADIUS],
                   [4., 0., 6., RADIUS],
                   [5., 0., 6., RADIUS],
                   [6., 0., 6., RADIUS]])

REF_LEN = 12


ROOT_NODE = Section(POINTS0)
ROOT_NODE.add_child(Section(POINTS1))


def test_init():
    nrt = Neurite(ROOT_NODE)
    nt.eq_(nrt.type, nm.NeuriteType.undefined)
    nt.eq_(len(nrt.points), 13)


def test_neurite_type():
    root_node = Section(POINTS0, section_type=nm.AXON)
    nrt = Neurite(root_node)
    nt.eq_(nrt.type, nm.AXON)

    root_node = Section(POINTS0, section_type=nm.BASAL_DENDRITE)
    nrt = Neurite(root_node)
예제 #8
0

def test_principal_direction_extents():
    # test with a realistic neuron
    nrn = nm.load_neuron(os.path.join(H5_PATH, 'bio_neuron-000.h5'))

    p_ref = [1672.9694359427331, 142.43704397865031, 226.45895382204986,
             415.50612748523838, 429.83008974193206, 165.95410536922873,
             346.83281498399697]

    p = _nf.principal_direction_extents(nrn)
    _close(np.array(p), np.array(p_ref))


s0 = Section(42)
s1 = s0.add_child(Section(42))
s2 = s0.add_child(Section(42))
s3 = s0.add_child(Section(42))
s4 = s1.add_child(Section(42))
s5 = s1.add_child(Section(42))
s6 = s4.add_child(Section(42))
s7 = s4.add_child(Section(42))


def test_n_bifurcation_points():
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s0)), 2)
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s1)), 2)
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s2)), 0)
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s3)), 0)
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s4)), 1)
    nt.assert_equal(_nf.n_bifurcation_points(Neurite(s5)), 0)