+-------------------------------------+--------------------------------------------------+
| a File parameter has to be : | if catalog's description is : |
+=====================================+==================================================+
-|an existing file | type='Fichier' |
+|an existing file | typ='Fichier' |
+-------------------------------------+--------------------------------------------------+
-|a directory | type='Repertoire' |
+|a directory | typ='Repertoire' |
+-------------------------------------+--------------------------------------------------+
-|an existing file with specific suffix| type='Fichier','JDC Files (*.comm);;All Files (*)|
+|an existing file with specific suffix| typ='Fichier','JDC Files (*.comm);;All Files (*)|
+-------------------------------------+--------------------------------------------------+
-|a non-allready existing file | type=('Fichier',"",'Sauvegarde'), |
+|a non-allready existing file | typ=('Fichier',"",'Sauvegarde'), |
+-------------------------------------+--------------------------------------------------+
-|a simple string | type='FichierNoAbs' |
+|a simple string | typ='FichierNoAbs' |
+-------------------------------------+--------------------------------------------------+
The following widget allows users to enter a directory (first) or a file. Magnifier icon is not avalaible when a directory is required.
def saveUQFile(self, fichier = None):
#------------------------------------#
if fichier == None : print ("nom de fichier obligatoire pour sauvegarde"); return
+ self.fichier=fichier
self.generator=generator.plugins['UQ']()
+ ret = self.generator.creeNomsFichiers(fichier)
ret = self.generator.gener(self.jdc)
if not ret :
self.informe('Sauvegarde UQ', self.generator.commentaire)
return (ret, self.generator.commentaire)
- self.fichier=fichier
ret = self.generator.writeUQ(fichier)
if not ret : self.informe('Sauvegarde UQ', self.generator.commentaire)
print ('ok')
#ATTENTION : La .sufix rule n'autorise pas les dépendances après le : (sinon la ligne entière est un nom de fichier bizzare)
#_test_driver_$1.comm_test_driver_$1.xml:
# il faut les définir à part
-# TODO : Gérer la dépendance au cata_..._driver.py en utilisant la seconde expansion
+# TODO : Gérer la dépendance au cata_..._driver.py et au fichier catalogue en utilisant la seconde expansion
#.SECONDEXPANSION:
#%_test_driver_$1.xml : %_test_driver_$1.comm $$(realpath $$(*).py) $$(*)_driver.py
@echo -e "\n\n------ Generate xml test file $$(@) ------\n"
@[[ -f $$(*).py ]] || (echo "Le fichier catalogue $$(*).py est introuvable" && false)
@[[ -f $$(*)_driver.py ]] || (echo "Le fichier driver $$(*)_driver.py est introuvable" && false)
+ $(tooldir)/validateDataSet.py -c $$(abspath $$(*).py) $$<
$(tooldir)/generateXML.py -c $$(abspath $$(*).py) $$<
endef
typ=Tuple(2), # TODO: Use a triplet (parameter, physic, format) instead of a doublet
validators=VerifPostTreatment(),
max="**"))
+
+from cata_RN_UQ import *
+
),
),
Execution = FACT (max=1, statut ='o',
- UncertaintyTool = SIMP ( statut = "o", typ = "TXM", into = ['Uranie', 'OpenTurns'], defaut='Uranie'),
+ UncertaintyTool = SIMP ( statut = "o", typ = "TXM", into = ['Uranie', 'OpenTurns'], defaut='OpenTurns'),
bloc_OT = BLOC (condition = 'UncertaintyTool == "OpenTurns"',
- ExecutionMode = SIMP ( statut = "o", typ = "TXM", into = ['local', 'cluster']),
- NbDeBranches = SIMP ( statut = "o", typ = "I", val_min = 0, fr='nb d evaluations simultanees'),
- JobName = SIMP ( statut = 'o', typ ="TXM", defaut='idefix_job'),
+ ExecutionMode = SIMP ( statut = "o", typ = "TXM", into = ['desktop', 'cluster']),
NbOfProcs = SIMP ( statut = 'o', typ ="I" , defaut = 1, val_min = 1),
- bloc_OT_local = BLOC (condition = 'ExecutionMode == "local"',
+ NbDeBranches = SIMP ( statut = "o", typ = "I", val_min = 0, fr='nb d evaluations simultanees'),
+ JobName = SIMP ( statut = 'o', typ ="TXM", defaut='idefix_rn_job'),
+ bloc_OT_local = BLOC (condition = 'ExecutionMode == "desktop"',
+ ResourceName = SIMP ( statut = 'o', typ ="TXM", defaut ='localhost'),
+ Login = SIMP ( statut = 'o', typ ="TXM", defaut ='C65845'), #TODO
+# WorkDirectory = SIMP ( statut = 'o', typ='Repertoire' , defaut='/tmp/C65845_workingdir_uncertainty'), #TODO: Login + NonExistent
+ WorkDirectory = SIMP ( statut = 'o', typ='TXM' , defaut='/tmp/C65845_workingdir_uncertainty'), #TODO: Login + NonExistent
+# ResultDirectory = SIMP ( statut = 'o', typ='Repertoire' , defaut='/tmp/idefix_rn_job'), #TODO: JobName
+ ResultDirectory = SIMP ( statut = 'o', typ='TXM' , defaut='/tmp/idefix_rn_job'), #TODO: JobName
),
bloc_OT_cluster = BLOC (condition = 'ExecutionMode == "cluster"',
- resourceName = SIMP ( statut = 'o', typ ="TXM", defaut ='gaia'),
- multiJobStudy = SIMP ( statut = "o", typ = bool, defaut=False),
+ ResourceName = SIMP ( statut = 'o', typ ="TXM", defaut ='gaia'),
+ Login = SIMP( statut = 'o', typ ="TXM", defaut ='C65845'),
+ WorkDirectory = SIMP ( statut = 'o', typ='TXM' , defaut='/scratch/C65845/workingdir/persalys_light'), #TODO: Login
+# WorkDirectory = SIMP ( statut = 'o', typ='Repertoire' , defaut='/scratch/C65845/workingdir/persalys_light'), #TODO: Login
+ ResultDirectory = SIMP ( statut = 'o', typ='TXM' , defaut='/tmp/idefix_rn_job'), #TODO: JobName
+# ResultDirectory = SIMP ( statut = 'o', typ='Repertoire' , defaut='/tmp/idefix_rn_job'), #TODO: JobName
+ MultiJobStudy = SIMP ( statut = "o", typ = bool, defaut=False),
),
+
),
),
)
import Accas
from .generator_python import PythonGenerator
-from .textePersalys import headerScriptPersalys, fonctionScriptPersalys
-from .textePersalys import leMainPersalys, inputHeaderPersalys, outputHeaderPersalys
+from .textePersalys import headerScriptPersalys, fonctionPersalys, etudeScript, codePersalys
+from .textePersalys import mainPersalys, inputHeaderPersalys, outputHeaderPersalys
+from .textePersalys import centralTendencyTaylor, resultTaylor, optionalResultTaylor
+from .textePersalys import centralTendencyMC, resultMC, optionalResultMC
+from .textePersalys import yacsJobParameters
def entryPoint():
"""
"""
def gener(self,jdc,format='beautifie'):
+
+ self.indent = ' '
+
print (jdc.code)
if jdc.nature != 'JDC' :
self.commentaire= 'il faut un JDC Valide'
self.text=PythonGenerator.gener(self,jdc,format)
return self.text
+ def creeNomsFichiers(self,fichier):
+ if fichier.endswith('.comm'):
+ self.fichierSansSuffixe=fichier[:-5]
+ if self.fichierSansSuffixe.endswith('_UQ'):
+ self.fichierSansSuffixe = self.fichierSansSuffixe[:-3]
+ self.fichierUQComm = self.fichierSansSuffixe+'_UQ.comm'
+ self.fichierUQBalise = self.fichierSansSuffixe+'_UQBalise.comm'
+ self.fichierUQExe = self.fichierSansSuffixe+'_UQ.py'
+ else:
+ return (0, 'le fichier jeux de données |'+fichier+'| doit être suffixé par .comm')
+
def writeUQ(self,fichier):
# il manque le checksum
- fichierUQComm=fichier.split('.')[-2]+'_UQ.comm'
- if not self.writeFile(fichierUQComm) : return (0, 'impossible de sauvegarder le .comm')
- fichierUQ=fichier.split('.')[-2]+'_UQBalise.comm'
+
+ if not self.writeFile(self.fichierUQComm) : return (0, 'impossible de sauvegarder le .comm')
try :
- with open(fichierUQ, "w") as fp:
+ with open(self.fichierUQBalise, "w") as fp:
fp.write(self.textUQ)
except : return (0,'impossible de sauvegarder le _UQ.py')
- fichierUQExe=fichier.split('.')[-2]+'_UQ.py'
#try :
if 1 :
- with open(fichierUQExe, "w") as fp:
+ with open(self.fichierUQExe, "w") as fp:
fp.write(self.txtScriptPersalys)
#except : return (0,'impossible de sauvegarder le _UQ.py')
return (1, None)
else : return '@'+obj.nom+'@'
def analyseIncertitude(self) :
+
self.txtScriptPersalys = ''
etapeIncertitude=self.jdc.getEtapesByName('ExpressionIncertitude')
if etapeIncertitude == [] : return(0, 'il faut au moins un mot-clef ExpressionIncertitude')
sectionOutput = etapeIncertitude.getChildOrChildInBloc('Output')[0]
self.chaineDesVariablesInput=self.chaineDesVariablesInput[0:-2]
+ sectionPropagation = etapeIncertitude.getChildOrChildInBloc('Propagation')[0]
+ self.Methode = sectionPropagation.getChildOrChildInBloc('Methode').valeur
+ self.Result = sectionPropagation.getChildOrChildInBloc('Result')[0]
+
self.lesVariablesOutput = sectionOutput.getChildOrChildInBloc('VariableDeSortie')
self.variablesOutput = {}
self.chaineDesVariablesOutput=''
listeDesVariablesOutput=[] # pour ordre en 3.5
+ self.txtOutputVariableInitList=''
for mc in self.lesVariablesOutput :
nomVar = mc.getChildOrChildInBloc('NomDeLaVariable').valeur
listeDesVariablesOutput.append(nomVar)
self.chaineDesVariablesOutput+=nomVar+ ', '
Fonctions = mc.getChildOrChildInBloc('FonctionDAggregation').valeur
self.variablesOutput [nomVar]=Fonctions
+ self.txtOutputVariableInitList += self.indent + nomVar + " = persalys.Output('"+ nomVar + "', '"+nomVar + "')\n"
print (self.variablesOutput)
self.chaineDesVariablesOutput=self.chaineDesVariablesOutput[0:-2]
+ sectionExecution = etapeIncertitude.getChildOrChildInBloc('Execution')[0]
+ self.ExecutionMode = sectionExecution.getChildOrChildInBloc('ExecutionMode').valeur
+ self.NbOfProcs = sectionExecution.getChildOrChildInBloc('NbOfProcs').valeur
+ self.NbDeBranches = sectionExecution.getChildOrChildInBloc('NbDeBranches').valeur
+ self.JobName = sectionExecution.getChildOrChildInBloc('JobName').valeur
+ self.ResourceName = sectionExecution.getChildOrChildInBloc('ResourceName').valeur
+ self.Login = sectionExecution.getChildOrChildInBloc('Login').valeur
+ self.WorkDirectory = sectionExecution.getChildOrChildInBloc('WorkDirectory').valeur
+ self.ResultDirectory = sectionExecution.getChildOrChildInBloc('ResultDirectory').valeur
+ MultiJobStudy=sectionExecution.getChildOrChildInBloc('MultiJobStudy')
+ if (MultiJobStudy != None):
+ self.MultiJobStudy = MultiJobStudy.valeur
+
self.creeScriptPersalys()
return (1, '')
# listeDesVariables, nomDesVariables, dicoDesVariables)
chaineArgs+=str(mcFils.valeur) +', '
texte+=chaineArgs[0:-2]+'))\n'
return texte
-
+
def creeScriptPersalys(self, debug=True) :
+ from functools import reduce as reduce
+
+ # chaineDesVariablesInput=reduce(lambda x,y:x+','+y,l)
+ def getStrVarList(l):
+ return reduce(lambda x,y:x+', '+y, l)
+ def getStrInitClass(l):
+ return getStrVarList( map(lambda x:'self.{}={};'.format(x,x),l) )
+ def getStrReplaceVar(l):
+ return getStrVarList( map(lambda x:"'@{}@': repr(self.{})".format(x,x), l) )
+
+
wrapperDir = os.path.abspath(os.path.dirname(__file__))
wrapperName = "eficas_wrapper"
nomEtude = "monEtude"
if debug : print ('nomEtude : ', nomEtude, 'wrapperDir :', wrapperDir, 'wrapperName : ', wrapperName)
- self.txtScriptPersalys += headerScriptPersalys.format (wrapperDir, wrapperName )
- self.txtScriptPersalys += fonctionScriptPersalys.format ( self.chaineDesVariablesInput, self.chaineDesVariablesOutput )
- self.txtScriptPersalys += leMainPersalys.format (nomEtude,nomEtude,nomEtude,)
- indent = ' '
- self.txtScriptPersalys += inputHeaderPersalys.format(indent,indent)
- self.txtScriptPersalys +=self.creeTexteInputVariables(indent)
- self.txtScriptPersalys += outputHeaderPersalys.format(indent,indent)
+ self.txtScriptPersalys += headerScriptPersalys.format (
+ wrapperDir=wrapperDir,
+ wrapperName=wrapperName
+ )
+ self.txtScriptPersalys += etudeScript.format(
+ chaineDesVariablesInput =self.chaineDesVariablesInput,
+ chaineInitDesVariablesInput=getStrInitClass(self.nomsDesVariablesInput),
+ commFileStr = self.fichierUQBalise,
+ nproc = self.NbOfProcs,
+ replaceDataList = getStrReplaceVar(self.nomsDesVariablesInput)
+ )
+
+ txtFonctionPersalys = fonctionPersalys.format(
+ currentFile = self.fichierUQExe[:-3],
+ chaineDesVariablesInput =self.chaineDesVariablesInput,
+ chaineDesVariablesOutput =self.chaineDesVariablesOutput
+ )
+ self.txtScriptPersalys += codePersalys.format(
+ fonctionPersalys =txtFonctionPersalys
+ )
+
+
+ if (self.Methode == 'Taylor' ):
+ txtCentralTendencyPersalys = centralTendencyTaylor
+ optionalResult = optionalResultTaylor
+ txtResultTemp = resultTaylor
+ elif (self.Methode == 'MonteCarlo' ):
+ txtCentralTendencyPersalys = centralTendencyMC
+ optionalResult = optionalResultMC
+ txtResultTemp = resultMC
+ result=""
+ for mc in self.Result.mcListe:
+ # print('mc : ',mc)
+ # print('mc.nature : ',mc.nature)
+ # print('mc.valeur : ',mc.valeur)
+ if mc.nature == 'MCSIMP' and mc.valeur == 'yes' :
+ result+= self.indent+optionalResult[mc.nom] + '\n'
+ # print('result:',result)
+ # print('txtResultTemp:',txtResultTemp)
+ txtResult= txtResultTemp.format( optionalResult=result )
+
+ #TODO ;: Tester si Cluster== Gaia, ajouter les champs suivants
+ # resourceName = 'gaia'
+ # login='C65845'
+ # workDirectory = '/scratch/'+login+'/workingdir/persalys_light' #TODO: path.join
+ # resultDirectory = '/tmp/result_0'
+ wckey = 'P11N0:SALOME'
+
+ inFiles =[]
+ inFiles.append(os.path.join(wrapperDir,'incertainty_tools.py'))
+ pyFile = self.fichierUQExe
+ inFiles.append(os.path.join(os.getcwd(),pyFile))
+ pyFile = self.fichierUQBalise
+ inFiles.append(os.path.join(os.getcwd(),pyFile))
+ txtYacsJobParameters=yacsJobParameters.format(
+ nomEtude = self.JobName,
+ workDirectory = self.WorkDirectory,
+ resultDirectory = self.ResultDirectory,
+ resourceName = self.ResourceName,
+ nprocs = self.NbOfProcs,
+ wckey = wckey,
+ inFiles = repr(inFiles)
+ )
+
+ self.txtScriptPersalys += mainPersalys.format(
+ nomEtude=nomEtude,
+ inputVariableInitList = self.creeTexteInputVariables(self.indent),
+ outputVariableInitList = self.txtOutputVariableInitList,
+ #outputVariableInitList = '#Not yet implemented',
+ inputHeaderPersalys = inputHeaderPersalys.format(indent=self.indent),
+ chaineDesVariablesInput = self.chaineDesVariablesInput,
+ outputHeaderPersalys = outputHeaderPersalys.format(indent=self.indent),
+ chaineDesVariablesOutput = self.chaineDesVariablesOutput,
+ yacsJobParameters = txtYacsJobParameters,
+ centralTendencyPersalys = txtCentralTendencyPersalys,
+ resultPersalys = txtResult
+ )
+
+ # self.txtScriptPersalys += inputHeaderPersalys.format(indent,indent)
+ # self.txtScriptPersalys +=self.creeTexteInputVariables(indent)
+ # self.txtScriptPersalys += outputHeaderPersalys.format(indent,indent)
--- /dev/null
+# -*- coding: utf-8 -*-
+import os
+
+def value_repr_name(values):
+ """
+ Create a directory name using the representation of the values.
+ Example:
+ >>> valueReprName([0.5, 3.0 / 7.0])
+ 'c0.5_0.42857142857142855_'
+ """
+ s = "c"
+ for v in values:
+ s += repr(v) + "_"
+ return s
+
+def hashname(values):
+ """
+ Create a directory name using a hash function.
+ Example:
+ >>> hashName([0.5, 3.0 / 7.0])
+ '6f454e45e9a4fa8856688e80de6bfc58'
+ """
+ import hashlib
+ h = hashlib.md5(repr(values))
+ return h.hexdigest()
+
+def temp_dirname():
+ """
+ Create a temporary directory in the current directory.
+ """
+ import tempfile
+ return tempfile.mkdtemp(dir=os.getcwd())
+
+def replace_data(filename, key_values):
+ """
+ Modify an input file using replace function.
+ Example:
+ origin file: "CPHY_MAT_ISO= $rho $cp $lambda -1 "
+ key_values: {'$rho':'3', '$cp':'5', '$lambda':7}
+ modified file: "CPHY_MAT_ISO= 3 5 7 -1"
+ """
+ with open(filename,'r') as f:
+ filedata = f.read()
+ for key,value in key_values.items():
+ filedata = filedata.replace(key,value)
+ with open(filename,'w') as f:
+ f.write(filedata)
+
+def format_data(filename, key_values):
+ """
+ Modify an input file using format function.
+ Example:
+ origin file: "CPHY_MAT_ISO= {rho} {cp} {lambda} -1 "
+ key_values: {'rho':'3', 'cp':'5', 'lambda':'7'}
+ modified file: "CPHY_MAT_ISO= 3 5 7 -1"
+ """
+ with open(filename,'r') as f:
+ filedata = f.read()
+ filedata = filedata.format(**key_values)
+ with open(filename,'w') as f:
+ f.write(filedata)
+
# nom de l etude, nom de l etude, nom de l etude, path pour wrapper, wrapper, nom de la fonction
#sys.path[:0]=[{}]
-headerScriptPersalys = """#! /usr/bin/env python
-# ----------------------------------------------
-# Script genere pour lancement Etude Probabiliste
-# ----------------------------------------------
+headerScriptPersalys = """#! /usr/bin/env python3
+# coding: utf-8
+# --------------------------------------------------------------------------
+# Script Eficas genere pour lancement Etude Probabiliste
+# ---------------------------------------------------------------------------
+# Utilisation standalone avec salome :
+# salome shell -- python3 mon_fichier.py
# Chargement du module systeme
-import sys,os
-# Chargement du module OpenTURNS
+import sys
+import os
+
+# Chargement du module OpenTURNS #TODO : Parametrer OpenTurns/Uranie
import openturns
import persalys
-# Chargement de Eficas Wrapper
-from {} import {}
+
+# Chargement de incertainty_tools
+from incertainty_tools import value_repr_name, replace_data, format_data
+# from {wrapperDir} import {wrapperName}
"""
+
+# def run_case(self):
+# """
+# Launch the calculation once the case files are ready.
+# """
+# command = './run.sh '
+# command += './syrthes.py -n ' + str(self.nproc) + ' -d ' + self.comm_file
+# command += ' >' + os.path.join(self.workdir, "std.log")
+# command += ' 2>' + os.path.join(self.workdir, "err.log")
+# os.system(command)
+# pass
+
+
# ----------------------------------
-# fonctionScriptPersalys
-fonctionScriptPersalys = """def _exec({}):
-# ---------------------
+# etudeScript
+etudeScript = """
+class Study:
+ def __init__(self, {chaineDesVariablesInput}):
+ {chaineInitDesVariablesInput}
+
+ #TODO : Définir un décorateur pour sélectionner la fonction voulue
+ def define_workdirectory(self):
+ self.workdir = valueReprName( [{chaineDesVariablesInput}])
+
+ def case_exists(self):
+ ok = True
+ if os.path.isdir(self.workdir):
+ try:
+ ok = False #TODO
+ except:
+ ok = False
+ else:
+ ok = False
+ return ok
+
+ def prepare_case(self):
+ import shutil
+
+ if not os.path.isdir(self.workdir):
+ os.mkdir(self.workdir)
+
+ #section spécifique au code de calcul
+ comm_file = {commFileStr}
+
+ self.nproc = {nproc}
+ self.comm_file=os.path.join(self.workdir, comm_file)
+
+ shutil.copy(comm_file, self.comm_file)
+ replace_data(self.comm_file, {{ {replaceDataList} }})
+ pass
-# A completer
+ def get_results(self):
+ # return self.extract_probe(2,2), self.extract_balance(2, 2)
+ return None, None
- return {}
"""
+# ------------------------
+# fonctionPersalys
+# ------------------------
+fonctionPersalys = """
+def _exec({chaineDesVariablesInput}):
+
+ from {currentFile} import Study
+
+ study = Study({chaineDesVariablesInput})
+ study.define_workdirectory()
+ if not study.case_exists():
+ study.prepare_case()
+ study.run_case()
+ {chaineDesVariablesOutput} = study.get_results()
+
+ return {chaineDesVariablesOutput}
+"""
+
+# ------------------------
+# codePersalys
+# ------------------------
+codePersalys = """
+code = '''
+{fonctionPersalys}
+'''
+"""
+
+# ----------------------------
+# inputHeaderPersalys
+# ----------------------------
inputHeaderPersalys = """
-{}# definition des Inputs
-{}# ---------------------
+{indent}# definition des Inputs
+{indent}# ---------------------
"""
-inputPersalysUniform='{}{} = persalys.Input({}, {})'
-inputPersalys='{}{} = persalys.Input({}, {})'
+# inputPersalysUniform='{}{} = persalys.Input({}, {})'
+#inputPersalys='{}{} = persalys.Input({}, {})'
+
+# ------------------------------
+# ouputHeaderPersalys
+# ------------------------------
outputHeaderPersalys = """
-{}# definition des Outputs
-{}# ----------------------
+{indent}# definition des Outputs
+{indent}# ----------------------
"""
-
-leMainPersalys="""
+# ------------------
+# mainPersalys
+# ------------------
+mainPersalys="""
# ------------------
# definition du main
# ------------------
if __name__ == '__main__':
- {} = persalys.Study('{}')
- persalys.Study.Add({})
+
+ {nomEtude} = persalys.Study('{nomEtude}')
+ persalys.Study.Add({nomEtude})
+
+{inputVariableInitList}
+{outputVariableInitList}
+
+{inputHeaderPersalys}
+ inputs = [{chaineDesVariablesInput}]
+
+{outputHeaderPersalys}
+ outputs = [{chaineDesVariablesOutput}]
+
+ yacsPhysicalModel = persalys.YACSPhysicalModel('PhysicalModel', inputs, outputs, code)
+{yacsJobParameters}
+ {nomEtude}.add(yacsPhysicalModel)
+
+{centralTendencyPersalys}
+ Study.add(centralTendency)
+
+ centralTendency.run()
+
+{resultPersalys}
+
"""
# a = persalys.Input('a', 0, '')
# b = persalys.Input('b', 0, '')
# outputs = [d]
+centralTendencyTaylor ="""
+ centralTendency = persalys.TaylorExpansionMomentsAnalysis('centralTendencyTaylor', yacsPhysicalModel)
+"""
+
+#Les retours sont des listes de taille <nombre de variables de sortie>
+resultTaylor="""
+ result = centralTendency.getResult()
+{optionalResult}
+"""
+optionalResultTaylor={
+ 'MeanFirstOrder' : 'meanFirstOrder=result.getMeanFirstOrder()',
+ 'StandardDeviationFirstOrder' : 'standardDeviationFirstOrder=result.getStandardDeviation()',
+ 'MeanSecondOrder' : 'meanSecondOrder=result.getMeanSecondOrder()',
+ 'Variance' : 'variance=result.getVariance()'
+}
+
+centralTendencyMC ="""
+ centralTendency = persalys.MonteCarloAnalysis('centralTendencyMC', yacsPhysicalModel)
+ centralTendency.setMaximumCoefficientOfVariation({CoefficientOfVariation})
+ centralTendency.setMaximumElapsedTime({MaximumElapsedTime})
+ centralTendency.setMaximumCalls({MaximumCalls})
+ centralTendency.setBlockSize({BlockSize})
+ centralTendency.setSeed({Seed})
+"""
+
+#TODO: Demander à Liana cf:eficas
+resultMC="""
+ result = centralTendency.getResult()
+{optionalResult}
+"""
+optionalResultMC={
+ 'EmpiricalMean' : 'empiricalMean = result.getMean()', #TOCHECK
+ 'Variance' : 'variance = result.getVariance()',
+ 'EmpiricalStandardDeviation' : '#Not Implemented',
+ 'EmpiricalQuantile' : '#Not Implemented',
+ 'EmpiricalQuantile_Order' : '#Not Implemented'
+}
+
+yacsJobParameters="""
+ yacsPhysicalModel.jobParameters().salome_parameters.job_name = '{nomEtude}'
+ yacsPhysicalModel.jobParameters().salome_parameters.work_directory = '{workDirectory}'
+ yacsPhysicalModel.jobParameters().salome_parameters.result_directory = '{resultDirectory}'
+ yacsPhysicalModel.jobParameters().salome_parameters.resource_required.name = '{resourceName}'
+ yacsPhysicalModel.jobParameters().salome_parameters.resource_required.nb_proc = '{nprocs}'
+ yacsPhysicalModel.jobParameters().salome_parameters.wckey = '{wckey}'
+ yacsPhysicalModel.jobParameters().salome_parameters.in_files = {inFiles} # Chemins des fichiers locaux à copier dans work_directory
+ yacsPhysicalModel.jobParameters().nb_branches = '{nprocs}' # nombre de jobs parallèles
+"""
+
+yacsJobParametersRef="""
+yacsPhysicalModel.jobParameters().salome_parameters.job_name = '{nomEtude}_idefix_job'
+yacsPhysicalModel.jobParameters().salome_parameters.work_directory = '/scratch/C65845/workingdir/persalys_light'
+yacsPhysicalModel.jobParameters().salome_parameters.result_directory = '/tmp/local_result'
+yacsPhysicalModel.jobParameters().salome_parameters.resource_required.name = 'gaia'
+yacsPhysicalModel.jobParameters().salome_parameters.resource_required.nb_proc = 1
+yacsPhysicalModel.jobParameters().salome_parameters.wckey = 'P11N0:SALOME'
+yacsPhysicalModel.jobParameters().salome_parameters.in_files = [] # Chemins des fichiers locaux à copier dans work_directory
+yacsPhysicalModel.jobParameters().nb_branches = 3 # nombre de jobs parallèles
+
+# Ces 4 lignes permettent de modifier le mode d'évaluation par défaut qui est
+# d'avoir toutes les évaluations dans un seul job.
+import pydefx
+import os
+myModel = pydefx.MultiJobStudy() # mode un job par évaluation
+
+PhysicalModel.setJobModel(myModel)
+"""
+
+
if __name__ == "__main__":
pass