Пример #1
0
def branch_order(tree_section):
    '''Branching order of a tree section

    The branching order is defined as the depth of the tree section.

    Note:
        The first level has branch order 1.
    '''
    node = tree_section[-1]
    bo = sum(1 for _ in tr.iforking_point(node, tr.iupstream))
    return bo - 1 if tr.is_forking_point(node) else bo
Пример #2
0
 def _skip_0_length(p, c):
     '''Return the first child c with non-zero distance to parent p'''
     while np.all(p.value[:COLS.R] == c.value[:COLS.R])\
             and not tr.is_leaf(c) and not tr.is_forking_point(c):
         c = c.children[0]
     return c