예제 #1
0
def test_trunk_origin_elevations():
    class Mock(object):
        pass

    n0 = Mock()
    n1 = Mock()

    s = make_soma([[0, 0, 0, 4]])
    t0 = Section(((1, 0, 0, 2), (2, 1, 1, 2)))
    t0.type = NeuriteType.basal_dendrite
    t1 = Section(((0, 1, 0, 2), (1, 2, 1, 2)))
    t1.type = NeuriteType.basal_dendrite
    n0.neurites = [Neurite(t0), Neurite(t1)]
    n0.soma = s

    t2 = Section(((0, -1, 0, 2), (-1, -2, -1, 2)))
    t2.type = NeuriteType.basal_dendrite
    n1.neurites = [Neurite(t2)]
    n1.soma = s

    pop = Population([n0, n1])
    nt.eq_(list(_nf.trunk_origin_elevations(pop)),
           [0.0, np.pi/2., -np.pi/2.])

    nt.eq_(
        list(_nf.trunk_origin_elevations(pop, neurite_type=NeuriteType.basal_dendrite)),
        [0.0, np.pi/2., -np.pi/2.])

    nt.eq_(len(_nf.trunk_origin_elevations(pop, neurite_type=NeuriteType.axon)),
           0)

    nt.eq_(len(_nf.trunk_origin_elevations(pop, neurite_type=NeuriteType.apical_dendrite)),
           0)
예제 #2
0
def test_trunk_origin_elevations():
    class Mock(object):
        pass

    n0 = Mock()
    n1 = Mock()

    s = make_soma([[0, 0, 0, 4]])
    t0 = Section(((1, 0, 0, 2), (2, 1, 1, 2)))
    t0.type = NeuriteType.basal_dendrite
    t1 = Section(((0, 1, 0, 2), (1, 2, 1, 2)))
    t1.type = NeuriteType.basal_dendrite
    n0.neurites = [Neurite(t0), Neurite(t1)]
    n0.soma = s

    t2 = Section(((0, -1, 0, 2), (-1, -2, -1, 2)))
    t2.type = NeuriteType.basal_dendrite
    n1.neurites = [Neurite(t2)]
    n1.soma = s

    pop = Population([n0, n1])
    nt.eq_(list(_nf.trunk_origin_elevations(pop)), [0.0, np.pi / 2.0, -np.pi / 2.0])

    nt.eq_(
        list(_nf.trunk_origin_elevations(pop, neurite_type=NeuriteType.basal_dendrite)),
        [0.0, np.pi / 2.0, -np.pi / 2.0],
    )

    nt.eq_(len(_nf.trunk_origin_elevations(pop, neurite_type=NeuriteType.axon)), 0)

    nt.eq_(len(_nf.trunk_origin_elevations(pop, neurite_type=NeuriteType.apical_dendrite)), 0)
예제 #3
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)
예제 #4
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)
예제 #5
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)
예제 #6
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)