Reference guide#

openalea.adel.fitting module#

openalea.adel.fitting.curvilinear_abscisse(x, y)[source]#
openalea.adel.fitting.discretize(leaf_spline, nb_polygones, length_max, radius_max)[source]#

Compute a mesh from a leaf represented by a 3d spline containing x, y and radius.

Final radius have to be null.

openalea.adel.fitting.fit2(x, y, s, r)[source]#

x, y: 2d points s: curvilinear abscissa r: leaf radius

Algo:
  1. fit x, y
    1. discretize the splines (high: 100)

    2. compute curvilinear abscissa

    3. normalize :
      • compute length and divide x, y by length

  2. fit r, s
    1. discretize r, s (high 500)

    2. normalize :
      • compute max r, s and divide r, s

    3. compute leaf surface

    4. r_t1-> found r(s): interp(s_t1,s_t2, r_t2)

  3. fit x(t1), y(t1), r(t1)

  4. return (x, y, r) and surface value

openalea.adel.fitting.fit3(x, y, s, r, nb_points)[source]#
openalea.adel.fitting.fit_leaf(x, y, s, r)[source]#

x, y: 2d points s: curvilinear abscissa r: leaf radius

Algo:
  1. fit x, y
    1. discretize the splines (high: 100)

    2. compute curvilinear abscissa

    3. normalize :
      • compute length and divide x, y by length

  2. fit r, s
    1. discretize r, s (high 500)

    2. normalize :
      • compute max r, s and divide r, s

    3. compute leaf surface

    4. r-t1-> found r(s): interp(s_t1,s_t2, r_t2)

  3. fit x(t1), y(t1), r(t1)

  4. return (x, y, r) and surface value

openalea.adel.fitting.fit_leaves(leaves, nb_points, dynamic=False)[source]#
openalea.adel.fitting.leaf_element(leaf, length_max, length, s_base, s_top, radius_max)[source]#
openalea.adel.fitting.leaf_shape(leaf, nb_triangles, length_max, length, radius_max)[source]#
openalea.adel.fitting.leaf_shape2(leaf, nb_triangles, length_max, length, radius_max)[source]#
openalea.adel.fitting.leaf_to_mesh(x, y, r, twist_start=0, twist_end=0, **kwds)[source]#
openalea.adel.fitting.leaf_to_mesh_new(x, y, r, twist=True, nb_twist=1.0, nb_waves=8, **kwds)[source]#
openalea.adel.fitting.mesh(leaf_spline, nb_polygones, length_max, length, radius_max)[source]#
openalea.adel.fitting.mesh2(leaf, length_max, length, radius_max)[source]#
openalea.adel.fitting.mesh3(leaf, length_max, length, radius_max, antisens=True)[source]#
openalea.adel.fitting.mesh4(leaf, length_max, length, s_base, s_top, radius_max, twist=0, volume=0.1, min_area=1e-06)[source]#
openalea.adel.fitting.partial_leaf(leaf_spline, nb_polygones, length_max, length, radius_max)[source]#

Compute a mesh from a leaf represented by a 3d spline containing x, y and radius. Final radius have to be null. The leaf is obtained by evaluating the central curve on a domain [0, l/lmax] and the radius on a domain [1-l/lmax, 1].

openalea.adel.fitting.plantgl_shape(points, indices)[source]#
openalea.adel.fitting.qslim(nb_triangles, points, indexes)[source]#

Decimate a mesh using the qslim software. Return the new mesh with fewer triangles. Try to respect angles and end points.

openalea.adel.fitting.read_smf(filename)[source]#

Read a smf file containing a mesh. Returns the point set and the face set.

openalea.adel.fitting.simplify(leaf, nb_points, scale_radius=True)[source]#

“ Simplify a 2d polyline up to nb_points :param leaf: :type leaf: a x, y, s, r tuple of iterables representing the 2d polyline to be simplified :param nb_points: :type nb_points: the number of points along the polyline after simplification :param scale_radius: polygonial_area(simplified_leaf) = smooth_area(input_leaf) ? :type scale_radius: (bool, default=True) should radius be scaled after simplification to ensure

Return type:

a x, y, s, r tuple of iterables for the simplified 2d polyline

openalea.adel.fitting.write_smf(filename, points, indices)[source]#

Write a smf file for QSlim software. See http://people.scs.fsu.edu/~burkardt/data/smf/smf.html

openalea.adel.label module#

Labels for the canestra file management.

class openalea.adel.label.Label[source]#

Bases: object

Label is an object to deals with can file cryptic label. It provide a way to store various information in one field.

property elt_id#
is_leaf()[source]#
is_soil()[source]#
is_stem()[source]#
property leaf_id#
property optical_id#
property plant_id#
property transparency#

openalea.adel.symbol module#

Define generic symbols for the different organs.

Symbols are:
LeafElement( tissue_type (int),

final_length, length, radius_max, s_base, s_top ([0,1]), leaf_id (rank), seed (random) )

StemElement( tissue type (int) , length, diam_base, diam_top)

class openalea.adel.symbol.LeafElement(database, seed=None, relative_angle=True)[source]#

Bases: Symbol

class openalea.adel.symbol.StemElement(database, seed=None)[source]#

Bases: Symbol

class openalea.adel.symbol.Symbol[source]#

Bases: object

openalea.adel.symbol.build_symbols(leaves, seed=None, relative_angle=True)[source]#
openalea.adel.symbol.normal(set)[source]#
openalea.adel.symbol.optical(tissue_type)[source]#
openalea.adel.symbol.slim_cylinder(length, radius_base, radius_top)[source]#

Try to construct a cylinder with a low number of triangles.

openalea.adel.AdelR module#

openalea.adel.AdelR.R_srdb(rdata)[source]#

return a python readable database from RData file containing leaf sr data - rdata is a regular .RData file containing a named list of list of xy matrix/dataframes

openalea.adel.AdelR.R_xydb(rdata)[source]#

return a python readable database from RData file containing leaf xy data - rdata is a regular .RData file containing a named list of list of xy matrix/dataframes

openalea.adel.AdelR.Rdflist(dictOfdict)[source]#

convert a dict of dict of numpy vectors into a Rlist of Rdataframe

openalea.adel.AdelR.RdflistAsdicts(Rdflist)[source]#

convert a Rlist of Rdataframe into a dict of dict of numpy vectors

openalea.adel.AdelR.RlistAsDict(Rlist)[source]#

returns a dictionary containing the elements of the Rlist

openalea.adel.AdelR.RunAdel(datesTT, plant_parameters, adelpars=None)[source]#

Run Adel model for each date in datesTT according to parameter list

openalea.adel.AdelR.canL2canS(RcanT, srdb, shrink=1)[source]#

outputs are : - Ll : length of the blade - Lv : visible (emerged) length of blade (green + senesced, rolled + unrolled) - Lr : rolled part of the blade - Lsen : length of the senescent part of the blade (hidden + visible) - L_shape : Mature length of the blade used to compute blade shape - Lw_shape : Maximal width of the blade used to compute blade shape - Linc : relative inclination of the base of leaf blade at the top of leaf sheath (deg) - Laz : relative azimuth of the leaf - Lsect : the number of sectors per leaf blade - Gl : length of the sheath (hidden + visible) - Gv : emerged length of the sheath - Gsen : senescent length of the sheath (hidden + visible) - Gd : apparent diameter of the sheath - Ginc : relative inclination of the sheath - El: length of the internode (hidden + visible) - Ev: emerged length of the internode - Esen: senescent length of the internode (hidden + visible) - Ed: diameter of the internode - Einc : relative inclination of the internode

openalea.adel.AdelR.checkAxeDyn(setAdelPars, dates, plant_density=1)[source]#

Compute the number of axes present in the canopy at given dates

openalea.adel.AdelR.csvAsDict(fn, type=1)[source]#

returns a dictionnary with the content of csv file as numpy vectors (one colum = one key)

openalea.adel.AdelR.dataframe(d)[source]#

convert a dict of numbers to an RDataframe

openalea.adel.AdelR.dataframeAsdict(df)[source]#

convert an RDataframe to a python dict

openalea.adel.AdelR.devCsv(axeTfn, dimTfn, phenTfn, earTfn=None, ssi2senTfn=None)[source]#

Import development parameters for adel from csv files and/or pandas dataframes

openalea.adel.AdelR.freeGeoAxe(rcode)[source]#

returns geoAxe code from txt definition

openalea.adel.AdelR.freeGeoLeaf(rcode)[source]#

returns geoLeaf code from txt definition

openalea.adel.AdelR.genGeoAxe(azM=75, daz=5, ibmM=2, dibm=2, incT=60, dinT=5, dep=7, depMin=1.5, dazTb=60)[source]#

generate geoAxe R code for Adel

Parameters:
  • Azimuth" (- "axe) – define the rotation of a tiller around its axe, if azTb_true=0 and azM=90 then leaf1 of tiller is in the same plane as the beaning leaf

  • "dazT" (-) – is the random deviation around azM (azM_true = azM +/- daz/2)

  • inclination" (- "tiller) – is the inclination of the main stem

  • "dincBm" (-) – is the random deviation around incBm (incBm_true = (incBm +/- dincBm/2)

  • inclination"

  • "dincT" (-) – is the random deviation around incT

  • "dredTMax" (-) – is the maximal distance at which the tiller will go upward (the distance at flowering between top of parent axe and top of tiller)

  • "dredMin" (-) – is the minimal distance at which tiller go upward

  • "dazTb" (-) – is the random deviation around “azTb” which is the azimuth angle between tiller axe and the midrib of bearing leaf. we suppose that (azTb = 0), so (azTb_true = 0 +/- dazTb/2)

openalea.adel.AdelR.genGeoLeaf(nlim=4, dazt=60, dazb=10)[source]#

generate geoLeaf function for Adel

openalea.adel.AdelR.genString(RcanopyT)[source]#

Generate a Lsystem string from an R dataframe representing the canopy

openalea.adel.AdelR.getAxeT(setAdelPars)[source]#

return axeT table

openalea.adel.AdelR.getPhenT(setAdelPars, axe='MS')[source]#

return phenT table

openalea.adel.AdelR.getPhytoT(setAdelPars, axe='MS')[source]#

return phytoT table

openalea.adel.AdelR.get_rcode(file_name)[source]#
openalea.adel.AdelR.leaf_keys(lindex, lseed, db)[source]#

convert R-style lindex/lseed (also called LcType/Lindex in canopy table) into (keys,index) of python xy/sr databases

openalea.adel.AdelR.plantSample(setAdelPars)[source]#

return id of plants used by setAdel to set up the canopy

openalea.adel.AdelR.readRData(fn)[source]#

return a dictionary containing the Robject of the RData file

openalea.adel.AdelR.saveRData(Robj, name, fn)[source]#

name and write the Robj to RData file

openalea.adel.AdelR.setAdel(devT, RcodegeoLeaf, RcodegeoAxe, nplants=1, seed=None, xydb=None, srdb=None, sample='random', ssipars=None)[source]#

Creates a set of parameter for simulating np plants with adel from R inputs (see adeldoc.R)

openalea.adel.AdelR.setAdelArv(Rcalage, Rfunstr, np, sdlev=20)[source]#

Creates a set of parameter for simulating np plants with adel from arvalis calage Rdata (deprecated)

openalea.adel.AdelR.setCanopy(RcanT, nplants=1, randomize=True, seed=None)[source]#

Duplicates or subsample a canopy table to create a new canopy with specified number of plants. Randomise allows for random sample and random azimuth

openalea.adel.mtg module#

Methods on the mtg for adel programs. Author: Christophe Pradal License: CeCILL Date: 08/07/2008

class openalea.adel.mtg.CanMTG(functions, axial_string)[source]#

Bases: MTG

AlgHeight(v1, v2)#

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().

AlgOrder(v1, v2)#

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().

AlgRank(v1, v2)#

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().

Ancestors(v, EdgeType='*', RestrictedTo='NoRestriction', ContainedIn=None)#

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:

g.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
>>> g.Ancestors(v) # set of ancestors of v at the same scale
[78,45,32,10,4]
>>> list(reversed(g.Ancestors(v))) # To get the vertices in the order from the root to the vertex v
[4,10,32,45,78]

See also

MTG(), Descendants().

Axis(v, Scale=-1)#

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

user/mtg_axis.png

See also

MTG(), Path(), Ancestors().

Class(vid)#

Class of a vertex.

The Class of a vertex are the first characters of the label. The label of a vertex is the string defined by the concatenation of the class and its index.

The label thus provides general information about a vertex and enable to encode the plant components.

The class_name may be not defined. Then, an empty string is returned.

Usage:
>>> g.class_name(1)
Parameters:
  • vid (int)

Returns:

The class name of the vertex (str).

See also

MTG(), openalea.mtg.aml.Index(), openalea.mtg.aml.Class()

ClassScale(c)#

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

See also

MTG(), Class(), Scale(), Index().

Complex(v, Scale=-1)#

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:

g.Complex(v)
g.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.

See also

MTG(), Components().

ComponentRoots(v, Scale=-1)#

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:

g.ComponentRoots(v)
g.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=g.MTGRoot() # global MTG root
0
>>> g.ComponentRoots(v) # set of first vertices at scale 1
[1,34,76,100,199,255]
>>> g.ComponentRoots(v, Scale=2) # set of first vertices at scale 2
[2,35,77,101,200,256]
user/mtg_componentroots.png

See also

MTG(), Components(), Trunk().

Components(v, Scale=-1)#

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

user/mtg_components.png

See also

MTG(), Complex().

Defined(vid)#

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

MTG().

Descendants(v, EdgeType='*', RestrictedTo='NoRestriction', ContainedIn=None)#

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:

g.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
>>> g.Sons(v) # set of sons of v
[78,99,101]
>>> g.Descendants(v) # set of descendants of v
[78,99,101,121,133,135,156,171,190]
user/mtg_descendants.png

See also

MTG(), Ancestors().

EdgeType(v1, v2)#

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

user/mtg_edgetype.png

See also

MTG(), Sons(), Father().

Extremities(v, RestrictedTo='NoRestriction', ContainedIn=None)#

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:

>>> g.Descendants(v)
[3, 45, 47, 78, 102]
>>> g.Extremities(v)
[47, 102]

See also

MTG(), Descendants(), Root(), MTGRoot().

Father(v, EdgeType='*', RestrictedTo='NoRestriction', ContainedIn=None, Scale=-1)#

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:

g.Father(v)
g.Father(v, EdgeType='<')
g.Father(v, RestrictedTo='SameComplex')
g.Father(v, ContainedIn=complex_id)
g.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)

Height(v1, v2=None)#

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().

Index(vid)#

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.

Label(vid)#

Label of a vertex.

Usage:
>>> g.label(v)
Parameters:
  • vid (int) : vertex of the MTG

Returns:

The class and Index of the vertex (str).

See also

MTG(), index(), class_name()

Path(v1, v2)#

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:

g.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
>>> g.Ancestors(v)
[78,45,32,10,4]
>>> g.Path(10,v)
[10,32,45,78]
>>> g.Path(9,v) # 9 is not an ancestor of 78
[]

Note

v1 can be equal to v2.

user/mtg_path.png

See also

MTG(), Axis(), Ancestors().

Predecessor(v, **kwds)#

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

MTG(), Father(), Successor().

Rank(v1, v2=None)#

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().

Root(v, RestrictedTo='*', ContainedIn=None)#

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:

g.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:

>>> g.Ancestors(v) # set of ancestors of v
[102,78,35,33,24,12]
>>> g.Root(v) # root of the branching system containing v
12
user/mtg_root.png

See also

MTG(), Extremities().

Scale(vid)#

Returns the scale of a vertex.

All vertices should belong to a given scale.

Usage:

g.scale(vid)
Parameters:
  • vid (int) - vertex identifier.

Returns:

The scale of the vertex. It is a positive int in [0,g.max_scale()].

Sons(v, RestrictedTo='NoRestriction', EdgeType='*', Scale=-1, ContainedIn=None)#

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:

g.Sons(v)
g.Sons(v, EdgeType= '+')
g.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:

>>> g.Sons(v)
[3,45,47,78,102]
>>>  g.Sons(v, EdgeType= '+') # set of vertices borne by v
[3,45,47,102]
>>>  g.Sons(v, EdgeType= '<') # set of successors of v on the same axis
[78]

See also

MTG(), Father(), Successor(), Descendants().

Successor(v, RestrictedTo='NoRestriction', ContainedIn=None)#

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:

g.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:

>>> g.Sons(v)
[3, 45, 47, 78, 102]
>>> g.Sons(v, EdgeType='+') # set of vertices borne by v
[3, 45, 47, 102]
>>> g.Sons(v, EdgeType-> '<') # set of successors of v
[78]
>>> g.Successor(v)
78

See also

MTG(), Sons(), Predecessor().

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:

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

See also

MTG(), Path(), Ancestors(), Axis().

VtxList(Scale=-1)#

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()

See also

MTG(), scale(), Class(), index().

add_child(parent, child=None, **properties)#

Add a child to a parent. Child is appended to the parent’s child list.

Parameters:
  • parent (int) - The parent identifier.

  • child (int or None) - The child identifier. If None,

    an ID is generated.

Returns:

Identifier of the inserted vertex (child)

Returns Type:

int

add_child_and_complex(parent, child=None, complex=None, **properties)#

Add a child at the end of children that belong to an other complex.

Parameters:
  • parent: The parent identifier.

  • child: Set the child identifier to this value if defined.

  • complex: Set the complex identifier to this value if defined.

Returns:

(vid, vid): child and complex ids.

add_child_tree(parent, tree)#

Add a tree after the children of the parent vertex. Complexity have to be O(1) if tree == sub_tree()

Parameters:
  • parent – vertex identifier

  • tree – a rooted tree

add_component(complex_id, component_id=None, **properties)#

Add a component at the end of the components

Parameters:
  • complex_id: The complex identifier.

  • component_id: Set the component identifier to this value if defined.

Returns:

The id of the new component or the component_id if given.

add_element(parent_id, edge_type='/', scale_id=None)#

Add an element to the graph, if vid is not provided create a new vid ??? .. warning: Not Implemented.

Parameters:

  • parent_id (int) - The id of the parent vertex

  • edge_type (str) - The type of relation:
    • “/” : component (default)

    • “+” : branch

    • “<” : successor.

  • scale_id (int) - The id of the scale in which to

    add the vertex.

Returns:

The vid of the created vertex

add_property(property_name)#

Add a new map between vid and a data Do not fill this property for any vertex

children(vtx_id)#

returns a vertex iterator

Parameters:

vtx_id – The vertex identifier.

Returns:

iter of vertex identifier

children_iter(vtx_id)#

returns a vertex iterator

Parameters:

vtx_id – The vertex identifier.

Returns:

iter of vertex identifier

class_name(vid)#

Class of a vertex.

The Class of a vertex are the first characters of the label. The label of a vertex is the string defined by the concatenation of the class and its index.

The label thus provides general information about a vertex and enable to encode the plant components.

The class_name may be not defined. Then, an empty string is returned.

Usage:
>>> g.class_name(1)
Parameters:
  • vid (int)

Returns:

The class name of the vertex (str).

See also

MTG(), openalea.mtg.aml.Index(), openalea.mtg.aml.Class()

clear()#

Remove all vertices and edges from the MTG.

This also removes all vertex properties. Don’t change references to object such as internal dictionaries.

Example:
>>> g.clear()
>>> g.nb_vertices()
0
>>> len(g)
0
clear_properties(exclude=[])#

Remove all the properties of the MTG.

Example:
>>> g.clear_properties()
complex(vtx_id)#

Returns the complex of vtx_id.

Parameters:
  • vtx_id (int) - The vertex identifier.

Returns:

complex identifier or None if vtx_id has no parent.

Return Type:

int

complex_at_scale(vtx_id, scale)#

Returns the complex of vtx_id at scale scale.

Parameters:
  • vtx_id: The vertex identifier.

  • scale: The scale identifier.

Returns:

vertex identifier

Returns Type:

int

component_roots(vtx_id)#

Return the set of roots of the tree graphs that compose a vertex.

component_roots_at_scale(vtx_id, scale)#

Return the list of roots of the tree graphs that compose a vertex.

component_roots_at_scale_iter(vtx_id, scale)#

Return the set of roots of the tree graphs that compose a vertex.

component_roots_iter(vtx_id)#

Return an iterator of the roots of the tree graphs that compose a vertex.

components(vid)#

returns the components of a vertex

Parameters:

vid – The vertex identifier.

Returns:

list of vertex identifier

components_at_scale(vid, scale)#

returns a vertex iterator

Parameters:
  • vid: The vertex identifier.

Returns:

iter of vertex identifier

components_at_scale_iter(vid, scale)#

returns a vertex iterator

Parameters:
  • vid: The vertex identifier.

Returns:

iter of vertex identifier

components_iter(vid)#

returns a vertex iterator

Parameters:

vid – The vertex identifier.

Returns:

iter of vertex identifier

copy()#

Return a copy of the graph.

Returns:
  • g (MTG) - A copy of the MTG

display(max_scale=0, display_id=True, display_scale=False, nb_tab=12, **kwds)#

Print an MTG on the console.

Optional Parameters:
  • max_scale: do not print vertices of scale greater than max_scale

  • display_id: display the vid of the vertices

  • display_scale: display the scale of the vertices

  • nb_tab: display the MTG using nb_tab columns

edge_type(vid)#

Type of the edge between a vertex and its parent.

The different values are ‘<’ for successor, and ‘+’ for ramification.

edges(scale=-1)#
Parameters:
  • scale (int) - Scale at which to iterate.

Returns:

Iterator on the edges of the MTG at a given scale or on all edges if scale < 0.

Returns Type:

iter

get_root()#

Return the tree root.

Returns:

vertex identifier

get_vertex_property(vid)#

Returns all the properties defined on a vertex.

graph_properties()#

return a dict containing the graph properties/

Return type:

dict of {property_name:data}

has_vertex(vid)#

Tests whether a vertex belongs to the graph.

Parameters:
  • vid (int) - vertex id to test

Returns Type:

bool

index(vid)#

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.

insert_parent(vtx_id, parent_id=None, **properties)#

Insert parent_id between vtx_id and its actual parent. Inherit of the complex of the parent of vtx_id.

Parameters:
  • vtx_id (int): a vertex identifier

  • parent_id (int): a vertex identifier

Returns:

Identifier of the inserted vertex (parent_id).

Returns Type:

int

insert_scale(inf_scale=None, partition=None, default_label=None, preserve_order=True)#

Add a scale to MTG

Parameters:

  • inf_scale (int) - New scale is inserted between inf_scale and inf_scale-1

  • partition (lambda v: bool) - Function defining new scale by quotienting vertices at inf_scale

  • default_label (str) - default label of inserted vertices

  • preserve_order (bool) - True iif children at new scale are ordered consistently

    with children at inf_scale

Returns:

MTG with inserted scale

Remark:
  • New scale is inserted in self as well.

  • function partition should return True at roots of subtrees where partition changes

and False elsewhere.

insert_sibling(vtx_id1, vtx_id2=None, **properties)#

Insert a sibling of vtk_id1. The vertex in inserted before vtx_id1.

Parameters:
  • vtx_id1 (int) : a vertex identifier

  • vtx_id2 (int) : the vertex to insert

Returns:

Identifier of the inserted vertex (vtx_id2)

Returns Type:

int

insert_sibling_tree(vid, tree)#

Insert a tree before the vid. vid and the root of the tree are siblings. Complexity have to be O(1) if tree comes from the actual tree ( tree= self.sub_tree() )

Parameters:
  • vid – vertex identifier

  • tree – a rooted tree

is_leaf(vtx_id)#

Test if vtx_id is a leaf.

Returns:

bool

is_valid()#

Tests the validity of the graph. Currently always returns True.

Returns Type:

bool

Todo:

Implement this function.

iter_edges(scale=-1)#
Parameters:
  • scale (int) - Scale at which to iterate.

Returns:

Iterator on the edges of the MTG at a given scale or on all edges if scale < 0.

Returns Type:

iter

iteredges(scale=-1)#

Iter on the edges of the tree.

label(vid)#

Label of a vertex.

Usage:
>>> g.label(v)
Parameters:
  • vid (int) : vertex of the MTG

Returns:

The class and Index of the vertex (str).

See also

MTG(), index(), class_name()

max_scale()#

Return the max scale identifier.

By convention, the mtg contains scales in [0,max\_scale].

Usage:
>>> print(g.max_scale())
Returns:

S, the maximum scale identifier.

Note

The complexity is O(n).

See also

scale(), scales()

nb_children(vtx_id)#

returns the number of children

Parameters:
  • vtx_id: The vertex identifier.

Returns:

int

nb_components(vid)#

returns the number of components

Parameters:
  • vid: The vertex identifier.

Returns:

int

nb_scales()#
Returns:

The number of scales defined in the mtg..

Returns Type:

int

Note

The complexity is O(n).

nb_siblings(vtx_id)#

returns the number of siblings

Returns:

int

nb_vertices(scale=-1)#

Returns the number of vertices.

Usage:
>>> g.nb_vertices()
100
>>> g.nb_vertices(scale=3)
68
Parameters:
  • scale (int) - Id of scale for which to count vertices.

Returns:

Number of vertices at scale or total number of vertices if scale < 0.

node(vid, klass=None)#

Return a node associated to the vertex vid.

It allows to access to the properties with an object oriented interface.

Example:

node = g.node(1)
print(node.edge_type)
print(node.label)
node.label = 'B'
print(g.label(1))

print(node.parent)
print(list(node.children))
order(v1)#

Order of a vertex in a graph.

The order of a vertex in a graph is the number of ‘+’ edges crossed when going from v1`to `v2.

If v2 is None, the order of v1 correspond to the order of v1 with respect to the root.

parent(vtx_id)#

Return the parent of vtx_id.

Parameters:
  • vtx_id: The vertex identifier.

Returns:

vertex identifier

planter(distribution, random_seed=0, azimuths=None)#

Transform a set of plants with given point distributions.

Parameters:
  • g: MTG

  • distribution: a list of 2D positions

  • random_seed: add a random rotation to each plant if the value is positive.In this case, random_seed is used as a seed.

  • azimuth : a list defining plant azimuths (in radians). The list is recycled to achieve positioning of all the plants

plot_property(prop, **kwds)#

Plot properties of MTG using matplotlib

Example:
>>> g.plot_property('length')
properties()#

Returns all the property maps contain in the graph.

property(name)#

Returns the property map between the vid and the data. :returns: dict of {vid:data}

property_names()#

names of all property maps. Properties are defined only on vertices, even edge properties. return iter of names

property_names_iter()#

iter on names of all property maps. Properties are defined only on vertices, even edge properties. return iter of names

reindex(mapping=None, copy=False)#

Assign a new identifier to each vertex.

This method assigns a new identifier to each vertex of the MTG. The mapping can be user defined or is implicit (mapping). This method modify the MTG in place or return a new MTG (copy).

Usage:

>>> g.reindex()
>>> g1 = g.reindex(copy=True)
>>> mymap = dict(zip(list(traversal.iter_mtg2(g,g.root)), range(len(g))))
>>> g2 = g.reindex(mapping=mymap, copy=True)
Optional Parameters:
  • mapping (dict): define a mapping between old and new vertex identifiers.

  • copy (bool) : modify the object in place or return a new MTG.

Returns:
  • a MTG

Background:

MTGs()

See also

sub_mtg()

remove_property(property_name)#

Remove the property map called property_name from the graph.

remove_scale(scale)#

Remove all the vertices at a given scale.

The upper and lower scale are then connected.

Parameters:#

  • scale : the scale that have to be removed

returns:
  • - g (the input MTG modified in place.)

  • - results (a list of dict) – all the vertices that have been removed

remove_tree(vtx_id)#

Remove the sub tree rooted on vtx_id.

Returns:

bool

remove_vertex(vid, reparent_child=False)#

Remove a specified vertex of the graph and remove all the edges attached to it.

Parameters:
  • vid (int) : the id of the vertex to remove

  • reparent_child (bool) : reparent the children of vid to its parent.

Returns:

None

replace_parent(vtx_id, new_parent_id, **properties)#

Change the parent of vtx_id to new_parent_id. The new parent of vtx_id is new_parent_id. vtx_id and new_parent_id must have the same scale.

This function do not change the edge_type between vtx_id and its parent.

Inherit of the complex of the parent of vtx_id.

Parameters:
  • vtx_id (int): a vertex identifier

  • new_parent_id (int): a vertex identifier

Returns:

None

property root#

Return the tree root.

Returns:

vertex identifier

roots(scale=0)#

Returns a list of the roots of the tree graphs at a given scale.

In an MTG, the MTG root vertex, namely the vertex g.root, can be decomposed into several, non-connected, tree graphs at a given scale. This is for example the case of an MTG containing the description of several plants.

Usage:

roots = g.roots(scale=g.max_scale()

Returns:

list on vertex identifiers of root vertices at a given scale.

Returns Type:

list of vid

user/mtg_componentroots.png
roots_iter(scale=0)#

Returns an iterator of the roots of the tree graphs at a given scale.

In an MTG, the MTG root vertex, namely the vertex g.root, can be decomposed into several, non-connected, tree graphs at a given scale. This is for example the case of an MTG containing the description of several plants.

Usage:

roots = list(g.roots(scale=g.max_scale())

Returns:

iterator on vertex identifiers of root vertices at a given scale.

Returns Type:

iter

user/mtg_componentroots.png
scale(vid)#

Returns the scale of a vertex.

All vertices should belong to a given scale.

Usage:

g.scale(vid)
Parameters:
  • vid (int) - vertex identifier.

Returns:

The scale of the vertex. It is a positive int in [0,g.max_scale()].

scales()#

Return the different scales of the mtg.

Returns:

Iterator on scale identifiers (ints).

Note

The complexity is O(n).

scales_iter()#

Return the different scales of the mtg.

Returns:

Iterator on scale identifiers (ints).

Note

The complexity is O(n).

set_root(vtx_id)#

Set the tree root.

Parameters:

vtx_id – The vertex identifier.

siblings(vtx_id)#

returns an iterator of vtx_id siblings. vtx_id is not include in siblings.

Parameters:
  • vtx_id: The vertex identifier.

Returns:

iter of vertex identifier

siblings_iter(vtx_id)#

returns an iterator of vtx_id siblings. vtx_id is not include in siblings.

Parameters:
  • vtx_id: The vertex identifier.

Returns:

iter of vertex identifier

sub_mtg(vtx_id, copy=True)#

Return the submtg rooted on vtx_id.

The induced sub mtg of the mtg are all the vertices which have vtx_id has a complex plus vtx_id.

Parameters:
  • vtx_id: A vertex of the original tree.

  • copy: If True, return a new tree holding the subtree. If False, the subtree is created using the original tree by deleting all vertices not in the subtree.

Returns:

A sub mtg of the mtg. If copy=True, a new MTG is returned. Else the sub mtg is created inplace by modifying the original tree.

sub_tree(vtx_id, copy=True)#

Return the subtree rooted on vtx_id.

The induced subtree of the tree has the vertices in the ancestors of vtx_id.

Parameters:
  • vtx_id: A vertex of the original tree.

  • copy: If True, return a new tree holding the subtree. If False, the subtree is created using the original tree by deleting all vertices not in the subtree.

Returns:

A sub tree of the tree. If copy=True, a new Tree is returned. Else the subtree is created inplace by modifying the original tree.

to_aggregation_table()#

Convert a mtg g to an aggregation table. Returns a multi-line string with one line per triangle.

to_canestra()#

Return a string representing a canestra file.

to_plantgl(leaf_material=None, stem_material=None, soil_material=None, colors=None, ambient_only=False)#

Returns a plantgl scene from an mtg.

vertices(scale=-1)#

Return a list of the vertices contained in an MTG.

The set of all vertices in the MTG is returned. Vertices from all scales are returned if no scale is given. Otherwise, it returns only the vertices of the given scale. The order of the elements in this array is not significant.

Usage:

g = MTG()
len(g) == len(list(g.vertices()))
for vid in g.vertices(scale=2):
    print(g.class_name(vid))
Optional Parameters:
  • scale (int): used to select vertices at a given scale.

Returns:

Iterator on vertices at “scale” or on all vertices if scale < 0.

Returns Type:

list of vid

Background:

vertices_iter(scale=-1)#

Return an iterator of the vertices contained in an MTG.

The set of all vertices in the MTG is returned. Vertices from all scales are returned if no scale is given. Otherwise, it returns only the vertices of the given scale. The order of the elements in this array is not significant.

Usage:

g = MTG()
len(g) == len(list(g.vertices()))
for vid in g.vertices(scale=2):
    print(g.class_name(vid))
Optional Parameters:
  • scale (int): used to select vertices at a given scale.

Returns:

Iterator on vertices at “scale” or on all vertices if scale < 0.

Returns Type:

iter of vid

Background:

openalea.adel.mtg.apply_property(g, pname, function)[source]#

Apply a function to each values of a MTG property.

Returns this values as a dict (vid, new value).

openalea.adel.mtg.compute_element(n, symbols)[source]#
openalea.adel.mtg.convert(v, undef='NA')[source]#
openalea.adel.mtg.duplicate(g, n=1)[source]#
openalea.adel.mtg.get_args(s)[source]#
openalea.adel.mtg.get_expr(s, expr)[source]#
openalea.adel.mtg.get_float(s)[source]#
openalea.adel.mtg.get_index(s)[source]#
openalea.adel.mtg.get_label(s)[source]#
openalea.adel.mtg.get_name(s)[source]#
openalea.adel.mtg.internode(g, vid_axe, vid_metamer, prev_node, props, epsilon)[source]#
openalea.adel.mtg.log(*args)[source]#
openalea.adel.mtg.mtg_factory(params, sectors=1)[source]#

Construct a MTG from a dictionary.

The dictionary contains the parameters and a list of elements. Sector is an integer giving the number of LeafElements per Leaf The keys of params are:

  • plant: index of plant

  • axe

  • numphy

  • Lv

  • L_shape

  • Lsen

  • Lw_shape

  • LcType

  • LcIndex

  • Linc

  • Laz

  • Lpo

  • Lpos

  • Gl

  • Gv

  • Gsen

  • Gpo

  • Gpos

  • Gd

  • Ginc

  • El

  • Ev

  • Esen

  • Ed

  • Einc

  • Epo

  • Epos

TODO:
  • add length and final_length (DONE)

  • fix naming convention for Linc: relative inclination (DONE)

  • Add a scale to define the tissue types (ear, sheath, laminae, gain)

  • diam and final_diam (resp. width)

  • function reset length

  • function phenology(g, table) -> dynamic parameters (start_thermaltime, end_thermaltime)

  • function growthThermaltime(g, tt, dtt): tt=thermaltime du couvert

  • function growthThermaltime(g, tt, dtt, stress factor)

  • stress factor: offre/demande
    • demand = :math:`D=int_{tt}^{tt+dtt}{S(x)dx}

ho_s+int_{tt}^{tt+dtt}{V(x)dx} ho_v`

  • offre =

=> ds = ds_predit* stress_factor

  • give the area to the leaf model

  • update properties

openalea.adel.mtg.mtg_turtle(g, symbols)[source]#

Compute the geometry on each node of the MTG using Turtle geometry.

openalea.adel.mtg.mtg_turtle_time(g, symbols, time, update_visitor=None)[source]#

Compute the geometry on each node of the MTG using Turtle geometry.

Update_visitor is a function called on each node in a pre-order (parent before children). This function allow to update the parameters and state variables of the vertices.

Example:
>>> def grow(node, time):
openalea.adel.mtg.planter(g, distribution, random_seed=0, azimuths=None)[source]#

Transform a set of plants with given point distributions.

Parameters:
  • g: MTG

  • distribution: a list of 2D positions

  • random_seed: add a random rotation to each plant if the value is positive.In this case, random_seed is used as a seed.

  • azimuth : a list defining plant azimuths (in radians). The list is recycled to achieve positioning of all the plants

openalea.adel.mtg.properties(d, exclude=[])[source]#
openalea.adel.mtg.properties_from_dict(d, index, exclude=None)[source]#
openalea.adel.mtg.read_lsystem_string(string, symbol_at_scale, functional_symbol={}, mtg=None)[source]#

Read a string generated by a lsystem.

Parameters:

  • string: The lsystem string representing the axial tree.

  • symbol_at_scale: A dict containing the scale for each symbol name.

Optional parameters:

  • functional_symbol: A dict containing a function for specific symbols.

    The args of the function have to be coherent with those in the string. The return type of the functions have to be a dictionary of properties: dict(name, value)

Return:

MTG object

openalea.adel.mtg.thermal_time(g, phyllochron=110.0, leaf_duration=1.6, stem_duration=1.6, leaf_falling_rate=10)[source]#

Add dynamic properties on the mtg to simulate developpement leaf_duration is the phyllochronic time for a leaf to develop from tip appearance to collar appearance stem_duration is the phyllochronic time for a stem to develop falling_rate (degrees / phyllochron) is the rate at which leaves fall after colar appearance

openalea.adel.mtg.to_aggregation_table(g)[source]#

Convert a mtg g to an aggregation table. Returns a multi-line string with one line per triangle.

openalea.adel.mtg.to_canestra(g)[source]#

Return a string representing a canestra file.

openalea.adel.mtg.to_plantgl(g, leaf_material=None, stem_material=None, soil_material=None, colors=None, ambient_only=False)[source]#

Returns a plantgl scene from an mtg.

openalea.adel.mtg.topological_table_to_mtg(csv_file, epsilon=1e-06)[source]#
openalea.adel.mtg.transform(turtle, mesh)[source]#

openalea.adel.plantgen package#

plantgen permits to generate the pandas.DataFrame which contain the plant data to be used as input for generating plot with ADEL.

Available submodules are:

Authors: M. Abichou, B. Andrieu, C. Chambon

openalea.adel.plantgen.params module#

This module stores the default values of plantgen inner parameters.

Authors: M. Abichou, B. Andrieu, C. Chambon

openalea.adel.plantgen.params.A_COHORT_REDUCTION_FACTOR = -0.53#

The reduction factor to apply on the a_cohort of the most frequent main stem to compute the a_cohort of the regressive tillers, i.e. a_cohort_regressive_tillers = a_cohort_most_frequent_MS * (1 + A_COHORT_REDUCTION_FACTOR)

openalea.adel.plantgen.params.DELAIS_PHYLL_COL_TIP_1ST = 1.0#

Delay between tip appearance and collar appearance for the first leaf only.

The delay is given in phyllochron unit.

To parameterize the delay between tip appearance and collar appearance for the other leaves, see DELAIS_PHYLL_COL_TIP_NTH.

openalea.adel.plantgen.params.DELAIS_PHYLL_COL_TIP_NTH = 1.6#

Delay between tip appearance and collar appearance for all leaves except the first one.

The delay is given in phyllochron unit.

To parameterize the delay between tip appearance and collar appearance for the first leaf, see DELAIS_PHYLL_COL_TIP_1ST.

openalea.adel.plantgen.params.DELAIS_PHYLL_HS_COL_NTH = -0.2#

Delay between Haun Stage and collar appearance for all leaves.

The delay is given in phyllochron unit.

openalea.adel.plantgen.params.DELAIS_PHYLL_SEN_DISP = 3.0#

The time during which a fully senesced leaf on a non-elongated internode remains on the plant.

The delay is given in phyllochron unit.

openalea.adel.plantgen.params.EMERGENCE_PROBABILITY_REDUCTION_FACTOR = 0.29#

The reduction factor of the emergence probability of secondary tiller compared to primary one, i.e. probability(secondary tiller)= (1 - EMERGENCE_PROBABILITY_REDUCTION_FACTOR) * probability(primary tiller). e.g. : probability(T1.0.0) = probability(T1) * (1 - EMERGENCE_PROBABILITY_REDUCTION_FACTOR) * probability(T3) * (1 - EMERGENCE_PROBABILITY_REDUCTION_FACTOR) * probability(T5)

openalea.adel.plantgen.params.END_MS_HS_MORTALITY_VS_N_PHYTOMER = {'ae': 1.0247}#

Correlation between the end of Haun stage mortality of the main stem and N_phytomer of the main stem.

openalea.adel.plantgen.params.FIRST_CHILD_DELAY = 2#

The delay between a parent cohort and its first possible child cohort. This delay is expressed in number of cohorts.

openalea.adel.plantgen.params.FLAG_LIGULATION_DELAY = 20#

The ligulation delay of the flag. Used to compute dTT_MS_cohort.

openalea.adel.plantgen.params.K1 = 0.854#

Proportional factor of blade width relative to the first leaf of each tiller.

openalea.adel.plantgen.params.K2 = 0.91#

Proportional factor of blade width relative to the last leaf of each tiller.

openalea.adel.plantgen.params.LENGTHS_REDUCTION_FACTOR = -0.115#

The reduction factor to apply on the lengths of the most frequent main stem to compute the lengths of the regressive tillers, i.e. lengths_regressive_tillers = lengths_most_frequent_MS * (1 + LENGTHS_REDUCTION_FACTOR)

openalea.adel.plantgen.params.MS_EMERGENCE_STANDARD_DEVIATION = 0.3#

the standard deviation on the date of emergence of the main stems in the plot (in number of phyllochrons units).

This parameter is used to calculate the TT_*_phytomer1 value of the main stems.

openalea.adel.plantgen.params.MS_HS_AT_TILLER_EMERGENCE = {'T0': 1.9, 'T1': 2.5, 'T10': 26.1, 'T2': 3.2, 'T3': 4.3, 'T4': 5.5, 'T5': 6.9, 'T6': 9.16, 'T7': 11.9, 'T8': 15.4, 'T9': 20.1}#

The haunstage of the most frequent main stem at the emergence of each tiller (in phyllochron units).

This parameter is a Python dictionary. The keys represent the cohort indexes and the values represent the phyllochronic delay.

openalea.adel.plantgen.params.MS_TO_REGRESSIVE_TILLERS_SENESCENCE_DELAY = 0.0#

The delay to apply on SSI of the most frequent MS to compute SSI of regressive tillers, i.e. SSI_regressive_tillers = SSI_most_frequent_MS + MS_TO_REGRESSIVE_TILLERS_SENESCENCE_DELAY

openalea.adel.plantgen.params.N2_MS_DIV_N2_COHORT = 0.85#

Ratio between the maximum number of green leaves on the tillers and the maximum green leaves on the main stem.

Value is given for the axes with the most frequent leaves number.

openalea.adel.plantgen.params.NUMBER_OF_ELONGATED_INTERNODES = 4#

The number of elongated internodes. This number is used to compute the time (t1) corresponding to the minimum of green leaves number(n1) for the main stem and tillers.

openalea.adel.plantgen.params.SECONDARY_STEM_LEAVES_NUMBER_COEFFICIENTS = {'a_1': 0.9423, 'a_2': 0.555}#

The coefficients a_1 and a_2 to calculate the final number of leaves on tillers from the final number of leaves on main stem.

Calculation is done as follows:

tiller_final_leaves_number
    = a_1 * MS_final_leaves_number - a_2 * cohort_number
openalea.adel.plantgen.params.SLOPE_SHIFT_MS_TO_TILLERS = -0.6681#

Shift to apply on phytomer index for each cohort.

openalea.adel.plantgen.params.START_MS_HS_MORTALITY_VS_N_PHYTOMER = {'as': 0.2411, 'bs': 4.2546}#

Correlation between the start of Haun stage mortality of the main stem and N_phytomer of the main stem.

openalea.adel.plantgen.params.TILLERS_EMERGENCE_STANDARD_DEVIATION = 0.2#

the standard deviation on the date of emergence of the tillers in the plot (in phyllochron units).

This parameter is used to calculate the TT_*_phytomer1 value of the tillers.

openalea.adel.plantgen.params.TILLERS_L_BLADE_1ST = 6.5#

The length of the blades of phytomer 1 for every tiller.

openalea.adel.plantgen.params.TT_DEL_FHAUT = 3000#

The thermal time at which leaves on elongated internode disappear.

The thermal time is given in degree.day.

openalea.adel.plantgen.params.WIDTHS_REDUCTION_FACTOR = -0.0938#

The reduction factor to apply on the widths of the most frequent main stem to compute the widths of the regressive tillers, i.e. widths_regressive_tillers = widths_most_frequent_MS * (1 + WIDTHS_REDUCTION_FACTOR)

openalea.adel.plantgen.params.W_INTERNODE_POLYNOMIAL = {'coefficients': {'a0': -2.4527, 'a1': 7.6398, 'a2': -4.207}, 'first_point': {'W_internode_normalized': 0.6, 'index_relative_to_MS_phytomer_normalized': 0.6}}#

Parameters used to compute the width of the internodes for each tiller: - the coefficients of the polynomial fitted from main stems experimental internode widths, - the first point where the polynomial can be applied.

openalea.adel.plantgen.plantgen_core module#

Routines defining the main steps of the process.

Routines with a leading underscore are non-public and shouldn’t be used by the user. They defines low-level processes, and must be called in a specific order.

Some of the routines take an optional “force” input parameter. By default this parameter has the value True. When “force” is True, then the variables returned by the routine are recalculated. When “force” is False, the routine first checks if the variables have already been g calculated before. If so, the variables are not recalculated. The parameter “force” primary aims to not recalculate the random variables, so to avoid incoherent results from different calls. The parameter “force” also permits to avoid recalculation when it is useless.

Authors: M. Abichou, B. Andrieu, C. Chambon

class openalea.adel.plantgen.plantgen_core.DataCompleteness[source]#

Bases: object

This enumerate defines the different degrees of completeness that the data documented by the user can have.

FULL = 'FULL'#
MIN = 'MIN'#
SHORT = 'SHORT'#
class openalea.adel.plantgen.plantgen_core.PhenologyFunctions[source]#

Bases: object

Define phenology functions. These functions are used later on to calculate the phenology of the axes. The following variables are calculated:

  • cardinality: the cardinality of the couple (id_axis, N_phytomer_potential) in axeT

  • a_cohort: the rate of Haun Stage vs Thermal time. This is the rate of the first phase in case of bilinear behavior.

  • TT_hs_0: the thermal time for Haun Stage equal to 0

  • TT_hs_break: the thermal time when the rate of phytomers emergence is changing. NA: no change.

  • TT_flag_ligulation: the thermal time when Haun Stage is equal to N_phytomer_potential

  • dTT_MS_cohort: the delays between the emergence of the main stem and the emergence of the cohort.

  • n0: number of green leaves at t0

  • n1: number of green leaves at t1

  • n2: number of green leaves at TT_flag_ligulation

  • t0: the thermal time at the start of leaf senescence

  • t1: the thermal time at which the senescence starts

  • hs_t1: the Haun Stage at t1

  • a: the coefficient of the 3rd order term of the polynomial describing the dynamics

    of the number of green leaves after flowering

  • c: the coefficient of the 1st order term of the polynomial describing the dynamics

    of the number of green leaves after flowering

  • RMSE_gl: the RMSE for the dynamic of the number of green leaves after estimation of

    parameter a.

and are stored in memory for the next steps of the process. The routine returns dynT and the decimal number of elongated internodes.

openalea.adel.plantgen.plantgen_core.axes_phenology(plants_number, decide_child_cohort_probabilities, MS_leaves_number_probabilities, dynT_user, dimT_user, GL_number, dynT_user_completeness, dimT_user_completeness, TT_hs_break, delais_TT_stop_del_axis, number_of_ears, axeT_user=None, TT_t1_user=None)[source]#

Calculate the phenology of the axes. The following variables are calculated:

  • TT_em_phytomer: Thermal time of the appearance of the tip of leaf out of

    the whorl made by the older blade.

  • TT_col_phytomer: Thermal time of the appearance of collar.

  • TT_sen_phytomer: Thermal time for which SSI = n (where n is the phytomer

    rank).

  • TT_del_phytomer: Thermal time after which the leaf blade is destroyed

    and is not displayed in the 3D mock-up anymore.

  • dTT_em_phytomer: Thermal time of the appearance of the tip of leaf out of

    the whorl made by the older blade; expressed as thermal time since TT_em_phytomer1

  • dTT_col_phytomer: Thermal time of the appearance of collar; expressed as

    thermal time since TT_col_phytomer1

  • dTT_sen_phytomer: Thermal time for which SSI = n (where n is the phytomer

    rank); expressed as thermal time since TT_sen_phytomer1

  • dTT_del_phytomer: Thermal time after which the leaf blade is destroyed

    and is not displayed in the 3D mock-up anymore; expressed as thermal time since TT_del_phytomer1

and are stored in memory for the next steps of the process. The routine returns:

openalea.adel.plantgen.plantgen_core.init_axes(plants_number, decide_child_cohort_probabilities, MS_leaves_number_probabilities, theoretical_cohort_cardinalities, theoretical_axis_cardinalities, axeT_user=None)[source]#

Initialize the axes randomly. The following variables are calculated:

  • id_plt: Number (int) identifying the plant to which the axe belongs

  • id_cohort: Number (int) identifying the cohort to which the axe belongs

  • id_axis: Identifier of the botanical position of the axis on the plant.

    MS refers to the main stem, T0, T1, T2,…, refers to the primary tillers, T0.0, T0.1, T0.2,…, refers to the secondary tillers of the primary tiller T0, and T0.0.0, T0.0.1, T0.0.2,…, refers to the tertiary tillers of the secondary tiller T0.0.

  • N_phytomer_potential: The potential total number of vegetative phytomers formed on

    the axis. N_phytomer_potential does NOT take account of the regression of some axes.

  • id_phen: a key (int) linking to phenT. id_phen allows referring to the data

    that describe the phenology of the axis

and are stored in memory for the next steps of the process. The routine returns cardinalityT for debugging purpose.

openalea.adel.plantgen.plantgen_core.organs_dimensions(plants_number, decide_child_cohort_probabilities, MS_leaves_number_probabilities, dynT_user, dimT_user, GL_number, dynT_user_completeness, dimT_user_completeness, TT_hs_break, delais_TT_stop_del_axis, number_of_ears, axeT_user=None, TT_t1_user=None)[source]#

Calculate the dimensions of the organs. The following variables are calculated:

  • id_dim: key (int) of the axis

  • index_phytomer: The absolute phytomer position, i.e. phytomer rank

  • L_blade: length of the mature blade (cm)

  • W_blade: Maximum width of the mature leaf blade (cm)

  • L_sheath: Length of a mature sheath (cm)

  • W_sheath: Diameter of the stem or pseudo stem at the level of sheath (cm)

  • L_internode: Length of an internode (cm)

  • W_internode: Diameter of an internode (cm)

and are stored in memory for the next steps of the process. The routine returns dimT as final result.

openalea.adel.plantgen.plantgen_core.plants_structure(plants_number, decide_child_cohort_probabilities, MS_leaves_number_probabilities, dynT_user, dimT_user, GL_number, dynT_user_completeness, dimT_user_completeness, TT_hs_break, delais_TT_stop_del_axis, number_of_ears, plants_density, ears_density, axeT_user=None, TT_regression_start_user=None, TT_t1_user=None)[source]#

Construct the structure of the plants. The following variables are calculated:

  • N_phytomer: The effective total number of vegetative phytomers formed

    on the axis. N_phytomer does take account of the regression of some axes.

  • HS_final: The Haun Stage at the end of growth of the axis.

  • TT_stop_axis: If the axis dyes: thermal time (since crop emergence) of

    end of growth. If the axis grows up to flowering: NA

  • TT_del_axis: If the axis dyes: thermal time (since crop emergence) of

    disappearance. If the axis grows up to flowering: NA

  • id_dim: key (int) linking to dimT. id_dim allows referring to the data

    that describe the dimensions of the phytomers of the axis

  • id_ear: Key (int) linking to earT. id_ear allows referring to the data

    that describe the ear of the axis. For the regressive axes, id_ear=NA. For the non-regressive axes, id_ear=1.

  • TT_em_phytomer1: Thermal time (relative to canopy appearance) of tip

    appearance of the first true leaf (not coleoptile or prophyll)

  • TT_col_phytomer1: Thermal time (relative to canopy appearance) of collar

    appearance of the first true leaf

  • TT_sen_phytomer1: Thermal time (relative to canopy appearance) of full

    senescence of the first true leaf (this is : thermal time when SSI= 1)

  • TT_del_phytomer1: Thermal time (relative to canopy appearance) of

    disappearance of the first true leaf

and are stored in memory for the next steps of the process. The routine returns

openalea.adel.plantgen.plantgen_interface module#

Front end for the generation of the input data expected by ADEL. User should look at this module first. One can then look at the other modules of openalea.adel.plantgen for additional information.

Authors: M. Abichou, B. Andrieu, C. Chambon

openalea.adel.plantgen.plantgen_interface.gen_adel_input_data(dynT_user, dimT_user, plants_number=100, plants_density=250, decide_child_axis_probabilities={'T0': 0.0, 'T1': 0.9, 'T2': 0.983, 'T3': 0.817, 'T4': 0.117}, MS_leaves_number_probabilities={'10': 0.145, '11': 0.818, '12': 0.037, '13': 0.0, '14': 0.0}, ears_density=500, GL_number={1117.0: 5.6, 1212.1: 5.4, 1368.7: 4.9, 1686.8: 2.4, 1880.0: 0.0}, delais_TT_stop_del_axis=600, TT_hs_break=None, inner_params={}, axeT_user=None, TT_regression_start_user=None, TT_t1_user=None)[source]#

Create the dataframes which contain the plant data to be used as input for generating plot with ADEL, and some other dataframes for debugging purpose. Also create a dictionary which stores the values of the arguments of gen_adel_input_data. This dictionary is aimed to log the configuration used for the construction.

See Description of Adel’s inputs for a description of the input tables expected by ADEL, and Construction of the input tables for a description of the dataframes created for debug.

Different degrees of completeness of data provided by the user are acceptable. See The levels of completeness for more details.

The dataframes are created as follows:
These tables are returned to be used as ADEL input:
These tables are returned for debugging purpose:
Parameters:
  • dynT_user (pandas.DataFrame) - the leaf dynamic parameters set by the user.

  • dimT_user (pandas.DataFrame) - the dimensions of the organs set by the user.

  • plants_number (int) - the number of plants to be generated.

  • plants_density (int) - the number of plants that are present after loss due to bad emergence, early death…, per square meter.

  • decide_child_axis_probabilities (dict of str:float) - for each child cohort the probability of emergence of an axis when the parent axis is present. The keys are the identifiers of the child axes (‘T0’, ‘T1’, ‘T2’, …) and the values are the probabilities.

  • MS_leaves_number_probabilities (dict of str:float) - the probability distribution of the final number of main stem leaves. The keys are the final numbers of main stem leaves, and the values are the probabilities distribution.

  • ears_density (int) - the number of ears per square meter, or None if no regression occured

  • GL_number (dict of float:float) - the GL decimal numbers measured at several thermal times (including the senescence end). The keys are the thermal times, and the values are the GL decimal numbers.

  • delais_TT_stop_del_axis (int) - This variable represents the time in thermal time between an axis stop growing and its disappearance (it concerns only the axes that do not regress and which do not produce any cob).

  • TT_hs_break (float) - the thermal time when the rate of Haun Stage is changing. TT_hs_break equal None (the default) means that the phyllochron is constant.

  • inner_params (dict) - the values of the inner parameters used for the construction of the input tables. These parameters are the same as the ones defined in the module params. inner_params is NOT mandatory: if not all inner parameters are documented in inner_params, then we use the default values defined in params for the inner parameters which are missing.

  • axeT_user (pandas.DataFrame): a table similar to the axeT_tmp that allows forcing which axis should be reconstructed.

  • TT_regression_start_user (:class: float) : thermal time at wich regression start on most frequent MS. If set to none, TT_regression_start is computed by pgen from start of MS elongation date of most frequent MS

  • TT_t1_user (:class: float) : thermal time at which n1 Green leaves are observed on most frequent MS. If set to none, TT_t1_user is computed by pgen from start of MS elongation date of most frequent MS

Returns:

Return axeT, dimT, phenT, phenT_abs, dynT, phenT_first, HS_GL_SSI_T, tilleringT, cardinalityT, and a dictionary which stores the configuration used for the construction.

Returns Type:

tuple

openalea.adel.plantgen.plantgen_interface.plantgen2adel(axeT_, dimT_, phenT_)[source]#

Format the dataframes generated by gen_adel_input_data to dataframes compatible with adel. This function is a temporary patch, waiting for Adel to be updated.

Parameters:
  • axeT_ (pandas.DataFrame) - the axeT dataframe.

  • dimT_ (pandas.DataFrame) - the dimT dataframe.

  • phenT_ (pandas.DataFrame) - the phenT dataframe.

Returns:

Return axeT, dimT and phenT in adel-like format.

Returns Type:

tuple

openalea.adel.plantgen.plantgen_interface.read_plantgen_inputs(inputs_filepath, dynT_user_filepath, dimT_user_filepath)[source]#

Import the Python module at inputs_filepath, and return the args expected by gen_adel_input_data().

Parameters:
  • inputs_filepath (str) - the file path of the Python module which contains the inputs of gen_adel_input_data().

  • dynT_user_filepath (str) - the file path of the leaf dynamic parameters set by the user.

  • dimT_user_filepath (str) - the file path of the dimensions of the organs set by the user.

Returns:

Return the inputs of gen_adel_input_data().

Returns Type:

tuple

openalea.adel.plantgen.tools module#

Generic tools used in the openalea.adel.plantgen package. These routines can also be used by other packages.

Authors: M. Abichou, B. Andrieu, C. Chambon

exception openalea.adel.plantgen.tools.InputError[source]#

Bases: Exception

Exception raised when an invalid input is detected.

add_note(object, /)#

Exception.add_note(note) – add a note to the exception

args#
with_traceback(object, /)#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception openalea.adel.plantgen.tools.InputWarning[source]#

Bases: UserWarning

Warning issued when an input is dubious and may lead to an error.

add_note(object, /)#

Exception.add_note(note) – add a note to the exception

args#
with_traceback(object, /)#

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

openalea.adel.plantgen.tools.calculate_MS_final_leaves_number(MS_leaves_number_probabilities)[source]#

Calculate the final number of leaves of a main stem. This is done by randomly drawing a number in a probability distribution. Uses the probabilities of the main stem leaves number.

Parameters:
  • MS_leaves_number_probabilities (dict) - the probabilities of the main stem leaves number.

Returns:

The final number of leaves of the main stem.

Returns Type:

float

openalea.adel.plantgen.tools.calculate_decide_child_cohort_probabilities(decide_child_axis_probabilities)[source]#

For each primary tiller in decide_child_axis_probabilities, calculate the corresponding cohort number, and return a dictionary which keys are cohort number and values remain the same.

Parameters:
  • decide_child_axis_probabilities (dict) - the probability for each primary tiller to have a child. Keys are the botanical positions (e.g. “T1”, “T2”,…), values are the probabilities (float).

Returns:

the probability for each cohort to have a child. Keys are the indexes of the cohorts (e.g. 3, 4,…), values are the probabilities (float).

Returns Type:

dict

Examples:
>>> decide_child_axis_probabilities = {'T0': 0.0, 'T1': 0.900, 'T2': 0.983, 'T3': 0.817, 'T4': 0.117}
>>> calculate_decide_child_cohort_probabilities(decide_child_axis_probabilities)
{3: 0.0, 4: 0.900, 5: 0.983, 6: 0.817, 7: 0.117}
openalea.adel.plantgen.tools.calculate_theoretical_cardinalities(plants_number, decide_child_cohort_probabilities, decide_child_axis_probabilities, first_child_delay, emergence_probability_reduction_factor)[source]#

Calculate the theoretical cardinality of each simulated cohort and each simulated axis.

Parameters:
  • plants_number (int) - the number of plants.

  • decide_child_cohort_probabilities (dict) - the probabilities of the child cohorts.

  • decide_child_axis_probabilities (dict) - the probabilities of the child axes.

  • first_child_delay (int) - The delay between a parent axis and its first possible child axis. This delay is expressed in number of cohorts.

  • emergence_probability_reduction_factor (float) - The reduction factor of the emergence probability of secondary tiller compared to primary one.

Returns:

a 2-tuple of dictionaries: the first dictionary contains the theoretical cardinality of each cohort, the second dictionary contains the theoretical cardinality of each axis.

Returns Type:

tuple

openalea.adel.plantgen.tools.calculate_tiller_final_leaves_number(MS_final_leaves_number, cohort_number, secondary_stem_leaves_number_coefficients)[source]#

Calculate the final number of leaves of a tiller. Uses the final number of leaves of the main stem, the index of the cohort to which belongs the tiller, and specific coefficients.

Parameters:
  • MS_final_leaves_number (float) - the final number of leaves of the main stem.

  • cohort_number (int) - the index of cohort.

  • secondary_stem_leaves_number_coefficients (dict) - The coefficients a_1 and a_2 to calculate the final number of leaves on tillers from the final number of leaves on main stem. Calculation is done as follow:

    tiller_final_leaves_number
        = a_1 * MS_final_leaves_number - a_2 * cohort_number
    
Returns:

The final number of leaves of a tiller.

Returns Type:

float

openalea.adel.plantgen.tools.decide_child_cohorts(decide_child_cohort_probabilities, first_child_delay, emergence_probability_reduction_factor, parent_cohort_index=None, parent_cohort_position=None)[source]#

Decide (recursively) of the child cohorts actually produced by a parent cohort, according to the decide_child_cohort_probabilities and the parent_cohort_index. The main stem always exists.

Parameters:
  • decide_child_cohort_probabilities (dict) - the probabilities of the child cohorts.

  • first_child_delay (int) - the delay between the parent cohort and the first child cohort. This delay is expressed in number of cohorts.

  • emergence_probability_reduction_factor (float) - The reduction factor of the emergence probability of secondary tiller compared to primary one.

  • parent_cohort_index (int) - the index of the parent cohort. None (the default) means that there isn’t any parent cohort.

  • parent_cohort_position (str) - the position of the parent cohort. None (the default) means that there isn’t any parent cohort.

Returns:

The indices of the child cohorts and their positions in the tree.

Returns Type:

list of tuples

openalea.adel.plantgen.tools.decide_time_of_death(max_axes_number, number_of_ears, TT_regression_start, TT_regression_end, TT_em_phytomer1_df)[source]#

Decide the thermal times (relative to canopy emergence) when the axes stop growing. Uses an exponential function which describes the decay of the global population.

Parameters:
  • max_axes_number (int) - the maximum number of existing axes.

  • number_of_ears (int) - the number of ears.

  • TT_regression_start (float) - thermal time at which the regression starts, i.e. when the Haun Stage

    of the most frequent main stem is equal to (N_phytomer_potential - 5).

  • TT_regression_end (float) - the thermal time at which the regression ends, i.e. when the haun stage

    of the most frequent main stem is equal to flag leaf number.

  • TT_em_phytomer1_df (pandas.DataFrame) - A dataframe which contains, for each plant and each tiller, the thermal time

    (relative to canopy appearance) of tip appearance of the first true leaf (not coleoptile nor prophyll).

Returns:

the thermal times (relative to canopy emergence) when the axes stop growing.

Returns Type:

list

Warning

  • number_of_ears, max_axes_number, TT_regression_start and TT_regression_end must be positive or null.

  • TT_regression_start must be smaller (or equal) than TT_regression_end.

  • number_of_ears must be smaller (or equal) than max_axes_number.

openalea.adel.plantgen.tools.find_lines_intersection(line1, line2)[source]#

Find the intersection of two lines. Raise an exception if no intersection.

Parameters:
  • line1 (tuple of 2 tuple of float) - the coordinates of the two points which define the first line.

  • line2 (tuple of 2 tuple of float) - the coordinates of the two points which define the second line.

Returns:

the coordinates of the intersection point.

Returns Type:

tuple of float

Examples:
>>> find_lines_intersection(((0.5, 0.5), (1.5, 0.5)), ((0.5, 0.5), (1.5, 0.5)))
(1.0, 0.5)
openalea.adel.plantgen.tools.fit_poly(x_meas_array, y_meas_array, fixed_coefs, a_starting_estimate)[source]#

Calculate the best-fit parameter a, where a is the coefficient of highest degree of a polynomial. The other polynomial coefficients are supposed to be known and are given in fixed_coefs. We first define a function to compute the residuals. Then we use the least-squares fit routine of scipy to find the best-fit parameter a, selecting a_starting_estimate as starting position and using (x_meas_array, y_meas_array) as the measured data to fit. Finally, we calculate the RMSE to check the validity of the fit.

See also

scipy.optimize.leastsq()

Parameters:
  • x_meas_array (np.ndarray) - the x-coordinates. These data are measured.

  • y_meas_array (np.ndarray) - the y-coordinates. These data are measured.

  • fixed_coefs (list) - the other coefficients of the polynomial to fit (x_meas_array, y_meas_array) to. These coefficients are not fitted. They are given from highest degree to lowest degree (“descending powers”).

  • a_starting_estimate (float) - the starting estimate for the minimization.

Returns:

the best-fit coefficient a and the RMSE of the fit.

Returns Type:

tuple of float

openalea.adel.plantgen.tools.get_primary_axis(id_axis, first_child_delay)[source]#

Calculate the primary axis of id_axis.

Parameters:
  • id_axis (str) - the botanical position of the axis.

  • first_child_delay (int) - the delay between the axis and its first child.

Returns:

the primary axis of id_axis.

Returns Type:

str

Examples:
>>> get_primary_axis('T1.0', 2)
'T3'
>>> get_primary_axis('T1.0.0', 2)
'T5'
>>> get_primary_axis('T5', 2)
'T5'
>>> get_primary_axis('MS', 2)
'MS'
openalea.adel.plantgen.tools.get_real_roots(poly)[source]#

Get the real roots of polynomial poly.

Parameters:
  • poly (numpy.lib.polynomial.poly1d) - a one-dimensional polynomial.

Returns:

the real roots of poly

Returns Type:

numpy.array

Examples:
>>> p = numpy.poly1d([1, 2, 1])
array([-1., -1.])
>>> p = numpy.poly1d([1, 2, 3])
array([], dtype=float64)

openalea.adel.newmtg module#

A place to develop candidates methods for mtg.py / topological builder

openalea.adel.newmtg.adel_ids(g, scale=5)[source]#

return a dict adel_id:vid

openalea.adel.newmtg.adel_label(g, vid)[source]#
openalea.adel.newmtg.adel_labels(g, scale=5)[source]#

return a dict vid:adel_id

openalea.adel.newmtg.adel_metamer(Ll=None, Lv=None, Lr=None, Lsen=None, L_shape=None, Lw_shape=None, shape_key=None, Linc=None, Laz=None, Lsect=1, Gl=None, Gv=None, Gsen=None, Gd=None, Ginc=None, El=None, Ev=None, Esen=None, Ed=None, Einc=None, elongation=None, ntop=None, leaves=None, **kwargs)[source]#

Contructs metamer elements for adel from parameters describing a static state. Parameters are : * Ll : length of the blade * Lv : visible (emerged) length of blade (green + senesced, rolled + unrolled) * Lr : rolled part of the blade * Lsen : length of the senescent part of the blade (hidden + visible) * L_shape : Mature length of the blade used to compute blade shape * Lw_shape : Maximal width of the blade used to compute blade shape * xysr_shape : a (x,y,s,r) tuple describing blade geometry * Linc : relative inclination of the base of leaf blade at the top of leaf sheath (deg) * Laz : relative azimuth of the leaf * Lsect : the number of sectors per leaf blade * Gl : length of the sheath (hidden + visible) * Gv : emerged length of the sheath * Gsen : senescent length of the sheath (hidden + visible) * Gd : apparent diameter of the sheaths * Ginc : relative inclination of the sheath * El: length of the internode (hidden + visible) * Ev: emerged length of the internode * Esen: senescent length of the internode (hidden + visible) * Ed: diameter of the internode * Einc : relative inclination of the internode

openalea.adel.newmtg.blade_elements(sectors, l, lvis, lrolled, lsen, Lshape, Lwshape, shape_key, leaves, split=False)[source]#

return parameters of blade elements (visible parts of the blade). sectors is the number of sectors dividing pattern blade shape l is the length of the blade lvis is the visible length (senesced + green, rolled + flat) lrolled is the visible rolled length of the blade lsen is the senescent apical length Lshape is length of the blade used as a pattern shape

openalea.adel.newmtg.duplicate(g, replicates=1, grem=None)[source]#

construct a mtg replicating g n times and adding grem

openalea.adel.newmtg.exposed_areas(g)[source]#

returns a Dataframe with all exposed (visible) areas of elements in g

openalea.adel.newmtg.exposed_areas2canS(exposed_areas)[source]#

adaptor to convert new adel output to old adel output (canS-like) dataframe

openalea.adel.newmtg.get_component(components, index)[source]#
openalea.adel.newmtg.internode_elements(l, lvis, lsen, az, inc, d, split=False)[source]#

returns parameters of internode elements (visible parts of the internode). l is the length of the internode lv is the visible length (senesced + green) lsen is the senescent apical length az is the azimuth angle inc is the inclination angle Fisrt element is for the green visible part of the internode Second element is for senesced visible part of the internode

openalea.adel.newmtg.move_properties(g_source, g_dest, filter_length=True, cleanup_source=True)[source]#

Move properties present in g_source and not in g_dest into g_dest. if filter_length is True (default), properties attached to node whose length is zero are not transfered

openalea.adel.newmtg.mtg_factory(parameters, metamer_factory=<function adel_metamer>, leaf_sectors=1, leaves=None, stand=None, axis_dynamics=None, add_elongation=False, topology=['plant', 'axe_id', 'numphy'], split=False, aborting_tiller_reduction=1.0, leaf_db=None)[source]#

Construct an MTG from a dictionary of parameters.

The dictionary contains the parameters of all metamers in the stand (topology + properties). metamer_factory is a function that build metamer properties and metamer elements from parameters dict. leaf_sectors is an integer giving the number of LeafElements per Leaf blade leaves is a {species:adel.geometric_elements.Leaves} dict stand is a list of tuple (xy_position_tuple, azimuth) of plant positions axis_dynamics is a 3 levels dict describing axis dynamic. 1st key level is plant number, 2nd key level is axis number, and third ky level are labels of values (n, tip, ssi, disp) topology is the list of key names used in parameters dict for plant number, axe number and metamer number aborting_tiller_reduction is a scaling factor applied to reduce all dimensions of organs of tillers that will abort

Axe number 0 is compulsory

openalea.adel.newmtg.mtg_update(newg, g, refg)[source]#

update newg with specific properties found in g only and update by increment compared to refg area-like properties

openalea.adel.newmtg.mtg_update_at_time(g, time)[source]#

Compute plant state at a given time according to dynamical parameters found in mtg

openalea.adel.newmtg.mtg_update_from_table(g, cantable, old_cantable)[source]#

Compute plant state at a given time according to dynamical parameters found in mtg

openalea.adel.newmtg.replicate(g, target=1)[source]#

replicate the plants in g up to obtain target new plants

openalea.adel.newmtg.sheath_elements(l, lvis, lsen, az, inc, d, split=False)[source]#

returns parameters of sheath elements (visible parts of the sheath). l is the length of the sheath lv is the visible length (senesced + green) lsen is the senescent apical length Fisrt elements is for green visible part of the sheath Second elements is for senesced visible part of the sheath

openalea.adel.newmtg.update_axe(axe)[source]#

update phenology on axes

openalea.adel.newmtg.update_elements(organ, leaves=None)[source]#
openalea.adel.newmtg.update_organ(organ, h_whorl=0)[source]#
openalea.adel.newmtg.update_organ_from_table(organ, metamer, oldmetamer)[source]#
openalea.adel.newmtg.update_plant(plant, time)[source]#

update phenology of plant axes

openalea.adel.mtg_interpreter module#

Methods for mtg interpretation with turtle

class openalea.adel.mtg_interpreter.AdelTurtle[source]#

Bases: PglTurtle

F((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} F(PGL::Turtle {lvalue})

F( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} F(PGL::Turtle {lvalue},double)

F( (Turtle)arg1, (object)arg2, (object)arg3) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} F(PGL::Turtle {lvalue},double,double)

add_parameter(name, value, copy=<function deepcopy>)#

Add a parameter to the Turtle that will be push and pop. For this a copy function is asked

appendColor((PglTurtle)arg1, (object)arg2, (object)arg3, (object)arg4) None :#
C++ signature :

void appendColor(PGL::PglTurtle {lvalue},unsigned int,unsigned int,unsigned int)

appendColor( (PglTurtle)arg1, (object)arg2, (object)arg3, (object)arg4) -> None :

C++ signature :

void appendColor(PGL::PglTurtle {lvalue},float,float,float)

appendColor( (PglTurtle)arg1, (Color3)arg2) -> None :

C++ signature :

void appendColor(PGL::PglTurtle {lvalue},PGL::Color3)

appendMaterial((PglTurtle)arg1, (Appearance)arg2) None :#
C++ signature :

void appendMaterial(PGL::PglTurtle {lvalue},PGL::RefCountPtr<PGL::Appearance>)

appendMaterial( (PglTurtle)arg1, (ImageTexture)arg2) -> None :

C++ signature :

void appendMaterial(PGL::PglTurtle {lvalue},PGL::RefCountPtr<PGL::ImageTexture>)

arrow((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} arrow(PGL::Turtle {lvalue})

arrow( (Turtle)arg1, (object)heigth [, (object)cap_heigth_ratio=0.2 [, (object)cap_radius_ratio=2]]) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} arrow(PGL::Turtle {lvalue},double [,double=0.2 [,double=2]])

box((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} box(PGL::Turtle {lvalue})

box( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} box(PGL::Turtle {lvalue},double)

box( (Turtle)arg1, (object)arg2, (object)arg3) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} box(PGL::Turtle {lvalue},double,double)

circle((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} circle(PGL::Turtle {lvalue})

circle( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} circle(PGL::Turtle {lvalue},double)

clearColorList((PglTurtle)arg1) None :#
C++ signature :

void clearColorList(PGL::PglTurtle {lvalue})

clearGuide((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} clearGuide(PGL::Turtle {lvalue})

clearSurfaceList((PglTurtle)arg1) None :#
C++ signature :

void clearSurfaceList(PGL::PglTurtle {lvalue})

clear_parameters()#

Clear the python parameters of the Turtle.

customGeometry()#
pglShape( (PglTurtle)arg1, (Geometry)geometry [, (object)scale=1]) -> PglTurtle :

Insert a custom plantgl primitive at the turtle position and orientation

C++ signature :

PGL::PglTurtle {lvalue} pglShape(PGL::PglTurtle {lvalue},PGL::RefCountPtr<PGL::Geometry> [,double=1])

pglShape( (PglTurtle)arg1, (Shape)geometry [, (object)scale=1]) -> PglTurtle :

Insert a custom plantgl primitive at the turtle position and orientation

C++ signature :

PGL::PglTurtle {lvalue} pglShape(PGL::PglTurtle {lvalue},PGL::RefCountPtr<PGL::Shape> [,double=1])

pglShape( (PglTurtle)arg1, (Scene)geometry [, (object)scale=1]) -> PglTurtle :

Insert a custom plantgl primitive at the turtle position and orientation

C++ signature :

PGL::PglTurtle {lvalue} pglShape(PGL::PglTurtle {lvalue},PGL::RefCountPtr<PGL::Scene> [,double=1])

decColor((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} decColor(PGL::Turtle {lvalue})

decId((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} decId(PGL::Turtle {lvalue},unsigned int)

decWidth((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} decWidth(PGL::Turtle {lvalue})

defaultValue((Turtle)arg1) None :#
C++ signature :

void defaultValue(PGL::Turtle {lvalue})

divScale((Turtle)arg1, (Vector3)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} divScale(PGL::Turtle {lvalue},PGL::Vector3)

divScale( (Turtle)arg1, (object)arg2, (object)arg3, (object)arg4) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} divScale(PGL::Turtle {lvalue},double,double,double)

divScale( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} divScale(PGL::Turtle {lvalue},double)

down((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} down(PGL::Turtle {lvalue})

down( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} down(PGL::Turtle {lvalue},double)

dump((Turtle)arg1) None :#
C++ signature :

void dump(PGL::Turtle {lvalue})

property elasticity#
emptyStack((Turtle)arg1) bool :#
C++ signature :

bool emptyStack(PGL::Turtle {lvalue})

eulerAngles((Turtle)arg1[, (object)azimuth=180[, (object)elevation=90[, (object)roll=0]]]) Turtle :#

Set the orientation of the turtle from the absolute euler angles.

C++ signature :

PGL::Turtle {lvalue} eulerAngles(PGL::Turtle {lvalue} [,double=180 [,double=90 [,double=0]]])

f((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} f(PGL::Turtle {lvalue})

f( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} f(PGL::Turtle {lvalue},double)

frame((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} frame(PGL::Turtle {lvalue})

frame( (Turtle)arg1, (object)heigth [, (object)cap_heigth_ratio=0.2 [, (object)cap_radius_ratio=2 [, (object)colorV=1.0 [, (object)transparency=0.0]]]]) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} frame(PGL::Turtle {lvalue},double [,double=0.2 [,double=2 [,double=1.0 [,double=0.0]]]])

getColor((Turtle)arg1) int :#
C++ signature :

int getColor(PGL::Turtle {lvalue})

getColorList((PglTurtle)arg1) object :#
C++ signature :

boost::python::api::object getColorList(PGL::PglTurtle*)

getColorListSize((Turtle)arg1) int :#
C++ signature :

unsigned long getColorListSize(PGL::Turtle {lvalue})

getCurrentMaterial((Turtle)arg1) Appearance :#
C++ signature :

PGL::RefCountPtr<PGL::Appearance> getCurrentMaterial(PGL::Turtle {lvalue})

getDrawer((PglTurtle)arg1) TurtleDrawer :#
C++ signature :

PGL::RefCountPtr<PGL::TurtleDrawer> getDrawer(PGL::PglTurtle {lvalue})

getFrame()[source]#
getHeading((Turtle)arg1) Vector3 :#
C++ signature :

PGL::Vector3 getHeading(PGL::Turtle {lvalue})

getLeft((Turtle)arg1) Vector3 :#
C++ signature :

PGL::Vector3 getLeft(PGL::Turtle {lvalue})

getMaterial((PglTurtle)arg1, (object)arg2) Appearance :#
C++ signature :

PGL::RefCountPtr<PGL::Appearance> getMaterial(PGL::PglTurtle {lvalue},unsigned long)

getOrientationMatrix((Turtle)arg1) Matrix3 :#
C++ signature :

PGL::Matrix3 getOrientationMatrix(PGL::Turtle {lvalue})

getParameters((Turtle)arg1) TurtleParam :#
C++ signature :

PGL::TurtleParam getParameters(PGL::Turtle {lvalue})

getPosition((Turtle)arg1) Vector3 :#
C++ signature :

PGL::Vector3 getPosition(PGL::Turtle {lvalue})

getScale((Turtle)arg1) Vector3 :#
C++ signature :

PGL::Vector3 getScale(PGL::Turtle {lvalue})

getScene((Turtle)arg1) Scene :#
C++ signature :

PGL::RefCountPtr<PGL::Scene> getScene(PGL::Turtle {lvalue})

getSurfaceList((PglTurtle)arg1) object :#
C++ signature :

boost::python::api::object getSurfaceList(PGL::PglTurtle*)

getTransformationMatrix((Turtle)arg1) Matrix4 :#
C++ signature :

PGL::Matrix4 getTransformationMatrix(PGL::Turtle {lvalue})

getUp((Turtle)arg1) Vector3 :#
C++ signature :

PGL::Vector3 getUp(PGL::Turtle {lvalue})

getWidth((Turtle)arg1) float :#
C++ signature :

double getWidth(PGL::Turtle {lvalue})

iRollL((Turtle)arg1[, (object)arg2]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} iRollL(PGL::Turtle {lvalue} [,double])

iRollR((Turtle)arg1[, (object)arg2]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} iRollR(PGL::Turtle {lvalue} [,double])

incColor((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} incColor(PGL::Turtle {lvalue})

incId((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} incId(PGL::Turtle {lvalue},unsigned int)

incWidth((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} incWidth(PGL::Turtle {lvalue})

insertMaterial((PglTurtle)arg1, (object)arg2, (Appearance)arg3) None :#
C++ signature :

void insertMaterial(PGL::PglTurtle {lvalue},unsigned long,PGL::RefCountPtr<PGL::Appearance>)

insertMaterial( (PglTurtle)arg1, (object)arg2, (ImageTexture)arg3) -> None :

C++ signature :

void insertMaterial(PGL::PglTurtle {lvalue},unsigned long,PGL::RefCountPtr<PGL::ImageTexture>)

interpolateColors((Turtle)arg1, (object)arg2, (object)arg3, (object)arg4) Turtle :#
C++ signature :

PGL::Turtle {lvalue} interpolateColors(PGL::Turtle {lvalue},int,int,double)

isGCEnabled((Turtle)arg1) bool :#
C++ signature :

bool isGCEnabled(PGL::Turtle {lvalue})

isPolygonEnabled((Turtle)arg1) bool :#
C++ signature :

bool isPolygonEnabled(PGL::Turtle {lvalue})

isValid((Turtle)arg1) bool :#
C++ signature :

bool isValid(PGL::Turtle {lvalue})

label((Turtle)arg1, (str)text[, (object)size=-1.0]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} label(PGL::Turtle {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > [,int=-1.0])

left((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} left(PGL::Turtle {lvalue})

left( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} left(PGL::Turtle {lvalue},double)

lineRel((Turtle)arg1[, (Vector3)position=Vector3(0, 0, 0)[, (object)topradius=-1.0]]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} lineRel(PGL::Turtle {lvalue} [,PGL::Vector3=Vector3(0,0,0) [,double=-1.0]])

lineRel( (Turtle)arg1 [, (object)x=0.0 [, (object)y=0.0 [, (object)z=0.0 [, (object)topradius=-1.0]]]]) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} lineRel(PGL::Turtle {lvalue} [,double=0.0 [,double=0.0 [,double=0.0 [,double=-1.0]]]])

lineTo((Turtle)arg1[, (Vector3)position=Vector3(0, 0, 0)[, (object)topradius=-1.0]]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} lineTo(PGL::Turtle {lvalue} [,PGL::Vector3=Vector3(0,0,0) [,double=-1.0]])

lineTo( (Turtle)arg1 [, (object)x=0.0 [, (object)y=0.0 [, (object)z=0.0 [, (object)topradius=-1.0]]]]) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} lineTo(PGL::Turtle {lvalue} [,double=0.0 [,double=0.0 [,double=0.0 [,double=-1.0]]]])

move((Turtle)arg1, (Vector3)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} move(PGL::Turtle {lvalue},PGL::Vector3)

move( (Turtle)arg1, (object)arg2, (object)arg3, (object)arg4) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} move(PGL::Turtle {lvalue},double,double,double)

multScale((Turtle)arg1, (Vector3)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} multScale(PGL::Turtle {lvalue},PGL::Vector3)

multScale( (Turtle)arg1, (object)arg2, (object)arg3, (object)arg4) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} multScale(PGL::Turtle {lvalue},double,double,double)

multScale( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} multScale(PGL::Turtle {lvalue},double)

nF((Turtle)arg1, (object)length, (object)dlength) Turtle :#
C++ signature :

PGL::Turtle {lvalue} nF(PGL::Turtle {lvalue},double,double)

nF( (Turtle)arg1, (object)length, (object)dlength [, (object)radius=1.0 [, (QuantisedFunction)radiusvariation=None]]) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} nF(PGL::Turtle {lvalue},double,double [,double=1.0 [,PGL::RefCountPtr<PGL::QuantisedFunction>=None]])

oLineRel((Turtle)arg1[, (Vector3)position=Vector3(0, 0, 0)[, (object)topradius=-1.0]]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} oLineRel(PGL::Turtle {lvalue} [,PGL::Vector3=Vector3(0,0,0) [,double=-1.0]])

oLineRel( (Turtle)arg1 [, (object)x=0.0 [, (object)y=0.0 [, (object)z=0.0 [, (object)topradius=-1.0]]]]) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} oLineRel(PGL::Turtle {lvalue} [,double=0.0 [,double=0.0 [,double=0.0 [,double=-1.0]]]])

oLineTo((Turtle)arg1[, (Vector3)position=Vector3(0, 0, 0)[, (object)topradius=-1.0]]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} oLineTo(PGL::Turtle {lvalue} [,PGL::Vector3=Vector3(0,0,0) [,double=-1.0]])

oLineTo( (Turtle)arg1 [, (object)x=0.0 [, (object)y=0.0 [, (object)z=0.0 [, (object)topradius=-1.0]]]]) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} oLineTo(PGL::Turtle {lvalue} [,double=0.0 [,double=0.0 [,double=0.0 [,double=-1.0]]]])

partialView((PglTurtle)arg1) Scene :#

Return the current turtle construction.

C++ signature :

PGL::RefCountPtr<PGL::Scene> partialView(PGL::PglTurtle {lvalue})

property path_info_cache_enabled#
pglShape((PglTurtle)arg1, (Geometry)geometry[, (object)scale=1]) PglTurtle :#

Insert a custom plantgl primitive at the turtle position and orientation

C++ signature :

PGL::PglTurtle {lvalue} pglShape(PGL::PglTurtle {lvalue},PGL::RefCountPtr<PGL::Geometry> [,double=1])

pglShape( (PglTurtle)arg1, (Shape)geometry [, (object)scale=1]) -> PglTurtle :

Insert a custom plantgl primitive at the turtle position and orientation

C++ signature :

PGL::PglTurtle {lvalue} pglShape(PGL::PglTurtle {lvalue},PGL::RefCountPtr<PGL::Shape> [,double=1])

pglShape( (PglTurtle)arg1, (Scene)geometry [, (object)scale=1]) -> PglTurtle :

Insert a custom plantgl primitive at the turtle position and orientation

C++ signature :

PGL::PglTurtle {lvalue} pglShape(PGL::PglTurtle {lvalue},PGL::RefCountPtr<PGL::Scene> [,double=1])

pinpoint((Turtle)arg1, (Vector3)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} pinpoint(PGL::Turtle {lvalue},PGL::Vector3)

pinpoint( (Turtle)arg1, (object)arg2, (object)arg3, (object)arg4) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} pinpoint(PGL::Turtle {lvalue},double,double,double)

pinpointRel((Turtle)arg1, (Vector3)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} pinpointRel(PGL::Turtle {lvalue},PGL::Vector3)

pinpointRel( (Turtle)arg1, (object)arg2, (object)arg3, (object)arg4) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} pinpointRel(PGL::Turtle {lvalue},double,double,double)

polygonPoint((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} polygonPoint(PGL::Turtle {lvalue})

pop((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} pop(PGL::Turtle {lvalue})

popEvent()#
push((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} push(PGL::Turtle {lvalue})

pushEvent()#
quad((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} quad(PGL::Turtle {lvalue})

quad( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} quad(PGL::Turtle {lvalue},double)

quad( (Turtle)arg1, (object)arg2, (object)arg3) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} quad(PGL::Turtle {lvalue},double,double)

removeColor((PglTurtle)arg1, (object)arg2) None :#
C++ signature :

void removeColor(PGL::PglTurtle {lvalue},unsigned long)

removeSurface((PglTurtle)arg1, (str)arg2) None :#
C++ signature :

void removeSurface(PGL::PglTurtle {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

remove_parameter(name)#

Remove a parameter to the Turtle that was pushed and popped.

reset((Turtle)arg1) None :#
C++ signature :

void reset(PGL::Turtle {lvalue})

resetValues((Turtle)arg1) None :#
C++ signature :

void resetValues(PGL::Turtle {lvalue})

right((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} right(PGL::Turtle {lvalue})

right( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} right(PGL::Turtle {lvalue},double)

rollL((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} rollL(PGL::Turtle {lvalue})

rollL( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} rollL(PGL::Turtle {lvalue},double)

rollR((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} rollR(PGL::Turtle {lvalue})

rollR( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} rollR(PGL::Turtle {lvalue},double)

rollToHorizontal((Turtle)arg1[, (object)alpha=1.0[, (Vector3)top=Vector3(0, 0, 1)]]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} rollToHorizontal(PGL::Turtle {lvalue} [,double=1.0 [,PGL::Vector3=Vector3(0,0,1)]])

rollToVert((Turtle)arg1[, (object)alpha=1.0[, (Vector3)top=Vector3(0, 0, 1)]]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} rollToVert(PGL::Turtle {lvalue} [,double=1.0 [,PGL::Vector3=Vector3(0,0,1)]])

scale((Turtle)arg1, (Vector3)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} scale(PGL::Turtle {lvalue},PGL::Vector3)

scale( (Turtle)arg1, (object)arg2, (object)arg3, (object)arg4) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} scale(PGL::Turtle {lvalue},double,double,double)

scale( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} scale(PGL::Turtle {lvalue},double)

property sectionResolution#
setAngleIncrement((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setAngleIncrement(PGL::Turtle {lvalue},double)

setColor((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setColor(PGL::Turtle {lvalue},int)

setColorAt((PglTurtle)arg1, (object)arg2, (object)arg3, (object)arg4, (object)arg5) None :#
C++ signature :

void setColorAt(PGL::PglTurtle {lvalue},unsigned long,unsigned int,unsigned int,unsigned int)

setColorAt( (PglTurtle)arg1, (object)arg2, (object)arg3, (object)arg4, (object)arg5) -> None :

C++ signature :

void setColorAt(PGL::PglTurtle {lvalue},unsigned long,float,float,float)

setColorAt( (PglTurtle)arg1, (object)arg2, (Color3)arg3) -> None :

C++ signature :

void setColorAt(PGL::PglTurtle {lvalue},unsigned long,PGL::Color3)

setColorIncrement((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setColorIncrement(PGL::Turtle {lvalue},int)

setColorList((PglTurtle)arg1, (object)arg2) None :#
C++ signature :

void setColorList(PGL::PglTurtle*,boost::python::api::object)

setCrossSection((Turtle)arg1, (Curve2D)arg2, (object)curve) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setCrossSection(PGL::Turtle {lvalue},PGL::RefCountPtr<PGL::Curve2D>,bool)

setCustomAppearance((Turtle)arg1, (Appearance)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setCustomAppearance(PGL::Turtle {lvalue},PGL::RefCountPtr<PGL::Appearance>)

setDefaultCrossSection((Turtle)arg1[, (object)slices]) None :#
C++ signature :

void setDefaultCrossSection(PGL::Turtle* [,unsigned long])

setDefaultStep((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setDefaultStep(PGL::Turtle {lvalue},double)

setDrawer((PglTurtle)arg1, (TurtleDrawer)arg2) PglTurtle :#
C++ signature :

PGL::PglTurtle {lvalue} setDrawer(PGL::PglTurtle {lvalue},PGL::RefCountPtr<PGL::TurtleDrawer>)

setFrame(frame)[source]#
setGuide((Turtle)arg1, (LineicModel)curve, (object)length) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setGuide(PGL::Turtle {lvalue},PGL::RefCountPtr<PGL::LineicModel>,double)

setGuide( (Turtle)arg1, (Curve2D)curve, (object)length [, (object)yorientation=False [, (object)ccw=False]]) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} setGuide(PGL::Turtle {lvalue},PGL::RefCountPtr<PGL::Curve2D>,double [,bool=False [,bool=False]])

setHead((Turtle)arg1, (Vector3)head, (Vector3)up) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setHead(PGL::Turtle {lvalue},PGL::Vector3,PGL::Vector3)

setHead( (Turtle)arg1, (object)hx, (object)hy, (object)hz, (object)ux, (object)uy, (object)uz) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} setHead(PGL::Turtle {lvalue},double,double,double,double,double,double)

setId((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setId(PGL::Turtle {lvalue},unsigned int)

setMaterial((PglTurtle)arg1, (object)arg2, (Appearance)arg3) None :#
C++ signature :

void setMaterial(PGL::PglTurtle {lvalue},unsigned long,PGL::RefCountPtr<PGL::Appearance>)

setMaterial( (PglTurtle)arg1, (object)arg2, (ImageTexture)arg3) -> None :

C++ signature :

void setMaterial(PGL::PglTurtle {lvalue},unsigned long,PGL::RefCountPtr<PGL::ImageTexture>)

setPositionOnGuide((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setPositionOnGuide(PGL::Turtle {lvalue},double)

setScaleMultiplier((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setScaleMultiplier(PGL::Turtle {lvalue},double)

setScreenCoordinatesEnabled((Turtle)arg1[, (object)enabled=True]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setScreenCoordinatesEnabled(PGL::Turtle {lvalue} [,bool=True])

setSurface((PglTurtle)arg1, (str)arg2, (Geometry)arg3) None :#
C++ signature :

void setSurface(PGL::PglTurtle {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,PGL::RefCountPtr<PGL::Geometry>)

setTextureRotation((Turtle)arg1[, (object)angle=0[, (object)ucenter=0.5[, (object)vcenter=0.5]]]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setTextureRotation(PGL::Turtle {lvalue} [,double=0 [,double=0.5 [,double=0.5]]])

setTextureRotation( (Turtle)arg1 [, (object)angle=0 [, (Vector2)center=Vector2(0.5,0.5)]]) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} setTextureRotation(PGL::Turtle {lvalue} [,double=0 [,PGL::Vector2=Vector2(0.5,0.5)]])

setTextureScale((Turtle)arg1, (object)arg2, (object)arg3) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setTextureScale(PGL::Turtle {lvalue},double,double)

setTextureScale( (Turtle)arg1, (Vector2)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} setTextureScale(PGL::Turtle {lvalue},PGL::Vector2)

setTextureTransformation((Turtle)arg1[, (object)uscaling=1[, (object)vscaling=1[, (object)utranslation=0[, (object)vtranslation=0[, (object)angle=0[, (object)urotcenter=0.5[, (object)vrotcenter=0.5]]]]]]]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setTextureTransformation(PGL::Turtle {lvalue} [,double=1 [,double=1 [,double=0 [,double=0 [,double=0 [,double=0.5 [,double=0.5]]]]]]])

setTextureTransformation( (Turtle)arg1 [, (Vector2)scaling=Vector2(1,1) [, (Vector2)translation=Vector2(0,0) [, (object)angle=0 [, (Vector2)rotcenter=Vector2(0.5,0.5)]]]]) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} setTextureTransformation(PGL::Turtle {lvalue} [,PGL::Vector2=Vector2(1,1) [,PGL::Vector2=Vector2(0,0) [,double=0 [,PGL::Vector2=Vector2(0.5,0.5)]]]])

setTextureTranslation((Turtle)arg1[, (object)u=0[, (object)v=0]]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setTextureTranslation(PGL::Turtle {lvalue} [,double=0 [,double=0]])

setTextureTranslation( (Turtle)arg1, (Vector2)t) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} setTextureTranslation(PGL::Turtle {lvalue},PGL::Vector2)

setTextureUScale((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setTextureUScale(PGL::Turtle {lvalue},double)

setTextureVScale((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setTextureVScale(PGL::Turtle {lvalue},double)

setTropism((Turtle)arg1, (object)arg2, (object)arg3, (object)arg4) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setTropism(PGL::Turtle {lvalue},double,double,double)

setWidth((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setWidth(PGL::Turtle {lvalue},double)

setWidthIncrement((Turtle)arg1, (object)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} setWidthIncrement(PGL::Turtle {lvalue},double)

shift((Turtle)arg1, (Vector3)arg2) Turtle :#
C++ signature :

PGL::Turtle {lvalue} shift(PGL::Turtle {lvalue},PGL::Vector3)

shift( (Turtle)arg1, (object)arg2, (object)arg3, (object)arg4) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} shift(PGL::Turtle {lvalue},double,double,double)

sphere((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} sphere(PGL::Turtle {lvalue})

sphere( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} sphere(PGL::Turtle {lvalue},double)

start((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} start(PGL::Turtle {lvalue})

startGC((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} startGC(PGL::Turtle {lvalue})

startPolygon((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} startPolygon(PGL::Turtle {lvalue})

stop((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} stop(PGL::Turtle {lvalue})

stopGC((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} stopGC(PGL::Turtle {lvalue})

stopPolygon((Turtle)arg1[, (object)concavetest=False]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} stopPolygon(PGL::Turtle {lvalue} [,bool=False])

surface((Turtle)arg1, (str)arg2, (object)arg3) Turtle :#
C++ signature :

PGL::Turtle {lvalue} surface(PGL::Turtle {lvalue},std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,double)

sweep((Turtle)arg1, (Curve2D)path, (Curve2D)section, (object)length, (object)dlength[, (object)radiusmagnitude=1.0[, (QuantisedFunction)radiusvariation=None]]) Turtle :#
C++ signature :

PGL::Turtle {lvalue} sweep(PGL::Turtle {lvalue},PGL::RefCountPtr<PGL::Curve2D>,PGL::RefCountPtr<PGL::Curve2D>,double,double [,double=1.0 [,PGL::RefCountPtr<PGL::QuantisedFunction>=None]])

sweep( (Turtle)arg1, (LineicModel)path, (Curve2D)section, (object)length, (object)dlength [, (object)radiusmagnitude=1.0 [, (QuantisedFunction)radiusvariation=None]]) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} sweep(PGL::Turtle {lvalue},PGL::RefCountPtr<PGL::LineicModel>,PGL::RefCountPtr<PGL::Curve2D>,double,double [,double=1.0 [,PGL::RefCountPtr<PGL::QuantisedFunction>=None]])

transform((Turtle)arg1, (Matrix3)arg2) Turtle :[source]#
C++ signature :

PGL::Turtle {lvalue} transform(PGL::Turtle {lvalue},PGL::Matrix3)

property tropism#
up((Turtle)arg1) Turtle :#
C++ signature :

PGL::Turtle {lvalue} up(PGL::Turtle {lvalue})

up( (Turtle)arg1, (object)arg2) -> Turtle :

C++ signature :

PGL::Turtle {lvalue} up(PGL::Turtle {lvalue},double)

property warn_on_error#
class openalea.adel.mtg_interpreter.AdelVisitor(leaves, min_length, classic, face_up)[source]#

Bases: object

Performs geometric interpretation of mtg nodes

openalea.adel.mtg_interpreter.StemElement_mesh(length, diameter_base, diameter_top, classic=False)[source]#

Compute mesh for a stem element - classic indicates

openalea.adel.mtg_interpreter.addSets(pglset1, pglset2, translate=(0, 0, 0))[source]#

create a new TriangleSet by addition of two existing ones if translate is not None, pglset2 is translated with vector translate

openalea.adel.mtg_interpreter.as_tuples(pgl_3List, offset=0)[source]#

return pgl list of 3 numbers kind (indes3, vector3) as a list of python tuples

openalea.adel.mtg_interpreter.compute_element(element_node, leaves, min_length=0.01, classic=False)[source]#

compute geometry of Adel base elements (LeafElement and StemElement) element_node should be a mtg node proxy

openalea.adel.mtg_interpreter.mtg_interpreter(g, leaves, min_length=0.01, classic=False, face_up=False)[source]#

Compute/update the geometry on each node of the MTG using Turtle geometry.

openalea.adel.mtg_interpreter.plot3d(g, leaf_material=None, stem_material=None, soil_material=None, colors=None)[source]#

Returns a plantgl scene from an mtg.

openalea.adel.mtg_interpreter.slim_cylinder(length, radius_base, radius_top)[source]#

Try to construct a cylinder with a low number of triangles.

openalea.adel.mtg_interpreter.transform_geom(geom, translation, rotation)[source]#