From 2387e57a342c600e0ed8ec7da8debf91c9bd60d4 Mon Sep 17 00:00:00 2001 From: Eric Fayolle Date: Fri, 16 Sep 2022 15:49:10 +0200 Subject: [PATCH] =?utf8?q?Correction=20de=20la=20g=C3=A9n=C3=A9ration=20du?= =?utf8?q?=20script=20UQ=20lors=20de=20la=20selection=20d'une=20seule=20fo?= =?utf8?q?nction=20d'aggr=C3=A9gation?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- InterfaceQT4/qtEficas.py | 10 +++++----- generator/generator_XML.py | 8 ++++---- generator/textePersalys.py | 39 ++++++++++++++------------------------ 3 files changed, 23 insertions(+), 34 deletions(-) diff --git a/InterfaceQT4/qtEficas.py b/InterfaceQT4/qtEficas.py index 25828365..f1565d20 100755 --- a/InterfaceQT4/qtEficas.py +++ b/InterfaceQT4/qtEficas.py @@ -257,11 +257,11 @@ class Appli(AppliSsIhm,Ui_Eficas,QMainWindow): self.menuUQ.addAction(self.actionSaveUQ) self.actionSaveUQ.triggered.connect(self.handleSortieUQ) self.actionExeUQ = QAction(self) - self.actionExeUQ.setText(tr("Lancement de l etude")) - self.menuUQ.addAction(self.actionExeUQ) - self.actionExeUQ.triggered.connect(self.handleExeUQ) - self.actionEnregistrer.setDisabled(True) - self.actionEnregistrer_sous.setDisabled(True) + #self.actionExeUQ.setText(tr("Lancement de l etude")) + #self.menuUQ.addAction(self.actionExeUQ) + #self.actionExeUQ.triggered.connect(self.handleExeUQ) + #self.actionEnregistrer.setDisabled(True) + #self.actionEnregistrer_sous.setDisabled(True) def ajoutN1(self): return diff --git a/generator/generator_XML.py b/generator/generator_XML.py index 05c3f0ae..dbaa4d8a 100644 --- a/generator/generator_XML.py +++ b/generator/generator_XML.py @@ -56,11 +56,11 @@ class XMLGenerator(PythonGenerator): #---------------------------------------------------------------------------------------- def gener(self,obj,format='brut',config=None,appliEficas=None): - try : - #if 1 : + #try : + if 1 : self.texteXML=obj.toXml() - except : - self.texteXML='Erreur a la generation du fichier XML' + #except : + # self.texteXML='Erreur a la generation du fichier XML' #print (self.texteXML) # pass diff --git a/generator/textePersalys.py b/generator/textePersalys.py index 01c639e2..d77e5ef4 100644 --- a/generator/textePersalys.py +++ b/generator/textePersalys.py @@ -42,20 +42,14 @@ import persalys etudeScript = """ class Study: import os - #print('dir() 0 : ', dir()) import subprocess - #print('dir() 0b : ', dir()) -# from incertainty_tools import value_repr_name, replace_data, format_data def __init__(self, {chaineDesVariablesInput}): - ##print('--------------------------------------- 0 ---------------------------------------') {chaineInitDesVariablesInput} def do_sh(self, command, execdir=os.getcwd()): - #print('dir() 1 : ', dir()) - print('execdir 1 : ', execdir) + print('Execution directory is : ', execdir) import subprocess - #print('dir() 2 : ', dir()) sh = subprocess.Popen(command, shell=True, cwd=execdir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) @@ -65,11 +59,9 @@ class Study: #TODO : Définir un décorateur pour sélectionner la fonction voulue def define_workdirectory(self): from incertainty_tools import value_repr_name - #print('--------------------------------------- 1 ---------------------------------------') self.workdir = value_repr_name([{chaineSelfDesVariablesInput}]) def case_exists(self): - #print('--------------------------------------- 2 ---------------------------------------') ok = True if os.path.isdir(self.workdir): try: @@ -82,7 +74,6 @@ class Study: def prepare_case(self): from incertainty_tools import replace_data - #print('--------------------------------------- 3 ---------------------------------------') import shutil if not os.path.isdir(self.workdir): @@ -99,16 +90,16 @@ class Study: self.comm_file_uq_comm = os.path.join(self.workdir, '{commFileUQComm}') replace_data(self.comm_file_uq_balise, {{ {replaceDataList} }} , self.comm_file_uq_comm) - #TODO: Lancer la validation du fichier généré avant tout lancement + #TODO: Lancer la validation du fichier généré avant tout lancement : Le banc le fait pass def get_result_from_csv(self,postProcessedVar, aggregationFctList): from post_csv_rn 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 + #TODO: Fonctions a implementer dans un fichier post_csv provenant + # de la mise en donnée pour définir la façon d'aggréger les valeurs from post_csv_rn import vInitialTime, vHalfTime, vFinalTime, vMean, vSum, vMin, vMax - #print('--------------------------------------- 4 ---------------------------------------') + savdir=os.getcwd() os.chdir(self.workdir) results = get_result_from_csv(postProcessedVar, aggregationFctList) @@ -116,20 +107,21 @@ class Study: return results def run_case(self): - #print('--------------------------------------- 5 ---------------------------------------') #os.chdir(self.workdir) # Si lancement mpi externe à ib_test.sh il faut utiliser self.nproc : mpiexec -n self.nproc ib_test.sh o,e,c = self.do_sh(command="ib_test.sh", execdir=self.workdir) - if o != None : print('o.decode() : ',o.decode()) - if e != None : print('e.decode() : ',e.decode()) - print(c) - + if o != None : print(o.decode()) + if e != None : print(e.decode()) """ # /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=""" {variableOutputList} = study.get_result_from_csv( '{nomVarPostraite}', [{fonctionAggregationList}] ) +# getResultCall=""" {variableOutputList}, = study.get_result_from_csv( '{nomVarPostraite}', [{fonctionAggregationList}] ) +# """ + +getResultCall=""" {variableOutputList}, = study.get_result_from_csv( '{nomVarPostraite}', [{fonctionAggregationList}] ) + print( '{nomVarPostraite}: ({variableOutputList})',{variableOutputList}) """ #------------------------- @@ -138,9 +130,6 @@ getResultCall=""" {variableOutputList} = study.get_result_from_csv( '{nomVarP fonctionPersalys = """ def _exec({chaineDesVariablesInput}): from post_csv_rn import vInitialTime, vHalfTime, vFinalTime, vMean, vSum, vMin, vMax - - #print('--------------------------------------- 00 ---------------------------------------') - from {currentFile} import Study study = Study({chaineDesVariablesInput}) @@ -210,8 +199,9 @@ if __name__ == '__main__': {centralTendencyPersalys} {nomEtude}.add(centralTendency) - centralTendency.run() +################ CUT THE FILE HERE IF YOU WANT TO IMPORT IT IN THE SALOME PERSALYS MODULE ################ + centralTendency.run() {resultPersalys} """ @@ -263,7 +253,6 @@ advancedParameterMC = { 'ComputeConfidenceIntervalAt' : 'centralTendency.setLevelConfidenceInterval({ComputeConfidenceIntervalAt})' } -#TODO: Demander à Liana cf:eficas #TODO: Associer les noms de variables au résultat resultMC=""" result = centralTendency.getResult() -- 2.39.2