TurbideToTriangles (version 1.0)
index
/mnt/data2/home/cajgfingert/DART/Scripts/ScriptsRami/TurbideToTriangles.py

Functions to create random position and angles according to a leaf angle distribution

 
Modules
       
array
scipy.interpolate
math
numpy
os
random
struct
sys
time

 
Functions
       
ComputeLAD(LAD)
Returns the bunnick lead angle distribution table for angles from 0 to 90
Input:
------
arg:
  - LAD: keyword for type of leaf orientation: 
    'PLANO' for planophile, 
    'ERE' for erectophile
    'SPHE' for spherical
    'UNI' for uniform
    'PLAGIO' for plagiophile
    'EXTREMO' for extremophile
Return:
-------
  - tabTheta: table of angles from 0 to 90
  - tabLAD: bunnick lead angle distribution table for angles from 0 to 90
ComputeLADCumulative(LAD)
Returns the bunnick lead angle distribution table for angles from 0 to 90 and its cumulative function
Input:
------
arg:
  - LAD: keyword for type of leaf orientation: 
    'PLANO' for planophile, 
    'ERE' for erectophile
    'SPHE' for spherical
    'UNI' for uniform
    'PLAGIO' for plagiophile
    'EXTREMO' for extremophile
Return:
-------
  - tabTheta: table of angles from 0 to 90
  - tabLAD: bunnick lead angle distribution table for angles from 0 to 90
  - tabLADCumulative: cumulative function of the bunnick lead angle distribution table for angles from 0 to 90
ComputeStatistics(tabLADCumulative, N=100000)
Generates a tab of random angles according to a given leaf angle distribution function
------
arg:
  - tabLADCumulative: cumulative function of the bunnick lead angle distribution table for angles from 0 to 90
  * N: number of angles to generate (default=10 000)
    
Return:
-------
  - RandomAngleTable: a table of N random angles
FonctionLadBunnick(Theta_D, a, b, c, d)
Returns the bunnick lead angle distribution for a given theta at the parameters a,b,c,d.
  LAD(Theta_D) = 2. / np.pi * (a + b * np.cos(2 * c * Theta_D)) + d * np.sin(Theta_D)
Input:
------
arg:
  - Theta_D: angle of the leaves
  - a,b,c,d parameters of the LAD distribution
    
Return:
-------
  - LAD(Theta_D)
GenerateRandomCoordonates(dX, dY, dZ)
Generates random coordinates in a dX*dY*dZ box
Input:
------
arg:
  - dX,dY,dZ: size of the box
    
Return:
-------
  - X,Y,Z: coordinates of a point
GetParametersBunnck(LAD)
Returns the bunnick lead angle distribution parameters for a given orientation
Input:
------
arg:
  - LAD: keyword for type of leaf orientation: 
    'PLANO' for planophile, 
    'ERE' for erectophile
    'SPHE' for spherical
    'UNI' for uniform
    'PLAGIO' for plagiophile
    'EXTREMO' for extremophile
Return:
-------
  - a,b,c,d: parameters of the bunnick leaf angle distribution
GetRandomAngle(tabLADCumulative)
Generates a random angle according to a leaf angle distribution function
------
arg:
  - tabLADCumulative: cumulative function of the bunnick lead angle distribution table for angles from 0 to 90
    
Return:
-------
  - RandomAngle: a random angle
WriteObjectField(LAD, FileName, NumberOfObjects, dX, dY, dZ, HX, HY, HZ, PhiMax, PsiMax, index)
Generate a file containing a given number of random positions and angles according to a given leaf angle distribution
------
arg:
  - LAD: keyword for type of leaf orientation: 
    'PLANO' for planophile, 
    'ERE' for erectophile
    'SPHE' for spherical
    'UNI' for uniform
    'PLAGIO' for plagiophile
    'EXTREMO' for extremophile
  - FileName: name of the file to create
  - NumberOfObjects: number of objects to create
  - dX,dY,dZ: size of the box
  - HX, HY, HZ: scale factor parameters of the objects
  - PhiMax,PsiMax: maximum values of angles Phi and Psi
WriteParameter(ParameterValue, File)
Write a value in the given file, followed by a space
------
arg:
  - ParameterValue: Value to write
  - File: file to write in
WriteRandomAnglePositionObject(tabLADCumulative, dX, dY, dZ, HX, HY, HZ, index, PhiMax, PsiMax, File)
Generate a random position and a random angle according to a given leaf angle distribution function and write the results in the given file
------
arg:
  - tabLADCumulative: cumulative function of the bunnick lead angle distribution table for angles from 0 to 90
  - dX,dY,dZ: size of the box
  - HX, HY, HZ: scale factor parameters of the objects
  - index: index number of the objects
  - PhiMax,PsiMax: maximum values of angles Phi and Psi
  - File: file to write in

 
Data
        __author__ = 'Cajgfinger T.'
__credits__ = 'CESBIO'
__version__ = '1.0'
degToRad = 0.017453292519943295

 
Author
        Cajgfinger T.

 
Credits
        CESBIO