From: Eric Fayolle Date: Tue, 5 Jul 2022 20:52:43 +0000 (+0200) Subject: Gestion des fonctions dagrégation multiples corrections diverses X-Git-Tag: merge_uncertainty_odysee_1210~43 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=05022d016a5a7949c0f0a2fb4e23d852c466f2e1;p=tools%2Feficas.git Gestion des fonctions dagrégation multiples corrections diverses --- diff --git a/generator/generator_UQ.py b/generator/generator_UQ.py index 87356ef2..27499aae 100644 --- a/generator/generator_UQ.py +++ b/generator/generator_UQ.py @@ -181,34 +181,45 @@ class UQGenerator(PythonGenerator): self.txtGetAllResults = "" #TODO? from cata_UQ import FonctionDAggregationDict fctAggPy={ - 'valeur à t=O':'vIninialTime', - 'valeur à mi-temps':'vHalfTtime', + 'valeur à t=O':'vInitialTime', + 'valeur à mi-temps':'vHalfTime', 'valeur à t final':'vFinalTime', - 'valeur moyenne':'mean', - 'valeur cumulée':'sum', - 'valeur minimale':'min', - 'valeur maximale':'max' + 'valeur moyenne':'vMean', + 'valeur cumulée':'vSum', + 'valeur minimale':'vMin', + 'valeur maximale':'vMax' } for mc in self.lesVariablesOutput : + nomFctAggPyList='' + nomOutputList='' nomVar = mc.getChildOrChildInBloc('VariablePhysique').valeur nomVarEncode = nomVar.replace(' ','__') nomVarPostraite = mc.getChildOrChildInBloc('VariablePosttraiteeAssociee').valeur nomFctAggList = mc.getChildOrChildInBloc('FonctionDAggregation').valeur for nomFctAgg in nomFctAggList: nomFctAggPy = fctAggPy[nomFctAgg] + nomFctAggPyList += nomFctAggPy + ', ' nomOutput=nomVarEncode+'_'+nomFctAggPy + nomOutputList += nomOutput + ', ' self.chaineDesVariablesOutputEncodee+=nomOutput+ ', ' variablesOutputDesc = nomFctAgg+'('+nomVarPostraite+')' - tmpGetResultCall = getResultCall.format( - variableOutput = nomOutput, - variablePostraitee = nomVarPostraite, - fonctionAggregation = nomFctAggPy - ) - self.txtGetAllResults += tmpGetResultCall + # tmpGetResultCall = getResultCall.format( + # variableOutput = nomOutput, + # postProcessedVar = nomVarPostraite, + # fonctionAggregation = nomFctAggPy + # ) self.txtOutputVariableInitList += self.indent1 + nomOutput + " = persalys.Output('"+ nomVar+' (Agg: '+nomFctAgg+')' + "', '"+variablesOutputDesc + "')\n" + tmpGetResultCall = getResultCall.format( + variableOutputList = nomOutputList[0:-2], + nomVarPostraite = nomVarPostraite, + fonctionAggregationList = nomFctAggPyList[0:-2] + ) + self.txtGetAllResults += tmpGetResultCall + self.chaineDesVariablesOutputEncodee=self.chaineDesVariablesOutputEncodee[0:-2] - + + sectionExecution = etapeIncertitude.getChildOrChildInBloc('Execution')[0] self.ExecutionMode = sectionExecution.getChildOrChildInBloc('ExecutionMode').valeur self.NbOfProcs = sectionExecution.getChildOrChildInBloc('NbOfProcs').valeur @@ -359,6 +370,8 @@ class UQGenerator(PythonGenerator): inFiles.append(os.path.join(os.getcwd(),pyFile)) scriptFile = "ib_test.sh" inFiles.append(os.path.join(os.getcwd(),scriptFile)) + postFile = "post_csv.py" + inFiles.append(os.path.join(os.getcwd(),postFile)) txtYacsJobParameters=yacsJobParameters.format( nomEtude = self.JobName, workDirectory = self.WorkDirectory, diff --git a/generator/textePersalys.py b/generator/textePersalys.py index 0e3d92cc..21f69cab 100644 --- a/generator/textePersalys.py +++ b/generator/textePersalys.py @@ -97,10 +97,13 @@ class Study: pass - def get_result(self,postProcessedVar, aggregationFct): - from post_cvs import get_result_from_csv + def get_result_from_csv(self,postProcessedVar, aggregationFctList): + from post_csv import get_result_from_csv + #Fonctions a implementer dans un fichier post_csv pour définir + #comment l'aggrégation des valeurs peut se faire + from post_csv import vInitialTime, vHalfTime, vFinalTime, vMean, vSum, vMin, vMax print('--------------------------------------- 4 ---------------------------------------') - return get_result_from_csv(postProcessedVar, aggregationFct) + return get_result_from_csv(postProcessedVar, aggregationFctList) def run_case(self): print('--------------------------------------- 5 ---------------------------------------') @@ -115,7 +118,7 @@ class Study: # /home/C65845/VIMMP/Banc_integration.newer_odysee/environment/bin/python3 /home/C65845/VIMMP/Banc_integration.newer_odysee/environment/bin/ib-run --cocagne-neutro-solver SPN --cocagne-thermo-solver THERMOMI/TRMIC -- /home/C65845/VIMMP/Banc_integration.newer_odysee/integration_bench/tests/control_rod_ejection_small_core_cathare3_cocagne.comm /home/C65845/VIMMP/Banc_integration.newer_odysee/integration_bench/tests/control_rod_ejection_small_core_cathare3_cocagne_spn_thermomi-trmic_serial -getResultCall=""" {variableOutput} = study.get_result('{variablePostraitee}', {fonctionAggregation} ) +getResultCall=""" {variableOutputList} = study.get_result_from_csv( '{nomVarPostraite}', [{fonctionAggregationList}] ) """ #------------------------- @@ -123,6 +126,8 @@ getResultCall=""" {variableOutput} = study.get_result('{variablePostraitee}', # ------------------------ fonctionPersalys = """ def _exec({chaineDesVariablesInput}): + from post_csv import vInitialTime, vHalfTime, vFinalTime, vMean, vSum, vMin, vMax + print('--------------------------------------- 00 ---------------------------------------') from {currentFile} import Study