High level reporting function compatible with AML¶
Interface to use the new MTG implementation with the old AMAPmod interface.
- openalea.mtg.aml.Activate(g)[source]¶
Activate a MTG already loaded into memory
All the functions of the MTG module use an implicit MTG argument which is defined as the active MTG.
This function activates a MTG already loaded into memory which thus becomes the implicit argument of all functions of module MTG.
- Usage:
>>> Activate(g)
- Parameters:
g: MTG to be activated
- Details:
When several MTGs are loaded into memory, only one is active at a time. By default, the active MTG is the last MTG loaded using function
MTG()
.However, it is possible to activate an MTG already loaded using function
Activate()
The current active MTG can be identified using functionActive()
.- Background:
See also
- openalea.mtg.aml.Active()[source]¶
Returns the active MTG.
If no MTG is loaded into memory, None is returned.
- Usage:
>>> Active()
- Returns:
- Details:
When several MTGs are loaded into memory, only one is active at a time. By default, the active MTG is the last MTG loaded using function
MTG()
. However, it is possible to activate an MTG already loaded using functionActivate()
. The current active MTG can be identified using functionActive()
.
See also
- openalea.mtg.aml.AlgHeight(v1, v2)[source]¶
Algebraic value defining the number of components between two components.
This function is similar to function Height(v1, v2) : it returns the number of components between two components, at the same scale, but takes into account the order of vertices v1 and v2.
The result is positive if v1 is an ancestor of v2, and negative if v2 is an ancestor of v1.
- Usage:
AlgHeight(v1, v2)
- Parameters:
v1 (int) : vertex of the active MTG.
v2 (int) : vertex of the active MTG.
- Returns:
int
If v1 is not an ancestor of v2 (or vise versa), or if v1 and v2 are not defined at the same scale, an error value None is returned.
See also
MTG()
,Rank()
,Order()
,Height()
,EdgeType()
,AlgOrder()
,AlgRank()
.
- openalea.mtg.aml.AlgOrder(v1, v2)[source]¶
Algebraic value defining the relative order of one vertex with respect to another one.
This function is similar to function Order(v1, v2) : it returns the number of +-type edges between two components, at the same scale, but takes into account the order of vertices v1 and v2.
The result is positive if v1 is an ancestor of v2, and negative if v2 is an ancestor of v1.
- Usage:
AlgOrder(v1, v2)
- Parameters:
v1 (int) : vertex of the active MTG.
v2 (int) : vertex of the active MTG.
- Returns:
int
If v1 is not an ancestor of v2 (or vise versa), or if v1 and v2 are not defined at the same scale, an error value None is returned.
See also
MTG()
,Rank()
,Order()
,Height()
,EdgeType()
,AlgHeight()
,AlgRank()
.
- openalea.mtg.aml.AlgRank(v1, v2)[source]¶
Algebraic value defining the relative rank of one vertex with respect to another one.
This function is similar to function Rank(v1, v2) : it returns the number of <-type edges between two components, at the same scale, but takes into account the order of vertices v1 and v2.
The result is positive if v1 is an ancestor of v2, and negative if v2 is an ancestor of v1.
- Usage:
AlgRank(v1, v2)
- Parameters:
v1 (int) : vertex of the active MTG.
v2 (int) : vertex of the active MTG.
- Returns:
int
If v1 is not an ancestor of v2 (or vise versa), or if v1 and v2 are not defined at the same scale, an error value None is returned.
See also
MTG()
,Rank()
,Order()
,Height()
,EdgeType()
,AlgHeight()
,AlgOrder()
.
- openalea.mtg.aml.Ancestors(v, EdgeType='*', RestrictedTo='NoRestriction', ContainedIn=None)[source]¶
Array of all vertices which are ancestors of a given vertex
This function returns the array of vertices which are located before the vertex passed as an argument. These vertices are defined at the same scale as v. The array starts by v, then contains the vertices on the path from v back to the root (in this order) and finishes by the tree root.
Note
The anscestor array always contains at least the argument vertex v.
- Usage:
Ancestors(v)
- Parameters:
v (int) : vertex of the active MTG
- Optional Parameters:
RestrictedTo (str): cf. Father
ContainedIn (int): cf. Father
EdgeType (str): cf. Father
- Returns:
list of vertices’s id (int)
- Examples:
>>> v # prints vertex v 78 >>> Ancestors(v) # set of ancestors of v at the same scale [78,45,32,10,4] >>> list(reversed(Ancestors(v))) # To get the vertices in the order from the root to the vertex v [4,10,32,45,78]
See also
- openalea.mtg.aml.Axis(v, Scale=-1)[source]¶
Array of vertices constituting a botanical axis
An axis is a maximal sequence of vertices connected by ‘<’-type edges. Axis return the array of vertices representing the botanical axis which the argument v belongs to. The optional argument enables the user to choose the scale at which the axis decomposition is required.
- Usage:
Axis(v) Axis(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
See also
- openalea.mtg.aml.Class(vid)[source]¶
Class of a vertex
The
Class()
of a vertex is a feature always defined and independent of time (like the index). It is represented by an alphabetic character in upper or lower case (lower cases characters are considered different from upper cases). The label of a vertex is the string defined by the concatenation of its class and its index. The label thus provides general information about a vertex and enables us to encode the plant components.- Usage:
>>> Class(v)
- Parameters:
vid (int) : vertex of the active MTG
- Returns:
The class of the vertex.
- openalea.mtg.aml.ClassScale(c)[source]¶
Scale at which appears a given class of vertex
Every vertex is associated with a unique class. Vertices from a given class only appear at a given scale which can be retrieved using this function.
- Usage:
ClassScale(c)
- Parameters:
c (str) : symbol of the considered class
- Returns:
int
- openalea.mtg.aml.Complex(v, Scale=-1)[source]¶
Complex of a vertex.
Returns the complex of v. The complex of a vertex v has a scale lower than v : Scale(v) - 1. In a MTG, every vertex except for the MTG root (cf. MTGRoot), has a uniq complex. None is returned if the argument is the MTG Root or if the vertex is undefined.
- Usage:
Complex(v) Complex(v, Scale=2)
- Parameters:
v (int) : vertex of the active MTG
- Optional Parameters:
Scale (int) : scale of the complex
- Returns:
Returns vertex’s id (int)
- Details:
When a scale different form Scale(v)-1 is specified using the optional parameter Scale, this scale must be lower than that of the vertex argument.
Todo
Complex(v, Scale=10) returns v why ? is this expected
See also
- openalea.mtg.aml.ComponentRoots(v, Scale=-1)[source]¶
Set of roots of the tree graphs that compose a vertex
In a MTG, a vertex may have be decomposed into components. Some of these components are connected to each other, while other are not. In the most general case, the components of a vertex are organized into several tree-graphs. This is for example the case of a MTG containing the description of several plants: the MTG root vertex can be decomposed into tree graphs (not connected) that represent the different plants. This function returns the set of roots of these tree graphs at scale Scale(v)+1. The order of these roots is not significant.
When a scale different from Scale(v)+1 is specified using the optional argument
Scale()
, this scale must be greater than that of the vertex argument.- Usage:
ComponentRoots(v) ComponentRoots(v, Scale=s)
- Parameters:
v (int) : vertex of the active MTG
- Optional Parameters:
Scale (str): scale of the component roots.
- Returns:
list of vertices’s id (int)
- Examples:
>>> v=MTGRoot() # global MTG root 0 >>> ComponentRoots(v) # set of first vertices at scale 1 [1,34,76,100,199,255] >>> ComponentRoots(v, Scale=2) # set of first vertices at scale 2 [2,35,77,101,200,256]
See also
- openalea.mtg.aml.Components(v, Scale=-1)[source]¶
Set of components of a vertex.
The set of components of a vertex is returned as a list of vertices. If s defines the scale of v, components are defined at scale s + 1. The array is empty if the vertex has no components. The order of the components in the array is not significant.
When a scale is specified using optional argument :arg:Scale, it must be necessarily greater than the scale of the argument.
- Usage:
Components(v) Components(v, Scale=2)
- Parameters:
v (int) : vertex of the active MTG
- Optional Parameters:
Scale (int) : scale of the components.
- Returns:
list of int
- openalea.mtg.aml.DateSample(e1)[source]¶
Array of observation dates of a vertex.
Returns the set of dates at which a given vertex (passed as an argument) has been observed as an array of ordered dates. Options can be specified to define a temporal window and the total list of observation dates will be truncated according to the corresponding temporal window.
- Usage:
DateSample(v) DateSample(v, MinDate=d1, MaxDate=d2)
- Parameters:
v (VTX) : vertex of the active MTG.
- Optional Parameters:
MinDate (date) : defines a minimum date of interest.
MaxDate (date) : defines a maximum date of interest.
- Returns:
list of date
See also
MTG()
,FirstDefinedFeature()
,LastDefinedFeature()
,PreviousDate()
,NextDate()
.
- openalea.mtg.aml.Defined(vid)[source]¶
Test whether a given vertex belongs to the active MTG.
- Usage:
Defined(v)
- Parameters:
v (int) : vertex of the active MTG
- Returns:
True or False
See also
- openalea.mtg.aml.Descendants(v, EdgeType='*', RestrictedTo='NoRestriction', ContainedIn=None)[source]¶
Set of vertices in the branching system borne by a vertex.
This function returns the set of descendants of its argument as an array of vertices. The array thus consists of all the vertices, at the same scale as v, that belong to the branching system starting at v. The order of the vertices in the array is not significant.
Note
The argument always belongs to the set of its descendants.
- Usage:
Descendants(v)
- Parameters:
v (int) : vertex of the active MTG
- Optional Parameters:
RestrictedTo (str): cf. Father
ContainedIn (int): cf. Father
EdgeType (str): cf. Father
- Returns:
list of int.
- Examples:
>>> v 78 >>> Sons(v) # set of sons of v [78,99,101] >>> Descendants(v) # set of descendants of v [78,99,101,121,133,135,156,171,190]
See also
- openalea.mtg.aml.DressingData(e1)[source]¶
Use openalea.mtg.dresser.DressingData instead of this function
- openalea.mtg.aml.EdgeType(v1, v2)[source]¶
Type of connection between two vertices.
Returns the symbol of the type of connection between two vertices (either < or +). If the vertices are not connected, None is returned.
- Usage:
EdgeType(v1, v2)
- Parameters:
v1 (int) : vertex of the active MTG
v2 (int) : vertex of the active MTG
- Returns:
‘<’ (successor), ‘+’ (branching) or None
- openalea.mtg.aml.Extremities(v, RestrictedTo='NoRestriction', ContainedIn=None)[source]¶
Set of vertices that are the extremities of the branching system born by a given vertex.
This function returns the extremities of the branching system defined by the argument as a list of vertices. These vertices have the same scale as v and their order in the list is not signifiant. The result is always a non empty array.
- Usage:
Extremities(v)
- Properties:
v (int) : vertex of the active MTG
- Optional Parameters:
- Returns:
list of vertices’s id (int)
- Examples:
>>> Descendants(v) [3, 45, 47, 78, 102] >>> Extremities(v) [47, 102]
See also
- openalea.mtg.aml.Father(v, EdgeType='*', RestrictedTo='NoRestriction', ContainedIn=None, Scale=-1)[source]¶
Topological father of a given vertex.
Returns the topological father of a given vertex. And None if the father does not exist. If the argument is not a valid vertex, None is returned.
- Usage:
Father(v) Father(v, EdgeType='<') Father(v, RestrictedTo='SameComplex') Father(v, ContainedIn=complex_id) Father(v, Scale=s)
- Parameters:
v (int) : vertex of the active MTG
- Optional Parameters:
If no optional argument is specified, the function returns the topological father of the argument (vertex that bears or precedes to the vertex passed as an argument).
It may be usefull in some cases to consider that the function only applies to a subpart of the MTG (e.g. an axis).
The following options enables us to specify such restrictions:
EdgeType (str) : filter on the type of edge that connect the vertex to its father.
Values can be ‘<’, ‘+’, and ‘*’. Values ‘*’ means both ‘<’ and ‘+’. Only the vertex connected with the specified type of edge will be considered.
RestrictedTo (str) : filter defining a subpart of the MTG where the father must be considered. If the father is actually outside this subpart, the result is None. Possible subparts are defined using keywords in [‘SameComplex’, ‘SameAxis’, ‘NoRestriction’].
For instance, if RestrictedTo is set to ‘SameComplex’,
Father(v)()
returns a defined vertex only if the father f of v existsin the MTG and if v and f have the same complex.ContainedIn (int) : filter defining a subpart of the MTG where the father must be considered. If the father is actually outside this subpart, the result is None.
In this case, the subpart of the MTG is made of the vertices that composed composite_id (at any scale).
Scale (int) : the scale of the considered father. Returns the vertex from scale s which either bears and precedes the argument.
The scale s can be lower than the argument’s (corresponding to a question such as ‘which axis bears the internode?’) or greater (e.g. ‘which internodes bears this annual shoot?’).
- Returns:
the vertex id of the Father (int)
See also
MTG()
,Defined()
,Sons()
,EdgeType()
,Complex()
,Components()
.
- openalea.mtg.aml.Feature(vid, fname, date=None)[source]¶
Extracts the attributes of a vertex.
Returns the value of the attribute fname of a vertex in a MTG.
If the value of an attribute is not defined in the coding file, the value None is returned.
- Usage:
Feature(vid, fname) Feature(vid, fname, date)
- Parameters:
vid (int) : vertex of the active MTG.
fname (str) : name of the attribute (as specified in the coding file).
date (date) : (for a dynamic MTG) date at which the attribute of the vertex is considered.
- Returns:
int, str, date or float
- Details:
If for a given attribute, several values are available(corresponding to different dates), the date of interest must be specified as a third attribute.
This date must be a valid date appearing in the coding file for a considered vertex. Otherwise None is returned.
- Background:
MTGs and Dynamic MTGs.
Todo
specify the format of date
- openalea.mtg.aml.FirstDefinedFeature(e1, e2)[source]¶
Date of first observation of a vertex.
Returns the date d for which the attribute fname is defined for the first time on the vertex v passed as an argument. This date must be greater than the option MinDate and/or less than the maximum MaxData when specified. Otherwise the returned date is None.
- Usage:
FirstDefinedFeature(v, fname) FirstDefinedFeature(v, fname, MinDate=d1, MaxDate=d2)
- Properties:
v (int) : vertex of the active MTG
fname (str) : name of the considered property
- Optional Properties:
MinDate (date) : minimum date of interest.
MaxData (date) : maximum date of interest.
- Returns:
date
See also
MTG()
,DateSample()
,LastDefinedFeature()
,PreviousDate()
,NextDate()
.
- openalea.mtg.aml.Height(v1, v2=None)[source]¶
Number of components existing between two components in a tree graph.
The height of a vertex (v2) with respect to another vertex (v1) is the number of edges (of either type ‘+’ or ‘<’) that must be crossed when going from v1 to v2 in the graph.
This is a non-negative integer. When the function has only one argument v1, the height of v1 correspond to the height of v1`with respect to the root of the branching system containing `v1.
- Usage:
Height(v1) Height(v1, v2)
- Parameters:
v1 (int) : vertex of the active MTG
v2 (int) : vertex of the active MTG
- Returns:
int
Note
When the function takes two arguments, the order of the arguments is not important provided that one is an ancestor of the other. When the order is relevant, use function AlgHeight.
See also
MTG()
,Order()
,Rank()
,EdgeType()
,AlgHeight()
,AlgHeight()
,AlgOrder()
.
- openalea.mtg.aml.Index(vid)[source]¶
Index of a vertex
The
Index()
of a vertex is a feature always defined and independent of time (like the index). It is represented by a non negative integer. The label of a vertex is the string defined by the concatenation of its class and its index. The label thus provides general information about a vertex and enables us to encode the plant components.- Usage:
>>> Index(v)
- Parameters:
vid (int) : vertex of the active MTG
- Returns:
int
- openalea.mtg.aml.Label(v)[source]¶
Label of a vertex
- Usage:
>>> Label(v)
- Parameters:
vid (int) : vertex of the active MTG
- Returns:
The class and Index of the vertex (str).
- openalea.mtg.aml.LastDefinedFeature(e1, e2)[source]¶
Date of last observation of a given attribute of a vertex.
Returns the date d for which the attribute fname is defined for the last time on the vertex v passed as an argument. This date must be greater than the option MinDate and/or less than the maximum MaxData when specified. Otherwise the returned date is None.
- Usage:
FirstDefinedFeature(v, fname) FirstDefinedFeature(v, fname, MinDate=d1, MaxDate=d2)
- Properties:
v (int) : vertex of the active MTG
fname (str) : name of the considered property
- Optional Properties:
MinDate (date) : minimum date of interest.
MaxData (date) : maximum date of interest.
- Returns:
date
See also
MTG()
,DateSample()
,FirstDefinedFeature()
,PreviousDate()
,NextDate()
.
- openalea.mtg.aml.Location(v, Scale=-1, ContainedIn=None)[source]¶
Vertex defining the father of a vertex with maximum scale.
If no options are supplied, this function returns the vertex defining the father of a vertex with maximum scale (cf.
Father()
). If it does not exist, None is returned. If a scale is specified, the function is equivalent to Father(v, Scale=s).- Usage:
Location(v) Location(v, Scale=s) Location(v, ContainedIn=complex_id)
- Parameters:
v (int) : vertex of the active MTG.
- Optional Parameters:
Scale (int) : scale at which the location is required.
ContainedIn (int) : cf.
Father()
- Returns:
Returns vertex’s id (int)
- Examples:
>>> Father(v, EdgeType='+') 7 >>> Complex(v) 4 >>> Components(7) [9,19,23, 34, 77, 89] >>> Location(v) 23 >>> Location(v, Scale= Scale(v)+1) 23 >>> Location(v, Scale= Scale(v)) 7 >>> Location(v, Scale= Scale(v)-1) 4
- openalea.mtg.aml.MTG(filename)[source]¶
MTG constructor.
Builds a MTG from a coding file (text file) containing the description of one or several plants.
- Usage:
MTG(filename)
- Parameters:
filename (str): name of the coding file describing the mtg
- Returns:
If the parsing process succeeds, returns an object of type
MTG()
. Otherwise, an error is generated, and the formerly active MTG remains active.- Side Effect:
If the
MTG()
is built, the newMTG()
becomes the activeMTG()
(i.e. theMTG()
implicitly used by other functions such asFather()
,Sons()
,VtxList()
, …).- Details:
The parsing process is approximatively proportional to the number of components defined in the coding file.
- Background:
MTG is an acronyme for Multiscale Tree Graph.
See also
Activate()
and allopenalea.mtg.aml
functions.
- openalea.mtg.aml.MTGRoot()[source]¶
Returns the root vertex of the MTG.
It is the only vertex at scale 0 (the coarsest scale).
- Usage:
>>> MTGRoot()
- Returns:
vtx identifier
- Details:
This vertex is the complex of all vertices from scale 1. It is a mean to refer to the entire database.
See also
- openalea.mtg.aml.NextDate(e1)[source]¶
Next date at which a vertex has been observed after a specified date
Returns the first observation date at which the vertex has been observed starting at date d and proceeding forward in time. None is returned if it does not exists.
- Usage:
NextDate(v, d)
- Parameters:
v (int) : vertex of the active MTG.
d (date) : departure date.
- Returns:
date
See also
MTG()
,DateSample()
,FirstDefinedFeature()
,LastDefinedFeature()
,PreviousDate()
.
- openalea.mtg.aml.Order(v1, v2=None)[source]¶
Order of a vertex in a graph.
The order of a vertex (v2) with respect to another vertex (v1) is the number of edges of either type ‘+’ that must be crossed when going from v1 to v2 in the graph. This is thus a non negative integer which corresponds to the “botanical order”.
When the function only has one argument v1, the order of v1 correspond to the order of v1 with respect to the root of the branching system containing v1.
- Usage:
Order(v1) Order(v1, v2)
- Parameters:
v1 (int) : vertex of the active MTG
v2 (int) : vertex of the active MTG
- Returns:
int
Note
When the function takes two arguments, the order of the arguments is not important provided that one is an ancestor of the other. When the order is relevant, use function AlgOrder().
Warning
The value returned by function Order is 0 for trunks, 1 for branches etc. This might be different with some botanical conventions where 1 is the order of the trunk, 2 the order of branches, etc.
See also
MTG()
,Rank()
,Height()
,EdgeType()
,AlgOrder()
,AlgRank()
,AlgHeight()
.
- openalea.mtg.aml.Path(v1, v2)[source]¶
List of vertices defining the path between two vertices
This function returns the list of vertices defining the path between two vertices that are in an ancestor relationship. The vertex v1 must be an ancestor of vertex v2. Otherwise, if both vertices are valid, then the empty array is returned and if at least one vertex is undefined, None is returned.
- Usage:
Path(v1, v2)
- Parameters:
v1 (int) : vertex of the active MTG
v2 (int) : vertex of the active MTG
- Returns:
list of vertices’s id (int)
- Examples:
>>> v # print the value of v 78 >>> Ancestors(v) [78,45,32,10,4] >>> Path(10,v) [10,32,45,78] >>> Path(9,v) # 9 is not an ancestor of 78 []
Note
v1 can be equal to v2.
See also
- openalea.mtg.aml.PlantFrame(e1)[source]¶
Use openalea.mtg.plantframe.PlantFrame insteead of this function
- openalea.mtg.aml.Predecessor(v, **kwds)[source]¶
Father of a vertex connected to it by a ‘<’ edge
This function is equivalent to Father(v, EdgeType-> ‘<’). It thus returns the father (at the same scale) of the argument if it is located in the same botanical. If it does not exist, None is returned.
- Usage:
Predecessor(v)
- Parameters:
v (int) : vertex of the active MTG
- Optional Parameters:
RestrictedTo (str): cf. Father
ContainedIn (int): cf. Father
- Returns:
return the vertex id (int)
- Examples:
>>> Predecessor(v) 7 >>> Father(v, EdgeType='+') >>> Father(v, EdgeType-> '<') 7
See also
- openalea.mtg.aml.PreviousDate(e1)[source]¶
Previous date at which a vertex has been observed after a specified date.
Returns the first observation date at which the vertex has been observed starting at date d and proceeding backward in time. None is returned if it does not exists.
- Usage:
PreviousDate(v, d)
- Parameters:
v (int) : vertex of the active MTG.
d (date) : departure date.
- Returns:
date
See also
MTG()
,DateSample()
,FirstDefinedFeature()
,LastDefinedFeature()
,NextDate()
.
- openalea.mtg.aml.Rank(v1, v2=None)[source]¶
Rank of one vertex with respect to another one.
This function returns the number of consecutive ‘<’-type edges between two components, at the same scale, and does not take into account the order of vertices v1 and v2. The result is a non negative integer.
- Usage:
Rank(v1) Rank(v1, v2)
- Parameters:
v1 (int) : vertex of the active MTG
v2 (int) : vertex of the active MTG
- Returns:
int
If v1 is not an ancestor of v2 (or vise versa) within the same botanical axis, or if v1 and v2 are not defined at the same scale, an error value Undef id returned.
See also
MTG()
,Order()
,Height()
,EdgeType()
,AlgRank()
,AlgHeight()
,AlgOrder()
.
- openalea.mtg.aml.Root(v, RestrictedTo='*', ContainedIn=None)[source]¶
Root of the branching system containing a vertex
This function is equivalent to Ancestors(v, EdgeType=’<’)[-1]. It thus returns the root of the branching system containing the argument. This function never returns None.
- Usage:
Root(v)
- Parameters:
v (int) : vertex of the active MTG
- Optional Parameters:
RestrictedTo (str): cf. Father
ContainedIn (int): cf. Father
- Returns:
return vertex’s id (int)
- Examples:
>>> Ancestors(v) # set of ancestors of v [102,78,35,33,24,12] >>> Root(v) # root of the branching system containing v 12
See also
- openalea.mtg.aml.Scale(vid)[source]¶
Scale of a vertex
Returns the scale at which is defined the argument.
- Usage:
>>> Scale(vid)
- Parameters:
vid (int) : vertex of the active MTG
vid (PlantFrame) : a PlantFrame object computed on the active MTG
vid (LineTree) : a LineTree computed on a PlantFrame representing the active MTG
- Returns:
int
See also
- openalea.mtg.aml.Sons(v, RestrictedTo='NoRestriction', EdgeType='*', Scale=-1, ContainedIn=None)[source]¶
Set of vertices born or preceded by a vertex
The set of sons of a given vertex is returned as an array of vertices. The order of the vertices in the array is not significant. The array can be empty if there are no son vertices.
- Usage:
from openalea.mtg.aml import Sons Sons(v) Sons(v, EdgeType= '+') Sons(v, Scale= 3)
- Parameters:
v (int) : vertex of the active MTG
- Optional Parameters:
RestrictedTo (str) : cf. Father
ContainedIn (int) : cf. Father
EdgeType (str) : filter on the type of sons.
Scale (int) : set the scale at which sons are considered.
- Returns:
list(vid)
- Details:
When the option EdgeType is applied, the function returns the set of sons that are connected to the argument with the specified type of relation.
Note
Sons(v, EdgeType= ‘<’) is not equivalent to Successor(v). The first function returns an array of vertices while the second function returns a vertex.
The returned vertices have the same scale as the argument. However, coarser or finer vertices can be obtained by specifying the optional argument Scale at which the sons are considered.
- Examples:
>>> Sons(v) [3,45,47,78,102] >>> Sons(v, EdgeType= '+') # set of vertices borne by v [3,45,47,102] >>> Sons(v, EdgeType= '<') # set of successors of v on the same axis [78]
See also
- openalea.mtg.aml.Successor(v, RestrictedTo='NoRestriction', ContainedIn=None)[source]¶
Vertex that is connected to a given vertex by a ‘<’ edge type (i.e. in the same botanical axis).
This function is equivalent to Sons(v, EdgeType=’<’)[0]. It returns the vertex that is connected to a given vertex by a ‘<’ edge type (i.e. in the same botanical axis). If many such vertices exist, an arbitrary one is returned by the function. If no such vertex exists, None is returned.
- Usage:
Successor(v)
- Parameters:
v1 (int) : vertex of the active MTG
- Optional Parameters:
RestrictedTo (str): cf. Father
ContainedIn (int): cf. Father
- Returns:
Returns vertex’s id (int)
- Examples:
>>> Sons(v) [3, 45, 47, 78, 102] >>> Sons(v, EdgeType='+') # set of vertices borne by v [3, 45, 47, 102] >>> Sons(v, EdgeType-> '<') # set of successors of v [78] >>> Successor(v) 78
See also
- openalea.mtg.aml.Trunk(v, Scale=-1)[source]¶
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:
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
See also
MTG()
,Path()
,Ancestors()
,Axis()
.
- openalea.mtg.aml.VtxList(Scale=-1)[source]¶
Array of vertices contained in a MTG
The set of all vertices in the
MTG()
is returned as an array. Vertices from all scales are returned if no option is used. The order of the elements in this array is not significant.- Usage:
>>> VtxList() >>> VtxList(Scale=2)
- Optional Parameters:
Scale (int): used to select components at a particular scale.
- Returns:
list of vid
- Background:
MTGs()
Download the source file ../../src/mtg/aml.py
.