From 05022d016a5a7949c0f0a2fb4e23d852c466f2e1 Mon Sep 17 00:00:00 2001 From: Eric Fayolle Date: Tue, 5 Jul 2022 22:52:43 +0200 Subject: [PATCH] =?utf8?q?Gestion=20des=20fonctions=20dagr=C3=A9gation=20m?= =?utf8?q?ultiples=20corrections=20diverses?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- generator/generator_UQ.py | 39 +++++++++++++++++++++++++------------- generator/textePersalys.py | 13 +++++++++---- 2 files changed, 35 insertions(+), 17 deletions(-) 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 -- 2.39.2