コード例 #1
0
    def rootify(self, center_branch):

        # remember the old branch:
        self.root_branch = center_branch

        # create a new node
        center_name = center_branch.ends[0].name
        center_name += "-" + center_branch.ends[1].name
        center_node = node.node(center_name, self)
        self.root = center_node

        # give it children branches
        child1 = branch.branch(center_branch.length / 2)
        child1.addNode(center_node)
        child1.addNode(center_branch.ends[0])
        child2 = branch.branch(center_branch.length / 2)
        child2.addNode(center_node)
        child2.addNode(center_branch.ends[1])
        center_node.child_branches.append(child1)
        center_node.child_branches.append(child2)

        # erase the original branch from the child nodes branch_list
        for kids in center_branch.ends:
            kids.branch_list.remove(center_branch)

        # impose a hierarchy from the root
        center_node.imposeHierarchy()
        self.labelSubtrees()
        self.Get_Subnodes()
        self.root.Fill_Node_Dict()
コード例 #2
0
    def rootify(self,center_branch):

	# remember the old branch:
	self.root_branch = center_branch

	# create a new node
	center_name = center_branch.ends[0].name
	center_name += "-" + center_branch.ends[1].name
	center_node = node.node(center_name,self)
	self.root = center_node
	
	# give it children branches
	child1 = branch.branch(center_branch.length/2)
	child1.addNode(center_node)
	child1.addNode(center_branch.ends[0])
	child2 = branch.branch(center_branch.length/2)
	child2.addNode(center_node)
	child2.addNode(center_branch.ends[1])
	center_node.child_branches.append(child1)
	center_node.child_branches.append(child2)

	# erase the original branch from the child nodes branch_list
	for kids in center_branch.ends:
	    kids.branch_list.remove(center_branch)

	# impose a hierarchy from the root
	center_node.imposeHierarchy()
        self.labelSubtrees()
        self.Get_Subnodes()
        self.root.Fill_Node_Dict()
コード例 #3
0
    def addBranch(self,length):

	self.myBranch = branch.branch(length)
	self.myBranch.addNode(self)
コード例 #4
0
    def addBranch(self, length):

        self.myBranch = branch.branch(length)
        self.myBranch.addNode(self)