# l ordre des motclefs en 3.7 a l air de dépendre de l ordre de creation des objets
# et non d un dict ordonné. on retombe toujours sur ce pb
return PROC ( nom = "ExpressionIncertitude", UIinfo={"groupes":("CACHE",)}, op_init=definitIntoOuput,
+ UncertaintyTool = SIMP ( statut = "o", typ = "TXM", into = ['Uranie', 'OpenTurns'], defaut='Uranie',position='global'),
Input = FACT( max=1, statut ='o',
VariableProbabiliste = FACT ( max='**', statut ='cache',
fr = "Variable probabiliste",
),
),
Propagation = FACT( max=1, statut ='o',
- UncertaintyTool = SIMP ( statut = "o", typ = "TXM", into = ['Uranie', 'OpenTurns'], defaut='Uranie',position='global'),
+ #UncertaintyTool = SIMP ( statut = "o", typ = "TXM", into = ['Uranie', 'OpenTurns'], defaut='Uranie',position='global'),
Propagation_OT = BLOC( condition = "UncertaintyTool == 'OpenTurns'",
Methode = SIMP( statut = "o", typ = "TXM", max=1, into = ('Taylor', 'MonteCarlo'), defaut='Taylor'),
BlocMonteCarlo1 = BLOC ( condition = "Methode == 'MonteCarlo'",
from .generator_python import PythonGenerator
from .textePersalys import headerScriptPersalys, fonctionPersalys, etudeScript, codePersalys
from .textePersalys import mainPersalys, inputHeaderPersalys, outputHeaderPersalys
-from .textePersalys import getResult
+from .textePersalys import getResultCall
from .textePersalys import centralTendencyTaylor, resultTaylor
from .textePersalys import optionalResultTaylor, optionalPrintResultTaylor
from .textePersalys import centralTendencyMC, resultMC
# self.Seed = self.advancedParameter.getChildOrChildInBloc('Seed')[0]
self.lesVariablesOutput = sectionOutput.getChildOrChildInBloc('VariableDeSortie')
- self.variablesOutput = {}
+ #self.variablesOutput = {}
self.chaineDesVariablesOutputEncodee=''
#listeDesVariablesOutput=[]
self.txtOutputVariableInitList=''
- self.txtGetResults = ""
+ self.txtGetAllResults = ""
+ #TODO? from cata_UQ import FonctionDAggregationDict
+ fctAggPy={
+ 'valeur à t=O':'vIninialTime',
+ 'valeur à mi-temps':'vHalfTtime',
+ 'valeur à t final':'vFinalTime',
+ 'valeur moyenne':'mean',
+ 'valeur cumulée':'sum',
+ 'valeur minimale':'min',
+ 'valeur maximale':'max'
+ }
+
for mc in self.lesVariablesOutput :
nomVar = mc.getChildOrChildInBloc('VariablePhysique').valeur
nomVarEncode = nomVar.replace(' ','__')
- #listeDesVariablesOutput.append(nomVar)
- self.chaineDesVariablesOutputEncodee+=nomVarEncode+ ', '
nomVarPostraite = mc.getChildOrChildInBloc('VariablePosttraiteeAssociee').valeur
- ##TODO : Check [0], liste ou non de fonctions d'agrégation
- fonctions = mc.getChildOrChildInBloc('FonctionDAggregation').valeur[0]
- ##TODO : Gerer Mean, Med?
- tmpFonctionAggregation = fonctions.lower()
- self.variablesOutput [nomVar]=fonctions
- tmpGetResult =getResult.format(
- variablesOutput = nomVarEncode,
- variablePostraitee = nomVarPostraite,
- fonctionAggregation = tmpFonctionAggregation
- )
- self.txtGetResults += tmpGetResult
- self.txtOutputVariableInitList += self.indent1 + nomVarEncode + " = persalys.Output('"+ nomVar + "', '"+nomVar + "')\n"
- print (self.variablesOutput)
+ nomFctAggList = mc.getChildOrChildInBloc('FonctionDAggregation').valeur
+ for nomFctAgg in nomFctAggList:
+ nomFctAggPy = fctAggPy[nomFctAgg]
+ nomOutput=nomVarEncode+'_'+nomFctAggPy
+ self.chaineDesVariablesOutputEncodee+=nomOutput+ ', '
+ variablesOutputDesc = nomFctAgg+'('+nomVarPostraite+')'
+ tmpGetResultCall = getResultCall.format(
+ variableOutput = nomOutput,
+ variablePostraitee = nomVarPostraite,
+ fonctionAggregation = nomFctAggPy
+ )
+ self.txtGetAllResults += tmpGetResultCall
+ self.txtOutputVariableInitList += self.indent1 + nomOutput + " = persalys.Output('"+ nomVar+' (Agg: '+nomFctAgg+')' + "', '"+variablesOutputDesc + "')\n"
self.chaineDesVariablesOutputEncodee=self.chaineDesVariablesOutputEncodee[0:-2]
sectionExecution = etapeIncertitude.getChildOrChildInBloc('Execution')[0]
# chaineDesVariablesInput=reduce(lambda x,y:x+','+y,l)
def getStrVarList(l,sep):
return reduce(lambda x,y:x+sep+y, l)
- def getStrInitClass(l):
+ def getStrInitList(l):
return getStrVarList( map(lambda x:'self.{} = {}'.format(x,x),l), '\n'+2*self.indent1 )
- def getStrReplaceVar(l):
+ def getStrReplaceVarList(l):
return getStrVarList( map(lambda x:"'@{}@': repr(self.{})".format(x,x), l), ',' )
- def getStrSelfVar(l):
+ def getStrSelfVarList(l):
return getStrVarList( map(lambda x:'self.{}'.format(x),l), ',' )
- generatorDir = os.path.abspath(os.path.dirname(__file__))
- nomEtude = "monEtude"
+ generatorDir = os.path.abspath(os.path.dirname(__file__))
+ nomEtude = "monEtude" #TODO
if debug : print ('nomEtude : ', nomEtude, 'generatorDir :', generatorDir)
self.txtScriptPersalys += headerScriptPersalys
print('self.nomsDesVariablesInput :',self.nomsDesVariablesInput)
self.txtScriptPersalys += etudeScript.format(
chaineDesVariablesInput = self.chaineDesVariablesInput,
- chaineSelfDesVariablesInput = getStrSelfVar(self.nomsDesVariablesInput),
- chaineInitDesVariablesInput = getStrInitClass(self.nomsDesVariablesInput),
+ chaineSelfDesVariablesInput = getStrSelfVarList(self.nomsDesVariablesInput),
+ chaineInitDesVariablesInput = getStrInitList(self.nomsDesVariablesInput),
commFileUQBalise = self.fichierUQBalise,
commFileUQComm = self.fichierUQComm,
nproc = self.NbOfProcs,
- replaceDataList = getStrReplaceVar(self.nomsDesVariablesInput)
+ replaceDataList = getStrReplaceVarList(self.nomsDesVariablesInput)
)
txtFonctionPersalys = fonctionPersalys.format(
currentFile = self.fichierUQModule,
chaineDesVariablesInput = self.chaineDesVariablesInput,
- getResults = self.txtGetResults,
+ getAllResults = self.txtGetAllResults,
chaineDesVariablesOutput = self.chaineDesVariablesOutputEncodee
)
self.txtScriptPersalys += codePersalys.format(