コード例 #1
0
    def __init__(self, model, events): 
        PyDynamics.Dynamics.__init__(self, model, events)
        valeur_python = convert.to_pyvalue( events )
        if "modelname" in valeur_python.keys() :
            self.m_name = valeur_python["modelname"]
        print ""
        print "-----------------------------------------------"
	print "-------- ", self.m_name, " : __init__ --------------"            
        self.m_choix = 1

        print "valeur python de events : ", valeur_python
        print "lecture des elements  1 a 1 : "
        for k,v in valeur_python.iteritems() :
            print "key : ", k, "value : ", v

        self.conditions = valeur_python

        pm = load_package_manager()
        node_factory = pm[self.conditions['openalea_pkgname']][self.conditions['openalea_nodename']]
        self.eval = function(node_factory)
        # /!\ on suppose l'unicité des noms entre paramètres et attributs des ports
        self.eval_args = dict([(d['name'],-1.) for d in node_factory.inputs])
        self.out_names = [d['name'] for d in node_factory.outputs]
        self.outputs = self.eval(**self.eval_args)
        for k in self.conditions.keys() :
            if k in self.eval_args.keys() :        
                self.eval_args[k] = self.conditions[k]

        if "delay" in valeur_python.keys() :
            self.p_delay = valeur_python["delay"]
            print "Le 'delay' est de : ", self.p_delay 
        else : 
            self.p_delay = 1.0

        print ""
コード例 #2
0
ファイル: OpenAlea_VLE.py プロジェクト: BeGIMATH/astk
    def __init__(self, model, events):
        PyDynamics.Dynamics.__init__(self, model, events)
        # get init partameters
        self.conditions = convert.to_pyvalue(events)

        pm = load_package_manager()
        node_factory = pm[self.conditions['openalea_pkgname']][
            self.conditions['openalea_nodename']]
        self.eval = function(node_factory)
        # /!\ on suppose l'unicite des noms entre parametres et attributs des ports
        self.eval_args = dict([(d['name'], -1.) for d in node_factory.inputs])
        self.out_names = [d['name'] for d in node_factory.outputs]
        self.outputs = self.eval(**self.eval_args)
        # set model parameters, if any
        for k in list(self.conditions.keys()):
            if k in list(self.eval_args.keys()):
                self.eval_args[k] = self.conditions[k]

        if "delay" in list(self.conditions.keys()):
            self.p_delay = self.conditions["delay"]
            print("Le 'delay' est de : ", self.p_delay)
        else:
            self.p_delay = 1.0

        print("")
コード例 #3
0
ファイル: OpenAlea_VLE.py プロジェクト: pradal/astk
    def __init__(self, model, events):
        PyDynamics.Dynamics.__init__(self, model, events)
        # get init partameters
        self.conditions = convert.to_pyvalue(events)

        pm = load_package_manager()
        node_factory = pm[self.conditions['openalea_pkgname']][
            self.conditions['openalea_nodename']]
        self.eval = function(node_factory)
        # /!\ on suppose l'unicite des noms entre parametres et attributs des ports
        self.eval_args = dict([(d['name'], -1.) for d in node_factory.inputs])
        self.out_names = [d['name'] for d in node_factory.outputs]
        self.outputs = self.eval(**self.eval_args)
        # set model parameters, if any
        for k in self.conditions.keys():
            if k in self.eval_args.keys():
                self.eval_args[k] = self.conditions[k]

        if "delay" in self.conditions.keys():
            self.p_delay = self.conditions["delay"]
            print "Le 'delay' est de : ", self.p_delay
        else:
            self.p_delay = 1.0

        print ""
コード例 #4
0
ファイル: binarise.py プロジェクト: pradal/eartrack
from openalea.core.alea import load_package_manager, function
import alinea.phenomenal.phenomenal_config as pconf

pm = load_package_manager()
node_factory = pm['alinea.phenomenal.macros']['side_binarisation']
node_factory2 = pm['alinea.phenomenal.macros']['top_binarisation']
side_binarisation = function(node_factory)
top_binarisation = function(node_factory2)

p = pconf.getconfig()
opts_sv = pconf.sidebinarisation_options(p).values()
opts_tv = pconf.topbinarisation_options(p).values()


def side_bin(file):
    return side_binarisation(file, *opts_sv)[0]
    
    
res = top_binarisation(file, *opts_tv)[0]
コード例 #5
0
from sys import argv,stdout,stdin
from openalea.aml import MTG, VtxList, Trunk, Feature
from openalea.core.alea import load_package_manager, function
from numpy import mean, array

pm = load_package_manager()
nf = pm['__my package__']['twosethistogram']
histogram = function(nf)

#get mtg file name
#mfile=argv[1]
mfile='ModelMTG.mtg'

m=MTG(mfile)
branches=VtxList(Scale=2)
nodes=VtxList(Scale=3)
rat= len(nodes) / float(len(branches))
stdout.write('\nNode:Branch ratio is %.2f\n' % (rat))

numsegs=[] # as limited by MAXGROW
flushlen=[] # this is what is provided by budvigour, but not limited by MAXGROW
for n in nodes[4:len(nodes)]: #skip first there nodes as they are set to INITIALNODES
	fl=Feature(n,'FlushLen')
	nc=Feature(n,'NumSegs')
	if fl >0:
		flushlen.append(fl)
		numsegs.append(nc)
stdout.write('Mean actual flush len %.2f %.2f - %.2f (%i) \n' % (mean(numsegs),min(numsegs),max(numsegs),len(numsegs)))
stdout.write('Mean potential        %.2f %.2f - %.2f (%i) \n' % (mean(flushlen),min(flushlen),max(flushlen),len(flushlen)))

nbins=10
コード例 #6
0
def subdataflow():
    factory = pm['openalea.tutorial.multiprocess']['x+1']
    f = alea.function(factory)
    return f()[0]
コード例 #7
0
ファイル: AdelCaribu.py プロジェクト: alsabadel/vle
# !!! AdelCaribu installe sous pkgs-1.1/pydynamics/pythonsrc
# PyDynamics et convert installes sous pkgs-1.1/pydynamics_wrapper/wrapping

import PyDynamics
import convert
#import pylab

from openalea.core.alea import load_package_manager, function
import sys
print sys.path
###############################################################################

pm = load_package_manager()
node_factory = pm['vle']['composite2CV_stub']
model_python_eval = function(node_factory)
 

class AdelCaribu(PyDynamics.Dynamics):

    def __init__(self, model, events): 
        PyDynamics.Dynamics.__init__(self, model, events)
        valeur_python = convert.to_pyvalue( events )
        if "model_name" in valeur_python.keys() :
            self.m_name = valeur_python["model_name"]
        print ""
        print "-----------------------------------------------"
	print "-------- ", self.m_name, " : __init__ --------------"            
        self.m_choix = 1

        print "valeur python de events : ", valeur_python
コード例 #8
0
ファイル: AdelCaribu.py プロジェクト: alsabadel/vle
# !!! AdelCaribu installe sous pkgs-1.1/pydynamics/pythonsrc
# PyDynamics et convert installes sous pkgs-1.1/pydynamics_wrapper/wrapping

import PyDynamics
import convert
#import pylab

from openalea.core.alea import load_package_manager, function
import sys
print sys.path
###############################################################################

pm = load_package_manager()
node_factory = pm['vle']['composite2CV_stub']
model_python_eval = function(node_factory)


class AdelCaribu(PyDynamics.Dynamics):
    def __init__(self, model, events):
        PyDynamics.Dynamics.__init__(self, model, events)
        valeur_python = convert.to_pyvalue(events)
        if "model_name" in valeur_python.keys():
            self.m_name = valeur_python["model_name"]
        print ""
        print "-----------------------------------------------"
        print "-------- ", self.m_name, " : __init__ --------------"
        self.m_choix = 1

        print "valeur python de events : ", valeur_python
        print "lecture des elements  1 a 1 : "