def Trunk(v, Scale=-1): """ List of vertices constituting the bearing botanical axis of a branching system. Trunk returns the list of vertices representing the botanical axis defined as the bearing axis of the whole branching system defined by `v`. The optional argument enables the user to choose the scale at which the trunk should be detailed. :Usage: .. code-block:: python Trunk(v) Trunk(v, Scale= s) :Parameters: - `v` (int) : Vertex of the active MTG. :Optional Parameters: - `Scale` (str): scale at which the axis components are required. :Returns: list of vertices ids .. todo:: check the usage of the optional argument Scale .. seealso:: :func:`MTG`, :func:`Path`, :func:`Ancestors`, :func:`Axis`. """ global _g return list(algo.trunk(_g, v, scale=Scale))
def fun3(): import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.ticker as ticker import pylab as P g, pf = test2() P.figure() lengths = [] for root in g.vertices(scale=1): vr = next(g.component_roots_at_scale_iter(root, scale=2)) h = aml.Height(vr) lv = [ v for v in algo.trunk( g, vr, RestrictedTo='SameComplex', ConatinedIn=root) if v in pf.length ] P.plot([aml.Height(v) - h for v in lv], [pf.length.get(v) for v in lv], 'o-') #lengths.append([pf.length.get(v) for v in lv if v in pf.length]) #n, bins, patches = P.hist( lengths, 4, histtype='bar') return lengths
def fun3(): import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab import matplotlib.ticker as ticker import pylab as P g, pf = test2() P.figure() lengths = [] for root in g.vertices(scale=1): vr = g.component_roots_at_scale_iter(root,scale=2).next() h = aml.Height(vr) lv = [v for v in algo.trunk(g,vr, RestrictedTo='SameComplex', ConatinedIn=root) if v in pf.length] P.plot([aml.Height(v)-h for v in lv], [pf.length.get(v) for v in lv], 'o-') #lengths.append([pf.length.get(v) for v in lv if v in pf.length]) #n, bins, patches = P.hist( lengths, 4, histtype='bar') return lengths