From e8bc96f218124f2450143250220ecc6e523e3110 Mon Sep 17 00:00:00 2001 From: Pascale Noyret Date: Fri, 9 Apr 2010 08:30:11 +0000 Subject: [PATCH] *** empty log message *** --- .../configuration_OPENTURNS_WRAPPER.py | 19 ++++++++++--- generator/OpenturnsSTD.py | 28 ++++++++++--------- generator/generator_SEP.py | 2 +- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/Openturns_Wrapper/configuration_OPENTURNS_WRAPPER.py b/Openturns_Wrapper/configuration_OPENTURNS_WRAPPER.py index d4c09342..a2159a07 100644 --- a/Openturns_Wrapper/configuration_OPENTURNS_WRAPPER.py +++ b/Openturns_Wrapper/configuration_OPENTURNS_WRAPPER.py @@ -59,7 +59,9 @@ class CONFIG: else: self.parent=None - self.labels=("OpenTURNS_path","rep_user","INSTALLDIR","path_doc","exec_acrobat","rep_cata","initialdir","savedir") + self.labels_user=('exec_acrobat', 'catalogues','savedir','path_doc','OpenTURNS_path') + self.labels_eficas=("OpenTURNS_path","rep_user","INSTALLDIR","path_doc","exec_acrobat","rep_cata","initialdir","savedir","catalogues") + #self.labels=("OpenTURNS_path","rep_user","INSTALLDIR","path_doc","exec_acrobat","rep_cata","initialdir","savedir") # Valeurs par defaut self.rep_user = os.path.join(os.environ['HOME'],'.Eficas_Openturns') @@ -88,7 +90,7 @@ class CONFIG: name='prefs_'+prefs.code prefsCode=__import__(name) self.prefsUser=name+".py" - for k in self.labels : + for k in self.labels_eficas : try : valeur=getattr(prefsCode,k) setattr(self,k,valeur) @@ -115,7 +117,7 @@ class CONFIG: QMessageBox.critical( None, "Import du fichier de Configuration", "Erreur à la lecture du fichier de configuration " + self.fic_ini_utilisateur ) sys.exit(0) - for k in self.labels : + for k in self.labels_user : try : setattr(self,k,d[k]) except : @@ -167,7 +169,16 @@ class CONFIG: # sauvegarde # les nouveaux paramètres dans le fichier de configuration utilisateur # - print "a ecrire PNPNPN" + texte="" + for clef in self.labels_user : + if hasattr(self,clef): + valeur=getattr(self,clef) + texte= texte + clef+" = " + repr(valeur) +"\n" + f=open(self.fic_ini_utilisateur,'w+') + print self.fic_ini_utilisateur + f.write(texte) + f.close() +# print "a ecrire PNPNPN" # l_param=('exec_acrobat', 'repIni','catalogues','rep_travail','rep_mat','path_doc') # texte="" # for clef in l_param : diff --git a/generator/OpenturnsSTD.py b/generator/OpenturnsSTD.py index f25c773c..7b845bcb 100644 --- a/generator/OpenturnsSTD.py +++ b/generator/OpenturnsSTD.py @@ -373,19 +373,21 @@ class STDGenerateur : ''' txt = "# Definit la copule de la loi jointe\n" - if ( self.DictMCVal.has_key( 'Copula' ) ): - if ( self.DictMCVal[ 'Copula' ] in ( 'Independent', ) ): - txt += "%s = IndependentCopula( %s )\n" % (self.variable["copula"], self.variable["n"]) - elif ( self.DictMCVal[ 'Copula' ] in ( 'Normal', ) ): - varList = self.DictMCVal[ 'CorrelationMatrix' ][0] - dimension = len(varList) - txt += "%s = {}\n" % self.variable["correlation"] - for i in range( dimension ): - txt += "%s['%s'] = {}\n" % (self.variable["correlation"], varList[i]) - for j in range ( dimension ): - txt += "%s['%s']['%s'] = %g\n" % (self.variable["correlation"], varList[i], varList[j], self.DictMCVal[ 'CorrelationMatrix' ][i+1][j]) - txt += "%s = getCorrelationMatrixFromMap( %s.getVariableList(), %s )\n" % (self.variable["R"], self.variable["wrapperdata"], self.variable["correlation"]) - txt += "%s = NormalCopula( %s )\n" % (self.variable["copula"], self.variable["R"]) + if ( not self.DictMCVal.has_key( 'Copula' ) ): + self.DictMCVal[ 'Copula' ] = 'Independent' + + if ( self.DictMCVal[ 'Copula' ] in ( 'Independent', ) ): + txt += "%s = IndependentCopula( %s )\n" % (self.variable["copula"], self.variable["n"]) + elif ( self.DictMCVal[ 'Copula' ] in ( 'Normal', ) ): + varList = self.DictMCVal[ 'CorrelationMatrix' ][0] + dimension = len(varList) + txt += "%s = {}\n" % self.variable["correlation"] + for i in range( dimension ): + txt += "%s['%s'] = {}\n" % (self.variable["correlation"], varList[i]) + for j in range ( dimension ): + txt += "%s['%s']['%s'] = %g\n" % (self.variable["correlation"], varList[i], varList[j], self.DictMCVal[ 'CorrelationMatrix' ][i+1][j]) + txt += "%s = getCorrelationMatrixFromMap( %s.getVariableList(), %s )\n" % (self.variable["R"], self.variable["wrapperdata"], self.variable["correlation"]) + txt += "%s = NormalCopula( %s )\n" % (self.variable["copula"], self.variable["R"]) txt += "\n" return txt diff --git a/generator/generator_SEP.py b/generator/generator_SEP.py index db3ea13b..0c306db5 100644 --- a/generator/generator_SEP.py +++ b/generator/generator_SEP.py @@ -93,7 +93,7 @@ class SEPGenerator(PythonGenerator): """ Les paramètres sont transcrits sous la forme d'un dictionnaire nom=valeur. """ - from Sous_epaisseur import properties + from Sep import properties self.texteTubePy="# -*- coding: utf-8 -*-\n" self.texteTubePy+="# ======================================================================================\n" self.texteTubePy+="# FICHIER GENERE PAR EFICAS - OUTIL MÉTIER SOUS-EPAISSEUR - " -- 2.39.2