當前位置: 首頁>>代碼示例>>Python>>正文


Python tree.Tree類代碼示例

本文整理匯總了Python中neurom.core.tree.Tree的典型用法代碼示例。如果您正苦於以下問題:Python Tree類的具體用法?Python Tree怎麽用?Python Tree使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Tree類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_is_forking_point

def test_is_forking_point():
    t = Tree(0)
    t.add_child(Tree(1))
    t.add_child(Tree(2))
    nt.ok_(is_forking_point(t))
    t.add_child(Tree(3))
    nt.ok_(is_forking_point(t))
開發者ID:wvangeit,項目名稱:NeuroM,代碼行數:7,代碼來源:test_tree.py

示例2: test_add_child

def test_add_child():
    t = Tree(0)
    t.add_child(Tree(11))
    t.add_child(Tree(22))
    nt.ok_(t.value == 0)
    nt.ok_(len(t.children) == 2)
    nt.ok_([i.value for i in t.children] == [11, 22])
開發者ID:wvangeit,項目名稱:NeuroM,代碼行數:7,代碼來源:test_tree.py

示例3: test_is_bifurcation_point_false

def test_is_bifurcation_point_false():
    t = Tree(0)
    nt.ok_(not is_bifurcation_point(t))
    t.add_child(Tree(1))
    nt.ok_(not is_bifurcation_point(t))
    t.add_child(Tree(2))
    t.add_child(Tree(3))
    nt.ok_(not is_bifurcation_point(t))
開發者ID:wvangeit,項目名稱:NeuroM,代碼行數:8,代碼來源:test_tree.py

示例4: test_parent

def test_parent():
    t = Tree(0)
    for i in xrange(10):
        t.add_child(Tree(i))

    nt.ok_(len(t.children) == 10)

    for c in t.children:
        nt.ok_(c.parent is t)
開發者ID:wvangeit,項目名稱:NeuroM,代碼行數:9,代碼來源:test_tree.py

示例5: _make_tree

def _make_tree():
    '''This tree has 3 branching points'''
    p = [0.0, 0.0, 0.0, 1.0, 1, 1, 2]
    T = Tree(p)
    T1 = T.add_child(Tree([0.0, 1.0, 0.0, 2.0, 1, 1, 2]))
    T2 = T1.add_child(Tree([0.0, 2.0, 0.0, 3.0, 1, 1, 2]))
    T3 = T2.add_child(Tree([0.0, 4.0, 0.0, 4.0, 1, 1, 2]))
    T4 = T3.add_child(Tree([0.0, 5.0, 0.0, 5.0, 1, 1, 2]))
    T5 = T4.add_child(Tree([2.0, 5.0, 0.0, 6.0, 1, 1, 2]))
    T6 = T4.add_child(Tree([0.0, 5.0, 2.0, 7.0, 1, 1, 2]))
    return T
開發者ID:Tsolmongerel,項目名稱:NeuroM,代碼行數:11,代碼來源:test_points.py

示例6: _make_simple_tree

def _make_simple_tree():
    p = [0.0, 0.0, 0.0, 1.0, 1, 1, 1]
    T = Tree(p)
    T1 = T.add_child(Tree([0.0, 2.0, 0.0, 1.0, 1, 1, 1]))
    T2 = T1.add_child(Tree([2.0, 2.0, 0.0, 1.0, 1, 1, 1]))
    T3 = T2.add_child(Tree([2.0, 6.0, 0.0, 1.0, 1, 1, 1]))

    T5 = T.add_child(Tree([0.0, 0.0, 2.0, 1.0, 1, 1, 1]))
    T6 = T5.add_child(Tree([2.0, 0.0, 2.0, 1.0, 1, 1, 1]))
    T7 = T6.add_child(Tree([6.0, 0.0, 2.0, 1.0, 1, 1, 1]))

    return T
開發者ID:Tsolmongerel,項目名稱:NeuroM,代碼行數:12,代碼來源:test_triplets.py

示例7: _create_root_soma_tree

def _create_root_soma_tree(neuron):
    ''' soma segment to represent the soma as a square of radius equal to the soma one
    '''
    soma_radius = neuron.get_soma_radius()

    soma_node0 = Tree((0., 0., 0., soma_radius, 1.))

    soma_node1 = Tree((soma_radius, 0., 0., soma_radius, 1.))

    soma_node0.add_child(soma_node1)

    return soma_node0
開發者ID:christian-oreilly,項目名稱:NeuroM,代碼行數:12,代碼來源:dendrogram.py

示例8: _form_simple_tree

def _form_simple_tree():
    p = [0.0, 0.0, 0.0, 1.0, 1, 1, 1]
    T = Tree(p)
    T1 = T.add_child(Tree([0.0, 2.0, 0.0, 1.0, 1, 1, 1]))
    T2 = T1.add_child(Tree([0.0, 4.0, 0.0, 1.0, 1, 1, 1]))
    T3 = T2.add_child(Tree([0.0, 6.0, 0.0, 1.0, 1, 1, 1]))
    T4 = T3.add_child(Tree([0.0, 8.0, 0.0, 1.0, 1, 1, 1]))

    T5 = T.add_child(Tree([0.0, 0.0, 2.0, 1.0, 1, 1, 1]))
    T6 = T5.add_child(Tree([0.0, 0.0, 4.0, 1.0, 1, 1, 1]))
    T7 = T6.add_child(Tree([0.0, 0.0, 6.0, 1.0, 1, 1, 1]))
    T8 = T7.add_child(Tree([0.0, 0.0, 8.0, 1.0, 1, 1, 1]))

    return T
開發者ID:wvangeit,項目名稱:NeuroM,代碼行數:14,代碼來源:test_morphtree.py

示例9: _make_neuron_tree

def _make_neuron_tree():
    p = [0.0, 0.0, 0.0, 1.0, 1, 1, 2]
    T = Tree(p)
    T1 = T.add_child(Tree([0.0, 1.0, 0.0, 1.0, 1, 1, 2]))
    T2 = T1.add_child(Tree([0.0, 2.0, 0.0, 1.0, 1, 1, 2]))
    T3 = T2.add_child(Tree([0.0, 4.0, 0.0, 2.0, 1, 1, 2]))
    T4 = T3.add_child(Tree([0.0, 5.0, 0.0, 2.0, 1, 1, 2]))
    T5 = T4.add_child(Tree([2.0, 5.0, 0.0, 1.0, 1, 1, 2]))
    T6 = T4.add_child(Tree([0.0, 5.0, 2.0, 1.0, 1, 1, 2]))
    T7 = T5.add_child(Tree([3.0, 5.0, 0.0, 0.75, 1, 1, 2]))
    T8 = T7.add_child(Tree([4.0, 5.0, 0.0, 0.75, 1, 1, 2]))
    T9 = T6.add_child(Tree([0.0, 5.0, 3.0, 0.75, 1, 1, 2]))
    T10 = T9.add_child(Tree([0.0, 6.0, 3.0, 0.75, 1, 1, 2]))
    return T
開發者ID:Tsolmongerel,項目名稱:NeuroM,代碼行數:14,代碼來源:test_segments.py

示例10: test_is_bifurcation_point_false

def test_is_bifurcation_point_false():
    t = Tree()
    nt.ok_(not t.is_bifurcation_point())
    t.add_child(Tree())
    nt.ok_(not t.is_bifurcation_point())
    t.add_child(Tree())
    t.add_child(Tree())
    nt.ok_(not t.is_bifurcation_point())
開發者ID:juanchopanza,項目名稱:NeuroM,代碼行數:8,代碼來源:test_tree.py

示例11: test_principal_direction_extent

def test_principal_direction_extent():

    points = np.array([[-10., 0., 0.],
                        [-9., 0., 0.],
                        [9., 0., 0.],
                        [10., 0., 0.]])

    tree = Tree(np.array([points[0][0], points[0][1], points[0][2], 1., 0., 0.]))
    tree.add_child(Tree(np.array([points[1][0], points[1][1], points[1][2], 1., 0., 0.])))
    tree.children[0].add_child(Tree(np.array([points[2][0], points[2][1], points[2][2], 1., 0., 0.])))
    tree.children[0].add_child(Tree(np.array([points[3][0], points[3][1], points[3][2], 1., 0., 0.])))

    extent = mtr.principal_direction_extent(tree)

    nt.assert_true(np.allclose(extent, [20., 0., 0.]))
開發者ID:Tsolmongerel,項目名稱:NeuroM,代碼行數:15,代碼來源:test_morphtree.py

示例12: _form_branching_tree

def _form_branching_tree():
    p = [0.0, 0.0, 0.0, 1.0, 1, 1, 2]
    T = Tree(p)
    T1 = T.add_child(Tree([0.0, 1.0, 0.0, 1.0, 1, 1, 2]))
    T2 = T1.add_child(Tree([0.0, 2.0, 0.0, 1.0, 1, 1, 2]))
    T3 = T2.add_child(Tree([0.0, 4.0, 0.0, 2.0, 1, 1, 2]))
    T4 = T3.add_child(Tree([0.0, 5.0, 0.0, 2.0, 1, 1, 2]))
    T5 = T4.add_child(Tree([2.0, 5.0, 0.0, 1.0, 1, 1, 2]))
    T6 = T4.add_child(Tree([0.0, 5.0, 2.0, 1.0, 1, 1, 2]))
    T7 = T5.add_child(Tree([3.0, 5.0, 0.0, 0.75, 1, 1, 2]))
    T8 = T7.add_child(Tree([4.0, 5.0, 0.0, 0.75, 1, 1, 2]))
    T9 = T6.add_child(Tree([0.0, 5.0, 3.0, 0.75, 1, 1, 2]))
    T10 = T9.add_child(Tree([0.0, 6.0, 3.0, 0.75, 1, 1, 2]))
    T11 = T9.add_child(Tree([0.0, 6.0, 4.0, 0.75, 1, 1, 2]))
    T33 = T3.add_child(Tree([1.0, 5.0, 0.0, 2.0, 1, 1, 2]))
    T331 = T33.add_child(Tree([15.0, 15.0, 0.0, 2.0, 1, 1, 2]))
    return T
開發者ID:wvangeit,項目名稱:NeuroM,代碼行數:17,代碼來源:test_morphtree.py

示例13: test_is_forking_point

def test_is_forking_point():
    t = Tree()
    t.add_child(Tree())
    t.add_child(Tree())
    nt.ok_(t.is_forking_point())
    t.add_child(Tree())
    nt.ok_(t.is_forking_point())
開發者ID:juanchopanza,項目名稱:NeuroM,代碼行數:7,代碼來源:test_tree.py

示例14: _make_branching_tree

def _make_branching_tree():
    '''This tree has 3 branching points'''
    p = [0.0, 0.0, 0.0, 1.0, 1, 1, 2]
    T = Tree(p)
    T1 = T.add_child(Tree([0.0, 1.0, 0.0, 1.0, 1, 1, 2]))
    T2 = T1.add_child(Tree([0.0, 2.0, 0.0, 1.0, 1, 1, 2]))
    T3 = T2.add_child(Tree([0.0, 4.0, 0.0, 2.0, 1, 1, 2]))
    T4 = T3.add_child(Tree([0.0, 5.0, 0.0, 2.0, 1, 1, 2]))
    T5 = T4.add_child(Tree([2.0, 5.0, 0.0, 1.0, 1, 1, 2]))
    T6 = T4.add_child(Tree([0.0, 5.0, 2.0, 1.0, 1, 1, 2]))
    T7 = T5.add_child(Tree([3.0, 5.0, 0.0, 0.75, 1, 1, 2]))
    T8 = T7.add_child(Tree([4.0, 5.0, 0.0, 0.75, 1, 1, 2]))
    T9 = T6.add_child(Tree([0.0, 5.0, 3.0, 0.75, 1, 1, 2]))
    T10 = T9.add_child(Tree([0.0, 6.0, 3.0, 0.75, 1, 1, 2]))
    T11 = T9.add_child(Tree([0.0, 6.0, 4.0, 0.75, 1, 1, 2]))
    T33 = T3.add_child(Tree([1.0, 5.0, 0.0, 2.0, 1, 1, 2]))
    T331 = T33.add_child(Tree([15.0, 15.0, 0.0, 2.0, 1, 1, 2]))
    return T
開發者ID:Tsolmongerel,項目名稱:NeuroM,代碼行數:18,代碼來源:test_bifurcations.py

示例15: test_is_root_true

def test_is_root_true():
    t = Tree()
    nt.ok_(Tree.is_root(t))
    nt.ok_(t.is_root())
開發者ID:juanchopanza,項目名稱:NeuroM,代碼行數:4,代碼來源:test_tree.py


注:本文中的neurom.core.tree.Tree類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。