• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tree.Tree类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中neurom.core.tree.Tree的典型用法代码示例。如果您正苦于以下问题:Python Tree类的具体用法?Python Tree怎么用?Python Tree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Tree类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: load_data

from itertools import izip

DATA_PATH = './test_data'
SWC_PATH = os.path.join(DATA_PATH, 'swc/')

data    = load_data(SWC_PATH + 'Neuron.swc')
neuron0 = make_neuron(data)
tree0   = neuron0.neurites[0]
tree_types = [TreeType.axon,
              TreeType.basal_dendrite,
              TreeType.basal_dendrite,
              TreeType.apical_dendrite]


# Mock tree holding integers, not points
MOCK_TREE = Tree(0)
MOCK_TREE.add_child(Tree(11))
MOCK_TREE.add_child(Tree(12))
MOCK_TREE.children[0].add_child(Tree(111))
MOCK_TREE.children[0].add_child(Tree(112))
MOCK_TREE.children[1].add_child(Tree(121))
MOCK_TREE.children[1].add_child(Tree(122))
MOCK_TREE.children[1].children[0].add_child(Tree(1211))
MOCK_TREE.children[1].children[0].children[0].add_child(Tree(12111))
MOCK_TREE.children[1].children[0].children[0].add_child(Tree(12112))
T1111 = MOCK_TREE.children[0].children[0].add_child(Tree(1111))
T11111 = T1111.add_child(Tree(11111))
T11112 = T1111.add_child(Tree(11112))
T11113 = T1111.add_child(Tree(11113))

开发者ID:wvangeit,项目名称:NeuroM,代码行数:29,代码来源:test_morphtree.py


示例17: test_is_leaf_false

def test_is_leaf_false():
    t = Tree()
    t.add_child(Tree())
    nt.ok_(not t.is_leaf())
开发者ID:juanchopanza,项目名称:NeuroM,代码行数:4,代码来源:test_tree.py


示例18: Tree

    [11, 22, 33, 44, 3, 1, 2],
    [11, 22, 33, 44, 4, 1, 3],
    [11, 22, 33, 44, 5, 1, 4],
    [11, 22, 33, 44, 6, 1, 5]
]


INVALID_PTS_0 = []

INVALID_PTS_2 = [

    [11, 22, 33, 44, 1, 1, -1],
    [11, 22, 33, 44, 2, 1, 1]
]

TREE = Tree([0.0, 0.0, 0.0, 1.0, 1, 1, 2] )
T1 = TREE.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]))

def test_make_SomaA():
    soma = neuron.make_soma(SOMA_A_PTS)
    nt.ok_('SomaA' in str(soma))
    nt.ok_(isinstance(soma, neuron.SomaA))
开发者ID:Tsolmongerel,项目名称:NeuroM,代码行数:31,代码来源:test_neuron.py


示例19: test_add_child

def test_add_child():
    t = Tree()
    ch11 = t.add_child(Tree())
    ch22 = t.add_child(Tree())
    nt.ok_(len(t.children) == 2)
    nt.ok_(t.children == [ch11, ch22])
开发者ID:juanchopanza,项目名称:NeuroM,代码行数:6,代码来源:test_tree.py


示例20: test_is_leaf_false

def test_is_leaf_false():
    t = Tree(0)
    t.add_child(Tree(1))
    nt.ok_(not is_leaf(t))
开发者ID:wvangeit,项目名称:NeuroM,代码行数:4,代码来源:test_tree.py



注:本文中的neurom.core.tree.Tree类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python types.is_type函数代码示例发布时间:2022-05-27
下一篇:
Python tree.val_iter函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap