Get, how much steps will needed for a given branch length.

        Returns:
            float: The age the tree must achieve to reach the given branch length.
163018
def get_steps_branch_len(self, length):
        
        return log(length/self.length, min(self.branches[0][0]))
887328
def update_tree(root, executed_acts, total_rew):
    
    root.value = max(total_rew, root.value)
    root.visits += 1
    new_nodes = 0

    node = root
    for step, act in enumerate(executed_acts):
        if act not in node.children:
            node.children[act] = Node()
            new_nodes += 1
        node = node.children[act]
        node.value = max(total_rew, node.value)
        node.visits += 1

    return new_nodes
773862
def depth(self) -> int:
        
        if len(self.children):
            return 1 + max([child.depth for child in self.children])
        else:
            return 1
1172692
def length(self):
        
        length = 0
        for r in self._routes:
            length = length + r.length()

        return length
520072
def get_step(self, tol):
        ''' '''
        return 2 * numpy.log(tol/2.)/numpy.log(self.base)
701940
def get_tree(self):
        """"""
        self.ignore.append(inspect.currentframe())
        return self._get_tree(self.root, self.maxdepth)
457189
def getsteps(levels, tagmax):
	
	ntw = levels
	if ntw < 2:
		ntw = 2

	steps = [(stp, 1 + (stp * int(math.ceil(tagmax * 1.0 / ntw - 1))))
				for stp in range(ntw)]
	# just to be sure~
	steps[-1] = (steps[-1][0], tagmax+1)
	return steps
187846
def get_num_paths(self):
        
        # NB: the algorithm assume a symmetric logic tree for the GSIMs;
        # in the future we may relax such assumption
        num_branches = self.get_num_branches()
        if not sum(num_branches.values()):
            return 0
        num = 1
        for val in num_branches.values():
            if val:  # the branch is effective
                num *= val
        return num
406500
private int getMaxStep()
    {
        if (path != null)
        {
            final int steps;
            if (pathStopped)
            {
                steps = currentStep;
            }
            else
            {
                steps = path.getLength();
            }
            return steps;
        }
        return 0;
    }
943659
def count(self):
        
        total = len(self.children)
        for child in self.children:
            total += child.count()
        return total
1101252
def age(*paths):
	''''''
	if not paths:
		return 0

	for path in paths:
		if not os.path.exists(path):
			return time.time()

	return min([(time.time() - os.path.getmtime(path)) for path in paths])
1297962
def _get_node_parent(self, age, pos):
        
        return self.nodes[age][int(pos / self.comp)]
375172
def _get_size(self, node):
        
        if node == BLANK_NODE:
            return 0

        node_type = self._get_node_type(node)

        if is_key_value_type(node_type):
            value_is_node = node_type == NODE_TYPE_EXTENSION
            if value_is_node:
                return self._get_size(self._decode_to_node(node[1]))
            else:
                return 1
        elif node_type == NODE_TYPE_BRANCH:
            sizes = [self._get_size(self._decode_to_node(node[x]))
                     for x in range(16)]
            sizes = sizes + [1 if node[-1] else 0]
            return sum(sizes)
384113
def s(self):
		
		next_node=self._exe_order[self.step]
		self._eval(next_node)
		self.step+=1
		if self.step==len(self._exe_order):
			return self._finish()
		else:
			# if stepping, return the value of the node we just
			# evaled
			return self._break(value=self._cache.get(next_node.name))
730570
def level(self):
        
        res = len(self._scope_stack)
        if self._parent is not None:
            res += self._parent.level()
        return res
1082926
def _get_color(self, age):
        
        if age == self.tree.age:
            return self.leaf_color
        color = self.stem_color
        tree = self.tree

        if len(color) == 3:
            return color

        diff = [color[i+3]-color[i] for i in range(3)]
        per_age = [diff[i]/(tree.age-1) for i in range(3)]

        return tuple([int(color[i]+per_age[i]*age) for i in range(3)])
688513
def _calc_size(self):
        
        return sum(os.path.getsize(filename)
            for filename in self.walk()
        )