本文整理汇总了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))