本文整理匯總了Python中neurom.core.tree.Tree.add_child方法的典型用法代碼示例。如果您正苦於以下問題:Python Tree.add_child方法的具體用法?Python Tree.add_child怎麽用?Python Tree.add_child使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類neurom.core.tree.Tree
的用法示例。
在下文中一共展示了Tree.add_child方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_is_forking_point
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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())
示例2: test_add_child
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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])
示例3: test_is_forking_point
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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))
示例4: test_is_bifurcation_point_false
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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))
示例5: test_is_bifurcation_point_false
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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())
示例6: test_parent
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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)
示例7: _make_simple_tree
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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
示例8: _create_root_soma_tree
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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
示例9: _form_simple_tree
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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
示例10: test_principal_direction_extent
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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.]))
示例11: _make_tree
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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
示例12: _make_neuron_tree
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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
示例13: _form_branching_tree
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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
示例14: _make_branching_tree
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
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
示例15: test_is_leaf_false
# 需要導入模塊: from neurom.core.tree import Tree [as 別名]
# 或者: from neurom.core.tree.Tree import add_child [as 別名]
def test_is_leaf_false():
t = Tree(0)
t.add_child(Tree(1))
nt.ok_(not is_leaf(t))