Home | Download/Install | Documentation | Packages | Screenshots | News | Forum/Mailing-lists | Contact | GForge

User Guide


For general informations about installation, please read the Installation guide.

If you are looking for a specific package installation, refer to the package documentation.

Using OpenAlea

Models under OpenAlea are in the form of components that could be used as such, or combined together to build user-customised applications. OpenAlea provides two different ways to interacts with components:

  • by visual programming, using visualea
  • by writing scripts, using a standard python development environment

Both methods allows you to save your application and run it routinely in batch mode. Visual programming is easier to start with, and it allows you to rapidly discover components of a package. Python scripting allows for programming more complex tasks, and provides an access to additional functionalities of models, by importing python modules that compose them.

Python scripting

OpenAlea packages are available under the python scripting language. This allows to use the components of packages (as in visualea), but also to directly import python modules and get access to all functionalities documented in package's API.

Using Python

Python is a scripting language widely spread in the scientific community. It has a lot of advantages :

  • It is easy to learn, even for non programmers.
  • It is an high level language, based on the object paradigm
  • It is extensible with external libraries
  • Multi-platform (Linux, Windows, Mac)

You can learn the basics with the official tutorial or the English/French translated online book Dive into python.

Python scripts could be launched by invoking python from a command line, e.g. :

python myScript.py

You can also launch a Python interpreter and run or test your script step by step.

The default interpreter could be launch by typing python in a terminal (Linux, Mac) or in a DOS windows. Under Windows, you may also use one of the following method:

  • Use Start Menu → openalea → python shell
  • You can use the default python interpreter GUI : IDLE (start menu → Python 2.4 → IDLE)

You can also use more ergonomic user interface, like ipython, that provides usefull functionalities (completion, coloration, execution of block of lines,…)

Importing OpenAlea modules

The magic line which will make available all openalea modules is :

import openalea

All OpenAlea modules are available in the openalea namespace. Refer to the modules documentation to learn how to use them.

You can also write simple python scripts in order to execute the same code several times.

Importing visualea nodes and dataflows

All the openalea nodes available from the package manager can be run from any Python script. To do so, you will have to import the package manager, retrieve the node factory of the component you want to use, and transform it into a regular python function. The openalea.core package has functionalities that facilitate this task. For instance, to run the node '+' in the package 'openalea.math', you can type:

from openalea.core.alea import load_package_manager, function
pm = load_package_manager()
node_factory = pm['openalea.math']['+']
sum = function(node_factory)
c = sum(1,2)
d= sum(a=1,b=2)

Note that for dataflows, arguments to the function correspond to ports of the IN node, and returned values to the ports of the OUT node.


How to save and run your application ?

  • Under visualea, you application can be saved as a dataflow, and run interactively from visualea
  • You can also use the 'Export to Application' item in the Workspace menu, and run the exported dataflow apart from visualea
  • To run your model in batch mode, you can either write python scripts (see above) or use the alea-script command in a shell
documentation/user_guide.txt · Last modified: 2010/02/17 08:49 by user   Back to top
INRIA GForge RSS feed Valid XHTML 1.0 Valid CSS Driven by DokuWiki