--- /dev/null
+# -*- coding: utf-8 -*-
+# CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+#
+#
+# ======================================================================
+from Noyau import N_REGLE
+from Ihm import I_REGLE, I_AVANT
+
+class AVANT(I_AVANT.I_AVANT,I_REGLE.REGLE,N_REGLE.REGLE):
+ """
+ La classe utilise l'initialiseur de REGLE. Il n'est pas
+ nécessaire d'expliciter son initialiseur car
+ I_AVANT.I_AVANT n'en a pas
+ """
from A_EXCLUS import EXCLUS
from A_ENSEMBLE import ENSEMBLE
from A_A_CLASSER import A_CLASSER
+from A_AVANT import AVANT
from A_ASSD import ASSD,assd
from A_ASSD import GEOM,geom
from A_VALIDATOR import OrdList,NoRepeat,LongStr,Compulsory
from A_VALIDATOR import RangeVal, EnumVal, TypeVal, PairVal
from A_VALIDATOR import CardVal, InstanceVal
-#from A_VALIDATOR import VerifTypeTuple
+from A_VALIDATOR import VerifTypeTuple
# On remplace la factory des validateurs initialement dans Noyau par celle
# de A_VALIDATOR
--- /dev/null
+# -*- coding: utf-8 -*-
+# CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+#
+#
+# ======================================================================
+"""
+ Ce module sert pour charger les paramètres de configuration d'EFICAS
+"""
+# Modules Python
+import os, sys, string, types, re
+import traceback
+
+
+# Modules Eficas
+from Editeur import utils
+
+class CONFIGbase:
+
+ #-----------------------------------
+ def __init__(self,appli):
+ #-----------------------------------
+
+ # Classe de base permettant de lire, afficher
+ # et sauvegarder les fichiers utilisateurs editeur.ini
+ # et style.py
+ # Classe Mere de : class CONFIG(CONFIGbase)
+ # class CONFIGStyle(CONFIGbase):
+ self.appli = appli
+ self.salome = appli.salome
+ self.dRepMat={}
+ if self.appli:
+ self.parent=appli.top
+ else:
+ self.parent=None
+ self.rep_user = utils.get_rep_user()
+ self.lecture_fichier_ini_standard()
+ self.lecture_catalogues_standard()
+ self.lecture_fichier_ini_utilisateur()
+ self.init_liste_param()
+
+ #--------------------------------------
+ def lecture_fichier_ini_standard(self):
+ #--------------------------------------
+ # Verifie l'existence du fichier "standard"
+ # appelle la lecture de ce fichier
+ if not os.path.isfile(self.fic_ini):
+ if self.appli.ihm=="TK" :
+ from widgets import showerror
+ showerror("Erreur","Pas de fichier de configuration" + self.fic_ini+"\n")
+ print "Erreur à la lecture du fichier de configuration : %s" % self.fic_ini
+ sys.exit(0)
+ self.lecture_fichier(self.fic_ini)
+
+ #-----------------------------
+ def lecture_fichier(self,fic):
+ #------------------------------
+ # lit les paramètres du fichier eficas.ini ou style.py
+ # les transforme en attribut de l 'objet
+ # utilisation du dictionnaire local pour récuperer style
+ txt = utils.read_file(fic)
+ from styles import style
+ d=locals()
+ try:
+ exec txt in d
+ except:
+ l=traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2])
+ if self.appli.ihm=="TK" :
+ from widgets import showerror
+ showerror("Erreur","Une erreur s'est produite lors de la lecture du fichier : " + fic + "\n")
+ print ("Erreur","Une erreur s'est produite lors de la lecture du fichier : " + fic + "\n")
+ sys.exit()
+
+ for k in d.keys() :
+ if k in self.labels.keys() :
+ setattr(self,k,d[k])
+ # Glut horrible pour les repertoires materiau...
+ elif k[0:9]=="rep_mat_v" :
+ setattr(self,k,d[k])
+
+ for k in d['style'].__dict__.keys() :
+ setattr(self,k,d['style'].__dict__[k])
+
+ if hasattr(self,"catalogues") :
+ for ligne in self.catalogues :
+ version=ligne[1]
+ codeSansPoint=re.sub("\.","",version)
+ chaine="rep_mat_"+codeSansPoint
+ if hasattr(self,chaine):
+ rep_mat=getattr(self,chaine)
+ self.dRepMat[version]=str(rep_mat)
+
+
+ #--------------------------------------
+ def lecture_fichier_ini_utilisateur(self):
+ #--------------------------------------
+ # Surcharge les paramètres standards par les paramètres utilisateur s'ils existent
+ self.fic_ini_utilisateur = os.path.join(self.rep_user,self.fichier)
+ if not os.path.isfile(self.fic_ini_utilisateur):
+ return
+ self.lecture_fichier(self.fic_ini_utilisateur)
+
+ #--------------------------------------
+ def lecture_catalogues_standard(self):
+ #--------------------------------------
+ # repertoires Materiau
+ if hasattr(self,"catalogues") :
+ for ligne in self.catalogues :
+ version=ligne[1]
+ cata=ligne[2]
+ self.dRepMat[version]=os.path.join(cata,'materiau')
+
+ #--------------------------------------
+ def affichage_fichier_ini(self):
+ #--------------------------------------
+ """
+ Affichage des valeurs des paramètres relus par Eficas
+ """
+ import widgets
+ result = widgets.Formulaire(self.parent,
+ obj_pere = self,
+ titre = self.titre,
+ texte = self.texte_ini,
+ items = self.l_param,
+ mode='display',
+ commande=('Modifier',self.commande))
+ if result.resultat :
+ #print 'on sauvegarde les nouveaux paramètres :',result.resultat
+ self.save_param_ini(result.resultat)
+
+ #--------------------------------------
+ def save_param_ini(self,dico):
+ #--------------------------------------
+ # sauvegarde
+ # les nouveaux paramètres dans le fichier de configuration utilisateur
+ #
+ f=open(self.fic_ini_utilisateur,'w+')
+ for k,v in dico.items():
+ if self.types[k] in ('mot2','mot3','mot4'):
+ v1=v[1:-1]
+ val=v1.split(",")
+ p = "("
+ listeval=""
+ for valeur in val:
+ listeval = listeval+ p + str(valeur)
+ p=" , "
+ listeval = listeval + ")"
+ f.write(str(self.pref)+str(k) + '=' + str(listeval) + '\n')
+ elif k == 'catalogues' :
+ f.write(k + '\t=\t' + str(v) + '\n')
+ else:
+ f.write(str(self.pref)+str(k) + '\t=\t"' + str(v) + '"\n')
+ f.close()
+ self.lecture_fichier_ini_utilisateur()
+
+ #-------------------------------------------
+ def creation_fichier_ini_si_possible(self):
+ #-------------------------------------------
+ return self.creation_fichier_ini(mode='ignorer_annuler')
+
+ #--------------------------------------------------------
+ def creation_fichier_ini(self,mode='considerer_annuler'):
+ #---------------------------------------------------------
+ # Récupération des valeurs des paramétres requis pour la création du fichier
+ # eficas.ini
+ #
+ import widgets
+ items = self.l_param
+ result = widgets.Formulaire(self.parent,
+ obj_pere = self,
+ titre = "Saisie des donnees indispensables a la configuration d'EFICAS",
+ texte = self.texte,
+ items = items,
+ mode='query')
+ if not result.resultat :
+ if mode == 'considerer_annuler':
+ test=0
+ if self.appli.ihm=="TK" :
+ from widgets import showerror,askretrycancel
+ test = askretrycancel("Erreur","Données incorrectes !")
+ if not test:
+ # XXX On sort d'EFICAS, je suppose
+ self.appli.exitEFICAS()
+ else:
+ self.creation_fichier_ini()
+ else:
+ return None
+ else :
+ self.save_param_ini(result.resultat)
+ return result.resultat
+
+ #--------------------------
+ def init_liste_param (self):
+ #--------------------------
+ # construit self.l_param
+ # a partir de self.labels et des attributs
+ # de l objet (mis a jour lors de la lecture du fichier)
+ # l_param est une liste de tuples où chaque tuple est de la forme :
+ # (label,nature,nom_var,defaut)
+
+ self.l_param=[]
+ for k in self.labels.keys() :
+ if hasattr(self,k) :
+ if k in self.YesNo.keys():
+ self.l_param.append((self.labels[k],self.types[k],k,self.__dict__[k],
+ self.YesNo[k][0],self.YesNo[k][1]))
+ else :
+ self.l_param.append((self.labels[k],self.types[k],k,self.__dict__[k]))
+ self.l_param = tuple(self.l_param)
+
+
+class CONFIG(CONFIGbase):
+ def __init__(self,appli,repIni):
+
+ self.dFichierEditeur={"ASTER" : "editeur.ini",
+ "ASTER_SALOME" : "editeur_salome.ini"}
+ self.texte = "EFICAS a besoin de certains renseignements pour se configurer\n"+\
+ "Veuillez remplir TOUS les champs ci-dessous et appuyer sur 'Valider'\n"+\
+ "Si vous annulez, EFICAS ne se lancera pas !!"
+
+ self.salome=appli.salome
+ self.code=appli.code
+ clef=self.code
+ if self.salome != 0 :
+ clef = clef + "_SALOME"
+ self.fichier=self.dFichierEditeur[clef]
+ self.repIni = repIni
+ self.rep_ini = repIni
+ self.fic_ini = os.path.join(self.repIni,self.fichier)
+ self.titre = 'Parametres necessaires a la configuration d\'EFICAS'
+ self.texte_ini = "Voici les paramètres que requiert Eficas"
+ self.commande = self.creation_fichier_ini_si_possible
+ self.labels={"savedir" : "Répertoire initial pour Open/Save des fichiers",
+ "rep_travail" : "Répertoire de travail",
+ "rep_mat" : "Répertoire materiaux",
+ "path_doc" : "Chemin d'accès à la doc Aster",
+ "exec_acrobat" : "Ligne de commande Acrobat Reader",
+ "catalogues" : "Versions du code ",
+ "isdeveloppeur" : "Niveau de message ",
+ "path_cata_dev" : "Chemin d'accès aux catalogues développeurs"}
+
+
+ self.types ={"savedir":"rep", "rep_travail":"rep","rep_mat":"rep",
+ "path_doc": "rep","exec_acrobat":"file","exec_acrobat":"file",
+ "catalogues" :"cata","isdeveloppeur":"YesNo","path_cata_dev":"rep",
+ "DTDDirectory":"rep"}
+
+ self.YesNo={}
+ self.YesNo['isdeveloppeur']=('Deboggage','Utilisation')
+
+ # Valeurs par defaut
+ self.rep_user = utils.get_rep_user()
+ self.initialdir=self.rep_user
+ self.savedir = os.environ['HOME']
+ self.rep_travail=os.path.join(self.rep_user,'uaster','tmp_eficas')
+ self.rep_mat=""
+ self.path_doc=self.rep_user
+ self.exec_acrobat=self.rep_user
+ self.isdeveloppeur='NON'
+ self.path_cata_dev=os.path.join(self.rep_user,'cata')
+ CONFIGbase.__init__ (self,appli)
+ self.pref=""
+
+ #--------------------------------------
+ def save_params(self):
+ #--------------------------------------
+ # sauvegarde
+ # les nouveaux paramètres dans le fichier de configuration utilisateur
+ #
+ l_param=('exec_acrobat', 'repIni','catalogues','rep_travail','rep_mat','path_doc','savedir')
+ texte=""
+ for clef in l_param :
+ if hasattr(self,clef):
+ valeur=getattr(self,clef)
+ texte= texte + clef+" = " + repr(valeur) +"\n"
+
+
+ # recuperation des repertoires materiaux
+ try :
+ for item in self.catalogues :
+ try :
+ (code,version,cata,format,defaut)=item
+ except :
+ (code,version,cata,format)=item
+ codeSansPoint=re.sub("\.","",version)
+ chaine="rep_mat_"+codeSansPoint
+ if hasattr(self,chaine):
+ valeur=getattr(self,chaine)
+ texte= texte + chaine+" = '" + str(valeur) +"'\n"
+ except :
+ pass
+
+ f=open(self.fic_ini_utilisateur,'w+')
+ f.write(texte)
+ f.close()
+
+
+class CONFIGStyle(CONFIGbase):
+ def __init__(self,appli,repIni):
+ self.salome=appli.salome
+ self.texte = "Pour prendre en compte les modifications \n"+\
+ " RELANCER EFICAS"
+ self.fichier="style.py"
+ self.repIni = repIni
+ self.rep_ini = repIni
+ self.fic_ini = os.path.join(self.repIni,self.fichier)
+ self.titre = "Parametres d affichage"
+ self.texte_ini = "Voici les paramètres configurables : "
+ self.commande = self.creation_fichier_ini_si_possible
+ self.labels={"background":"couleur du fonds",
+ "foreground":"couleur de la police standard" ,
+ "standard":" police et taille standard",
+ "standard_italique":"police utilisée pour l'arbre ",
+ "standard_gras_souligne":"police utilisée pour le gras souligné",
+ "canvas_italique":"police italique",
+ "standard_gras":"gras",
+ }
+ self.types ={"background":"mot",
+ "foreground":"mot" ,
+ "standard":"mot2",
+ "standard_italique":"mot3",
+ "standard_gras":"mot3",
+ "standard_gras_souligne":"mot4",
+ "canvas":"mot2",
+ "canvas_italique":"mot3",
+ "canvas_gras":"mot3",
+ "canvas_gras_italique":"mot4",
+ "standard12":"mot2",
+ "standard12_gras":"mot3",
+ "standard12_gras_italique":"mot4",
+ "statusfont":"mot2",
+ "standardcourier10":"mot2"}
+ self.YesNo={}
+ self.l_param=[]
+ CONFIGbase.__init__ (self,appli)
+ self.pref="style."
+
+ def affichage_style_ini(self):
+ self.affichage_fichier_ini()
+
+def make_config(appli,rep):
+ return CONFIG(appli,rep)
+
+def make_config_style(appli,rep):
+ return CONFIGStyle(appli,rep)
+
+
+# -*- coding: utf-8 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
#
#
# ======================================================================
-
import os
-from Aster import prefs
-
-rep_cata = os.path.join(prefs.REPINI,'Cata')
-rep_Pmw = os.path.join(prefs.REPINI,'../Pmw')
+# Répertoire initial
+#initialdir=os.curdir
+from prefs_ASTER import REPINI
+initialdir=prefs_ASTER.REPINI
+rep_cata = os.path.join(initialdir,'Cata')
+rep_Pmw = os.path.join(initialdir,'../Pmw')
# Accès à la documentation Aster
path_doc = os.path.join(rep_cata,'..','Doc')
-exec_acrobat = "/usr/bin/xpdf"
+exec_acrobat = "acroread"
+
# Utilisateur/Développeur
isdeveloppeur = "NON"
path_cata_dev = "/tmp/cata"
# Répertoire temporaire
rep_travail = "/tmp"
-# Répertoire initial
-initialdir=os.curdir
# Choix des catalogues
rep_mat_v88=os.path.join(rep_cata,'cataSTA8','materiau')
rep_mat_v95=os.path.join(rep_cata,'cataSTA9','materiau')
-
-catalogues = (
- ('ASTER','v8.8',os.path.join(rep_cata,'cataSTA8'),'python'),
- ('ASTER','v9.5',os.path.join(rep_cata,'cataSTA9'),'python','defaut'),
- )
-
+#
+catalogues=(
+('ASTER','v8.8',os.path.join(rep_cata,'cataSTA8'),'python'),
+('ASTER','v9.5',os.path.join(rep_cata,'cataSTA9'),'python','defaut'),
+)
+# -*- coding: utf-8 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
#
#
# ======================================================================
-
import os
-from Aster import prefs
-
-rep_cata = os.path.join(prefs.REPINI,'Cata')
-rep_Pmw = os.path.join(prefs.REPINI,'../Pmw')
+# Répertoire initial
+#initialdir=os.curdir
+from prefs_ASTER import REPINI
+initialdir=REPINI
+rep_cata = os.path.join(initialdir,'Cata')
+rep_Pmw = os.path.join(initialdir,'../Pmw')
# Accès à la documentation Aster
path_doc = os.path.join(rep_cata,'..','Doc')
-exec_acrobat = "/usr/bin/xpdf"
+exec_acrobat = "acroread"
+
# Utilisateur/Développeur
isdeveloppeur = "NON"
path_cata_dev = "/tmp/cata"
# Répertoire temporaire
rep_travail = "/tmp"
-# Répertoire initial
-initialdir=os.curdir
# Choix des catalogues
rep_mat_v88=os.path.join(rep_cata,'cataSTA8','materiau')
rep_mat_v95=os.path.join(rep_cata,'cataSTA9','materiau')
-
-catalogues = (
- ('ASTER','v8.8',os.path.join(rep_cata,'cataSTA8'),'python'),
- ('ASTER','v9.5',os.path.join(rep_cata,'cataSTA9'),'python','defaut'),
- )
-
+#
+catalogues=(
+('ASTER','v8.8',os.path.join(rep_cata,'cataSTA8'),'python'),
+('ASTER','v9.5',os.path.join(rep_cata,'cataSTA9'),'python','defaut'),
+)
-# -*- coding: utf-8 -*-
-# CONFIGURATION MANAGEMENT OF EDF VERSION
-# ======================================================================
-# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
-# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
-# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
-# (AT YOUR OPTION) ANY LATER VERSION.
-#
-# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-#
-# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
-# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
-# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
-#
-#
-# ======================================================================
-
-import os,sys
-
-# REPINI sert à localiser le fichier editeur.ini
-# Obligatoire
-REPINI=os.path.dirname(os.path.abspath(__file__))
-repIni=REPINI
-
-# INSTALLDIR sert à localiser l'installation d'Eficas
-# Obligatoire
-INSTALLDIR=os.path.join(REPINI,'..')
-
-# CODE_PATH sert à localiser Noyau et Validation éventuellement
-# non contenus dans la distribution EFICAS
-# Par défaut on utilise les modules de INSTALLDIR
-# Peut valoir None (defaut)
-CODE_PATH = None
-
-# la variable code donne le nom du code a selectionner
code="ASTER"
-
-# lang indique la langue utilisée pour les chaines d'aide : fr ou ang
-lang='fr'
-
-# Codage des strings qui accepte les accents (en remplacement de 'ascii')
-encoding='iso-8859-1'
-
-
-EditeurDir=INSTALLDIR+"/Editeur"
-sys.path[:0]=[INSTALLDIR]
-
-ICONDIR=os.path.join(INSTALLDIR,'Editeur','icons')
-
-# Preference
-if os.name == 'nt':
- userprefs = os.sep.join( [ os.environ['HOMEDRIVE'], os.environ['HOMEPATH'], 'Eficas_install', 'prefs.py' ])
-else :
- userprefs=os.path.expanduser("~/.Eficas_install/prefs.py")
-
-if os.path.isfile(userprefs):
- try:
- execfile(userprefs)
- except:
- pass
-
-
-#-------------------------------------------------------------------
-# Partie pour TK
-#-------------------------------------------------------------------
-
-labels= ('Fichier','Edition','Jeu de commandes',
- 'Options',
- 'Aide',
- 'Traduction',
- )
-
-appli_composants=['readercata','bureau',
- 'options',
- ]
-
-menu_defs={ 'bureau': [
- ('Fichier',[
- ('Nouveau','newJDC','<Control-n>','Ctrl+N'),
- ('Nouvel INCLUDE','newJDC_include'),
- ('Ouvrir','openJDC','<Control-o>','Ctrl+O'),
- ('Enregistrer','saveJDC','<Control-s>','Ctrl+S'),
- ('Enregistrer sous','saveasJDC','<Control-e>','Ctrl+E'),
- None,
- ('Fermer','closeJDC','<Control-w>','Ctrl+W'),
- ('Quitter','exitEFICAS','<Control-q>','Ctrl+Q'),
- ]
- ),
- ('Edition',[
- ('Copier','copy','<Control-c>','Ctrl+C'),
- ('Couper','cut','<Control-x>','Ctrl+X'),
- ('Coller','paste','<Control-v>','Ctrl+V'),
- ]
- ),
- ('Jeu de commandes',[
- ('Rapport de validation','visuCRJDC','<Control-r>','Ctrl+R'),
- ('Fichier source','visu_txt_brut_JDC','<Control-b>','Ctrl+B'),
- #('Paramètres Eficas','affichage_fichier_ini'),
- ]
- ),
- ('Traduction',[
- ('Traduction v7 en v8','TraduitFichier7'),
- ('Traduction v8 en v9','TraduitFichier8','<Control-t>','Ctrl+T'),
- ]
- ),
- ('Aide',[
- ('Aide EFICAS','aideEFICAS','<Control-a>','Ctrl+A'),
- ]
- ),
- ]
- }
--- /dev/null
+# -*- coding: utf-8 -*-
+# CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+#
+#
+# ======================================================================
+
+import os,sys
+
+# REPINI sert à localiser le fichier editeur.ini
+# Obligatoire
+REPINI=os.path.dirname(os.path.abspath(__file__))
+repIni=REPINI
+
+# INSTALLDIR sert à localiser l'installation d'Eficas
+# Obligatoire
+INSTALLDIR=os.path.join(REPINI,'..')
+
+# CODE_PATH sert à localiser Noyau et Validation éventuellement
+# non contenus dans la distribution EFICAS
+# Par défaut on utilise les modules de INSTALLDIR
+# Peut valoir None (defaut)
+CODE_PATH = None
+
+# lang indique la langue utilisée pour les chaines d'aide : fr ou ang
+lang='fr'
+
+# Codage des strings qui accepte les accents (en remplacement de 'ascii')
+encoding='iso-8859-1'
+
+
+EditeurDir=INSTALLDIR+"/Editeur"
+sys.path[:0]=[INSTALLDIR]
+
+ICONDIR=os.path.join(INSTALLDIR,'Editeur','icons')
+
+# Preference
+if os.name == 'nt':
+ userprefs = os.sep.join( [ os.environ['HOMEDRIVE'], os.environ['HOMEPATH'], 'Eficas_install', 'prefs.py' ])
+else :
+ userprefs=os.path.expanduser("~/.Eficas_install/prefs.py")
+
+if os.path.isfile(userprefs):
+ try:
+ execfile(userprefs)
+ except:
+ pass
+
+
+#-------------------------------------------------------------------
+# Partie pour TK
+#-------------------------------------------------------------------
+
+labels= ('Fichier','Edition','Jeu de commandes',
+ 'Options',
+ 'Aide',
+ 'Traduction',
+ )
+
+appli_composants=['readercata','bureau',
+ 'options',
+ ]
+
+menu_defs={ 'bureau': [
+ ('Fichier',[
+ ('Nouveau','newJDC','<Control-n>','Ctrl+N'),
+ ('Nouvel INCLUDE','newJDC_include'),
+ ('Ouvrir','openJDC','<Control-o>','Ctrl+O'),
+ ('Enregistrer','saveJDC','<Control-s>','Ctrl+S'),
+ ('Enregistrer sous','saveasJDC','<Control-e>','Ctrl+E'),
+ None,
+ ('Fermer','closeJDC','<Control-w>','Ctrl+W'),
+ ('Quitter','exitEFICAS','<Control-q>','Ctrl+Q'),
+ ]
+ ),
+ ('Edition',[
+ ('Copier','copy','<Control-c>','Ctrl+C'),
+ ('Couper','cut','<Control-x>','Ctrl+X'),
+ ('Coller','paste','<Control-v>','Ctrl+V'),
+ ]
+ ),
+ ('Jeu de commandes',[
+ ('Rapport de validation','visuCRJDC','<Control-r>','Ctrl+R'),
+ ('Fichier source','visu_txt_brut_JDC','<Control-b>','Ctrl+B'),
+ #('Paramètres Eficas','affichage_fichier_ini'),
+ ]
+ ),
+ ('Traduction',[
+ ('Traduction v7 en v8','TraduitFichier7'),
+ ('Traduction v8 en v9','TraduitFichier8','<Control-t>','Ctrl+T'),
+ ]
+ ),
+ ('Aide',[
+ ('Aide EFICAS','aideEFICAS','<Control-a>','Ctrl+A'),
+ ]
+ ),
+ ]
+ }
# Modules Eficas
import prefs
-#from InterfaceQT4 import eficas_go
-from InterfaceQT import eficas_go
+name='prefs_'+prefs.code
+__import__(name)
+
+import sys
+from InterfaceQT4 import eficas_go
eficas_go.lance_eficas(code=prefs.code)
--- /dev/null
+# -*- coding: utf-8 -*-
+# CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+#
+#
+# ======================================================================
+from string import split,strip,lowercase,uppercase
+import re,string,os
+
+
+#
+__Id__="$Id: analyse_catalogue.py,v 1.7.4.1 2008-11-13 10:35:11 cchris Exp $"
+__version__="$Name: BR_dev_V1_15 $"
+#
+
+
+class Catalogue_initial:
+ def __init__(self,fichier):
+ self.liste_commandes=[]
+ self.lignes=[]
+ self.fichier=fichier
+ self.ouvrir_fichier()
+ self.constr_list_txt_cmd()
+
+ def ouvrir_fichier(self):
+ try :
+ f=open(self.fichier,'r')
+ self.lignes=f.readlines()
+ f.close()
+ except :
+ print "Impossible d'ouvrir le fichier :",self.fichier
+
+ def constr_list_txt_cmd(self):
+ pattern = '^# Ordre Catalogue '
+ for i in self.lignes :
+ if (re.search(pattern,i)):
+ i=i.replace('# Ordre Catalogue ','')
+ i=i.replace('\n','')
+ self.liste_commandes.append(i)
+
+
+def analyse_catalogue(nom_cata):
+ cata = Catalogue_initial(nom_cata)
+ return cata.liste_commandes
+
+
+if __name__ == "__main__" :
+ monCata="/home/noyret/Install_Eficas/EficasQT4/Openturns_StudyOpenTURNS_Cata_Study_V4.py"
+ analyse_catalogue(monCata)
+
+
+
+
+
+
+
+
+
+
+
+
+
repertoire=reper+"/../InterfaceTK"
package="InterfaceTK"
else :
- repertoire=reper+"/../InterfaceQT"
- package="InterfaceQT"
+ repertoire=reper+"/../InterfaceQT4"
+ package="InterfaceQT4"
+ #repertoire=reper+"/../InterfaceQT"
+ #package="InterfaceQT"
listfich=glob.glob(os.path.join(repertoire, "compo*.py"))
for fichier in listfich:
m= os.path.basename(fichier)[:-3]
import os
import prefs
+name='prefs_'+prefs.code
+prefs_Code=__import__(name)
-INSTALLDIR=prefs.INSTALLDIR
+INSTALLDIR=prefs_Code.INSTALLDIR
sys.path.append(INSTALLDIR)
-sys.path.append(INSTALLDIR+"/Ui")
-sys.path.append(INSTALLDIR+"/InterfaceQT")
+sys.path.append(INSTALLDIR+"/UiQT4")
+sys.path.append(INSTALLDIR+"/InterfaceQT4")
+#sys.path.append(INSTALLDIR+"/Ui")
+#sys.path.append(INSTALLDIR+"/InterfaceQT")
sys.path.append(INSTALLDIR+"/Editeur")
# Ce chemin permet d'importer les modules Noyau et Validation
# représentant le code utilisé (si fourni)
# Ensuite on utilise les packages de l'intallation
-if hasattr(prefs,'CODE_PATH'):
- if prefs.CODE_PATH:
- sys.path[:0]=[prefs.CODE_PATH]
+if hasattr(prefs_Code,'CODE_PATH'):
+ if prefs_Code.CODE_PATH:
+ sys.path[:0]=[prefs_Code.CODE_PATH]
import Noyau,Validation
del sys.path[0]
-sys.path[:0]=[prefs.INSTALLDIR]
+sys.path[:0]=[prefs_Code.INSTALLDIR]
# Ensuite on surcharge eventuellement
-#if hasattr(prefs,'CODE_PATH_SURCHARGE'):
-# if prefs.CODE_PATH_SURCHARGE:
-# sys.path.insert(0,prefs.CODE_PATH_SURCHARGE)
+#if hasattr(prefs_Code,'CODE_PATH_SURCHARGE'):
+# if prefs_Code.CODE_PATH_SURCHARGE:
+# sys.path.insert(0,prefs_Code.CODE_PATH_SURCHARGE)
import Accas
"OPENTURNS_WRAPPER" : {0:{"Anne":"wrapper_exemple.comm"}},
"HOMARD" : {},
"CUVE2DG" : {},
- 'SEP' : {}
+ 'SEP' : {},
+ 'SIK' : {}
}
class listePatrons :
# -*- coding: utf-8 -*-
import os
import prefs
+name='prefs_'+prefs.code
+prefsCode=__import__(name)
import basestyle
from basestyle import STYLE,style
-inistylefile=os.path.join(prefs.REPINI,"style.py")
+inistylefile=os.path.join(prefsCode.REPINI,"style.py")
if os.path.isfile(inistylefile):
execfile(inistylefile)
--- /dev/null
+#@ MODIF V_AU_MOINS_UN Validation DATE 14/09/2004 AUTEUR PNOYRET
+# -*- coding: iso-8859-1 -*-
+# CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+#
+#
+# ======================================================================
+
+import types
+
+
+class I_AVANT:
+ """
+ La règle I_AVANT vérifie que l'on trouve l ordre des mots-clés
+ de la règle parmi les arguments d'un JDC.
+
+ Ces arguments sont transmis à la règle pour validation sous la forme
+ d'une liste de noms de mots-clés ou d'un dictionnaire dont
+ les clés sont des noms de mots-clés.
+ """
+
+ def __init__(self,*args):
+ if len(args) > 2 :
+ print "Erreur à la création de la règle A_CLASSER(",args,")"
+ return
+ if type(args[0]) == types.TupleType:
+ self.listeAvant=args[0]
+ else :
+ self.listeAvant=(args[0],)
+ if type(args[1]) == types.TupleType:
+ self.listeApres=args[1]
+ else :
+ self.listeApres=(args[1],)
+
+ def verif(self,args):
+ """
+ args peut etre un dictionnaire ou une liste. Les éléments de args
+ sont soit les éléments de la liste soit les clés du dictionnaire.
+ """
+ # on compte le nombre de mots cles presents
+ text =''
+ boolListeAvant=0
+ boolListeApres=0
+ boolOK=1
+ for nom in args:
+ if nom in self.listeAvant :
+ boolListeAvant=1
+ if boolListeApres == 1 :
+ boolOK = 0
+ if nom in self.listeApres :
+ boolListeApres=1
+ if boolListeAvant == 0 and boolListeApres == 1 : boolOK = 0
+ return text,boolOK
+
+
+ def gettext(self):
+ text = "Regle de classement "' :\n'
+ for mc in self.listeAvant :
+ text = text + mc + ', '
+ text = text + " \nAvant : \n"
+ for mc in self.listeApres :
+ text = text + mc + ','
+ return text
+
def GetLabelText(self):
""" Retourne 3 valeurs :
- - le texte à afficher dans le noeud représentant l'item
+ - le texte a afficher dans le noeud représentant l'item
- la fonte dans laquelle afficher ce texte
- la couleur du texte
"""
- return self.labeltext,None,None
+ if self.isactif():
+ fonte = Fonte_Niveau
+ else :
+ fonte = Fonte_Niveau_inactif
+ return self.labeltext,fonte,None
def GetIconName(self):
if self.isactif():
self.connecterSignaux()
def connecterSignaux(self):
+ self.connect(self.BOk,SIGNAL("clicked()"),self.BAjoutClicked)
self.connect(self.bAjout,SIGNAL("clicked()"),self.BAjoutClicked)
mc = self.node.item.get_definition()
d_aides = { 'TXM' : "Une chaîne de caractères est attendue",
'R' : "Un réel est attendu",
- 'I' : "Un entier est attendu"}
+ 'I' : "Un entier est attendu",
+ 'Matrice' : 'Une Matrice est attendue',
+ 'Fichier' : 'Un fichier est attendu'}
type = mc.type[0]
commentaire=d_aides.get(type,"Type de base inconnu")
aideval=self.node.item.aide()
--- /dev/null
+# -*- coding: utf-8 -*-
+# CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+#
+#
+# ======================================================================
+"""
+ Ce module sert pour charger les paramètres de configuration d'EFICAS
+"""
+# Modules Python
+print "passage dans la surcharge de configuration pour OTW"
+import os, sys, string, types, re
+import traceback
+from PyQt4.QtGui import *
+
+# Modules Eficas
+from Editeur import utils
+
+class CONFIG:
+
+ #-----------------------------------
+ def __init__(self,appli,repIni):
+ #-----------------------------------
+
+ # Classe de base permettant de lire, afficher
+ # et sauvegarder les fichiers utilisateurs
+ # On a deux directories : la directory generale (Repertoire d instal + Nom du code
+ # Par exemple : ~/Install_Eficas/EficasV1_14/Openturns_Wrapper
+ # et la directorie de l utilisateur
+ # HOME/.Eficas_Openturns
+ # Le fichier prefs.py va etre lu dans la directory generale puis surcharge eventuellement
+ # par celui de l utilisateur
+ # le fichier de catalogue va etre lu dans la directory de l utilisateur s il exite
+ # dans le fichier general sinon
+ self.appli = appli
+ self.code = appli.code
+ self.salome = appli.salome
+ self.repIni = repIni
+
+ self.fic_prefs ="prefs.py"
+
+ if self.appli:
+ self.parent=appli.top
+ self.appli.mode_nouv_commande='initial'
+ else: self.parent=None
+
+
+ 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')
+ self.initialdir = self.rep_user
+ self.path_doc = self.rep_user
+ self.savedir = self.rep_user
+ self.exec_acrobat = self.rep_user
+
+ #Lecture des fichiers utilisateurs
+ self.lecture_fichier_ini_standard()
+ self.lecture_fichier_ini_utilisateur()
+ self.lecture_catalogues()
+
+ #--------------------------------------
+ def lecture_fichier_ini_standard(self):
+ #--------------------------------------
+ # Verifie l'existence du fichier "standard"
+ # appelle la lecture de ce fichier
+ self.fic_ini = os.path.join(self.repIni,self.fic_prefs)
+ if not os.path.isfile(self.fic_ini):
+ QMessageBox.critical( None, "Import du fichier de Configuration",
+ "Erreur à la lecture du fichier de configuration "+self.fic_ini+".py" )
+ sys.exit(0)
+ import prefs
+ name='prefs_'+prefs.code
+ prefsCode=__import__(name)
+ for k in self.labels :
+ try :
+ valeur=getattr(prefsCode,k)
+ setattr(self,k,valeur)
+ except :
+ pass
+
+
+ #--------------------------------------
+ def lecture_fichier_ini_utilisateur(self):
+ #--------------------------------------
+ # Surcharge les paramètres standards par les paramètres utilisateur s'ils existent
+ self.fic_ini_utilisateur = os.path.join(self.rep_user,self.fic_prefs)
+ #if not os.path.isfile(self.fic_ini_utilisateur+".py"):
+ if not os.path.isfile(self.fic_ini_utilisateur):
+ return
+ from utils import read_file
+ txt = utils.read_file(self.fic_ini_utilisateur)
+ from styles import style
+ d=locals()
+ try:
+ exec txt in d
+ except :
+ l=traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2])
+ 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 :
+ try :
+ setattr(self,k,d[k])
+ except :
+ pass
+
+
+
+ #--------------------------------------
+ def lecture_catalogues(self):
+ #--------------------------------------
+ rep_mat=" " # Compatbilite Aster
+ fic_cata ="catalogues_openturns.ini"
+ fic_ini = os.path.join(self.repIni,fic_cata)
+ fic_user= os.path.join(self.rep_user,fic_cata)
+ if os.path.isfile(fic_user):
+ fichier = fic_user
+ else :
+ fichier = fic_ini
+ if not os.path.isfile(fic_ini) :
+ QMessageBox.critical( None, "Erreur a l'import du fichier des Catalogues",
+ "Le fichier de configuration des catalogues "+fic_ini+" n a pas été trouvé" )
+ sys.exit(0)
+
+ from utils import read_file
+ txt = utils.read_file(fichier)
+ d=locals()
+ try:
+ exec txt in d
+ self.catalogues=d["catalogues"]
+ except :
+ l=traceback.format_exception(sys.exc_info()[0],sys.exc_info()[1],sys.exc_info()[2])
+ QMessageBox.critical( None, "Import du fichier de Configuration",
+ "Erreur à la lecture du fichier de configuration " + fichier )
+ sys.exit(0)
+
+
+
+ #--------------------------------------
+ def save_params(self):
+ #--------------------------------------
+ # sauvegarde
+ # les nouveaux paramètres dans le fichier de configuration utilisateur
+ #
+ print "a ecrire PNPNPN"
+# l_param=('exec_acrobat', 'repIni','catalogues','rep_travail','rep_mat','path_doc')
+# texte=""
+# for clef in l_param :
+# if hasattr(self,clef):
+# valeur=getattr(self,clef)
+# texte= texte + clef+" = " + repr(valeur) +"\n"
+#
+#
+# # recuperation des repertoires materiaux
+# try :
+# for item in self.catalogues :
+# try :
+# (code,version,cata,format,defaut)=item
+# except :
+# (code,version,cata,format)=item
+# codeSansPoint=re.sub("\.","",version)
+# chaine="rep_mat_"+codeSansPoint
+# if hasattr(self,chaine):
+# valeur=getattr(self,chaine)
+# texte= texte + chaine+" = '" + str(valeur) +"'\n"
+# except :
+# pass
+#
+# f=open(self.fic_ini_utilisateur,'w+')
+# f.write(texte)
+# f.close()
+#
+
+
+def make_config(appli,rep):
+ return CONFIG(appli,rep)
+
+def make_config_style(appli,rep):
+ return None
+
+
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+def INCLUDE(self,FileName,**args):
+ """
+ Fonction sd_prod pour la macro INCLUDE
+ """
+ if hasattr(self,'change_fichier'):
+ delattr(self,'change_fichier')
+ delattr(self,'fichier_ini')
+
+ self.make_include2(fichier=FileName)
+
+def INCLUDE_context(self,d):
+ """
+ Fonction op_init pour macro INCLUDE
+ """
+ for k,v in self.g_context.items():
+ print "IDM: ops.py k=%s v=%s" % (k,v)
+ d[k]=v
+
+
--- /dev/null
+# -*- coding: utf-8 -*-
+# CONFIGURATION MANAGEMENT OF EDF VERSION
+# ======================================================================
+# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
+# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
+# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
+# (AT YOUR OPTION) ANY LATER VERSION.
+#
+# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+#
+# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
+# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
+# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+#
+#
+# ======================================================================
+
+import os, sys
+# Les variables pouvant positionnees sont :
+print "import des prefs de OPENTURNS_STUDY"
+
+# REPINI sert à localiser le fichier
+# initialdir sert comme directory initial des QFileDialog
+# positionnee a repin au debut mise a jour dans configuration
+REPINI=os.path.dirname(os.path.abspath(__file__))
+initialdir=REPINI
+
+# INSTALLDIR sert à localiser l'installation d'Eficas
+INSTALLDIR=os.path.join(REPINI,'..')
+
+
+# Codage des strings qui accepte les accents (en remplacement de 'ascii')
+# lang indique la langue utilisée pour les chaines d'aide : fr ou ang
+lang='fr'
+encoding='iso-8859-1'
+
+# Acces a la documentation
+rep_cata = INSTALLDIR
+path_doc = os.path.join(rep_cata,'Doc')
+exec_acrobat = "/usr/bin/xpdf"
+
+
+# OpenTURNS Python module
+OpenTURNS_path="/opt/OpenTURNS/install/lib/python2.4/site-packages"
+# Choix des catalogues
+sys.path[:0]=[INSTALLDIR]
+sys.path.append( OpenTURNS_path )
+
# Form implementation generated from reading ui file 'OptionsEditeur.ui'
#
-# Created: Fri Apr 24 13:21:13 2009
+# Created: Fri Jun 19 11:40:14 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'OptionsPdf.ui'
#
-# Created: Tue Jan 27 12:25:38 2009
+# Created: Fri Jun 19 11:40:14 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'aideQT.ui'
#
-# Created: Tue Jan 27 12:25:38 2009
+# Created: Fri Jun 19 11:40:14 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desChoixCata.ui'
#
-# Created: Tue Jun 9 14:49:19 2009
+# Created: Fri Jun 19 11:40:11 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desCommande.ui'
#
-# Created: Fri Apr 24 13:21:13 2009
+# Created: Fri Jun 19 11:40:11 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desCommentaire.ui'
#
-# Created: Fri Apr 24 12:05:46 2009
+# Created: Fri Jun 19 11:40:11 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desError.ui'
#
-# Created: Tue Jan 27 12:25:36 2009
+# Created: Fri Jun 19 11:40:11 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desFormule.ui'
#
-# Created: Fri Apr 24 14:18:26 2009
+# Created: Fri Jun 19 11:40:11 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desInactif.ui'
#
-# Created: Thu Mar 12 12:15:36 2009
+# Created: Fri Jun 19 11:40:12 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desInclude.ui'
#
-# Created: Thu Mar 12 10:42:30 2009
+# Created: Fri Jun 19 11:40:12 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desListeParam.ui'
#
-# Created: Tue Jan 27 12:25:36 2009
+# Created: Fri Jun 19 11:40:12 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desMCFact.ui'
#
-# Created: Thu Mar 12 10:42:30 2009
+# Created: Fri Jun 19 11:40:12 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desMCListAjout.ui'
#
-# Created: Thu Mar 12 10:42:30 2009
+# Created: Fri Jun 19 11:40:12 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desParam.ui'
#
-# Created: Fri Apr 24 10:10:36 2009
+# Created: Fri Jun 19 11:40:12 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desPlusieursBase.ui'
#
-# Created: Fri Apr 24 15:50:34 2009
+# Created: Fri Jun 19 11:40:12 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desPlusieursInto.ui'
#
-# Created: Fri Apr 24 15:53:20 2009
+# Created: Fri Jun 19 11:40:12 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desPoursuite.ui'
#
-# Created: Thu Mar 12 10:42:31 2009
+# Created: Fri Jun 19 11:40:12 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desRacine.ui'
#
-# Created: Thu Apr 23 16:04:23 2009
+# Created: Fri Jun 19 11:40:13 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desSelectVal.ui'
#
-# Created: Tue Jan 27 12:25:37 2009
+# Created: Fri Jun 19 11:40:13 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desUniqueASSD.ui'
#
-# Created: Fri Apr 24 14:45:17 2009
+# Created: Fri Jun 19 11:40:13 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desUniqueBase.ui'
#
-# Created: Fri Apr 24 14:36:52 2009
+# Created: Fri Jun 19 11:40:13 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desUniqueComp.ui'
#
-# Created: Fri Apr 24 16:01:08 2009
+# Created: Fri Jun 19 11:40:13 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desUniqueInto.ui'
#
-# Created: Fri Apr 24 14:21:54 2009
+# Created: Fri Jun 19 11:40:13 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desUniqueSDCO.ui'
#
-# Created: Thu Mar 12 10:42:32 2009
+# Created: Fri Jun 19 11:40:13 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desUniqueSDCOInto.ui'
#
-# Created: Thu Mar 12 10:42:31 2009
+# Created: Fri Jun 19 11:40:13 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desViewTexte.ui'
#
-# Created: Tue Jan 27 12:25:39 2009
+# Created: Fri Jun 19 11:40:14 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'desVisu.ui'
#
-# Created: Tue Jan 27 12:25:38 2009
+# Created: Fri Jun 19 11:40:13 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
# Form implementation generated from reading ui file 'myMain.ui'
#
-# Created: Thu Apr 23 16:20:17 2009
+# Created: Fri Jun 19 11:40:14 2009
# by: PyQt4 UI code generator 4.4.3
#
# WARNING! All changes made in this file will be lost!
#---------------------------------------------------------#
self.ListeVariables = ListeVariables
self.ListeVariablesIn = []
+ self.ListeVariablesOut = []
self.DictLois = DictLois
self.DictVariables = DictVariables
self.DictMCVal = DictMCVal
self.DictTypeVar = {}
self.nbVarIn = 0
+ self.nbVarOut = 0
self.creeInfoVar()
self.appli = appli
#
#--------------------------#
try :
gener = self.module.__dict__["MonSTDGenerateur"]
- monSTDGenerateur=gener( self.DictMCVal, self.ListeVariablesIn, self.DictLois )
+ monSTDGenerateur=gener( self.DictMCVal, self.ListeVariablesIn, self.ListeVariablesOut, self.DictLois )
except :
from OpenturnsSTD import STDGenerateur
- monSTDGenerateur = STDGenerateur( self.appli, self.DictMCVal, self.ListeVariablesIn, self.DictLois )
+ monSTDGenerateur = STDGenerateur( self.appli, self.DictMCVal, self.ListeVariablesIn, self.ListeVariablesOut, self.DictLois )
return monSTDGenerateur
def getXMLGenerateur(self) :
if DictVariable["Type"] == "in" :
self.nbVarIn = self.nbVarIn + 1
self.ListeVariablesIn.append( DictVariable )
+ print "OpenturnsBase.py: new input variable = ", DictVariable
+ else:
+ self.nbVarOut = self.nbVarOut + 1
+ self.ListeVariablesOut.append( DictVariable )
+ print "OpenturnsBase.py: new output variable = ", DictVariable
liste.append( DictVariable )
num = num + 1
self.ListeVariables = liste
'''
Generation du fichier python
'''
- def __init__ (self, appli, DictMCVal, ListeVariables, DictLois ) :
+ def __init__ (self, appli, DictMCVal, ListeVariablesIn, ListeVariablesOut, DictLois ) :
self.DictMCVal = DictMCVal
- self.ListeVariables = ListeVariables
+ self.ListeVariablesIn = ListeVariablesIn
+ self.ListeVariablesOut = ListeVariablesOut
self.DictLois = DictLois
#print "DictMCVal=", DictMCVal
- #print "ListeVariables=", ListeVariables
+ print "ListeVariablesIn=", ListeVariablesIn
+ print "ListeVariablesOut=", ListeVariablesOut
#print "DictLois=", DictLois
self.texteSTD = defaultSTD
self.OpenTURNS_path = appli.CONFIGURATION.OpenTURNS_path
"Threshold Exceedence" :
( "ThresholdExceedence",
{ "Simulation" : "Simulation",
- "Analytical" : "Analytical",
+ "FORM_SORM" : "Analytical",
"MonteCarlo" : "MonteCarlo",
"LHS" : "LHS",
"ImportanceSampling" : "ImportanceSampling",
"marginal" : "marginal",
"collection" : "collection",
"copula" : "copula",
+ "description" : "description",
"inputRandomVector" : "inputRandomVector",
"outputRandomVector" : "outputRandomVector",
"myQuadraticCumul" : "myQuadraticCumul",
"SRRCcoefficient" : 'results["SRRCcoefficient"]',
"kernel" : "kernel",
"kernelSmoothedDist" : "kernelSmoothedDist",
- "kernelSmoothedPDF" : "kernelSmoothedPDF",
+ "kernelSmoothedPDFDrawing" : "kernelSmoothedPDFDrawing",
+ "kernelSmoothedGraph" : "kernelSmoothedGraph",
+ "meanVector" : "meanVector",
+ "importanceDensity" : "importanceDensity",
"myEvent" : "myEvent",
"myAlgo" : "myAlgo",
"myResult" : "myResult",
"length" : "length",
"coefficientOfVariation" : 'results["coefficientOfVariation"]',
"convergenceGraph" : "convergenceGraph",
- "iterations" : 'results["iterations"]',
+ "convergenceDrawing" : "convergenceDrawing",
+ "simulationNumbers" : 'results["simulationNumbers"]',
"myOptimizer" : "myOptimizer",
"specificParameters" : "specificParameters",
"startingPoint" : "startingPoint",
"eventProbabilitySensitivity" : 'results["eventProbabilitySensitivity"]',
"hasoferReliabilityIndexSensitivity" : 'results["hasoferReliabilityIndexSensitivity"]',
"eventProbabilitySensitivityGraph" : "eventProbabilitySensitivityGraph",
+ "eventProbabilitySensitivityDrawing" : "eventProbabilitySensitivityDrawing",
"hasoferReliabilityIndexSensitivityGraph" : "hasoferReliabilityIndexSensitivityGraph",
+ "hasoferReliabilityIndexSensitivityDrawing" : "hasoferReliabilityIndexSensitivityDrawing",
"modelEvaluationCalls" : 'results["modelEvaluationCalls"]',
"modelGradientCalls" : 'results["modelGradientCalls"]',
"modelHessianCalls" : 'results["modelHessianCalls"]',
Produit le fichier study correspondant a une analyse Min/Max
'''
txt = self.Header()
- txt += "# Etude 'Min/Max'\n"
-
txt += self.Model()
Methode = None
if ( Traitement is not None ):
txt += apply( STDGenerateur.__dict__[ Traitement ], (self,) )
- txt += self.MinMaxComputation()
txt += self.MinMaxResult()
txt += self.Footer()
txt = "# Charge le modele physique\n"
txt = "%s = WrapperFile( '%s' )\n" % (self.variable["wrapper"], name)
+ txt += "# Ces lignes sont utiles pour le fonctionnement du script sous Salome\n"
txt += "if globals().has_key('%s'):\n" % self.variable["framework"]
txt += " %s = %s.getWrapperData()\n" % (self.variable["wrapperdata"], self.variable["wrapper"])
txt += " %s = %s.getFrameworkData()\n" % (self.variable["frameworkdata"], self.variable["wrapperdata"])
txt += " %s.componentname_ = %s['%s']\n" % (self.variable["frameworkdata"], self.variable["framework"], self.variable["componentname"])
txt += " %s.setFrameworkData( %s )\n" % (self.variable["wrapperdata"], self.variable["frameworkdata"])
txt += " %s.setWrapperData( %s )\n" % (self.variable["wrapper"], self.variable["wrapperdata"])
+ txt += "# Fin des lignes pour Salome\n"
txt += "%s = NumericalMathFunction( %s )\n" % (self.variable["model"], self.variable["wrapper"],)
txt += "%s = %s.getInputNumericalPointDimension()\n" % (self.variable["n"], self.variable["model"])
txt += self.TranslationVector()
txt += "%s = %s\n" % (self.variable["inputSample"], self.variable["myExperimentPlane"])
txt += "\n"
+ txt += "# Etude 'Min/Max'\n"
+ txt += "# Calcul\n"
+ txt += "%s = %s( %s )\n" % (self.variable["outputSample"], self.variable["model"], self.variable["inputSample"])
+ txt += "\n"
return txt
def MinMaxRandomSampling (self):
Etude par echantillonage aleatoire
'''
size = 0
- if ( self.DictMCVal.has_key( 'PointsNumber' ) ):
- size = self.DictMCVal[ 'PointsNumber' ]
+ if ( self.DictMCVal.has_key( 'SimulationsNumber' ) ):
+ size = self.DictMCVal[ 'SimulationsNumber' ]
txt = "# Etude par echantillonage aleatoire\n"
txt += self.InputDistribution()
txt += self.InputRandomVector()
- txt += "%s = %d\n" % (self.variable["inSize"], size)
- txt += "%s = %s.getNumericalSample( %s )\n" % (self.variable["inputSample"], self.variable["inputRandomVector"], self.variable["inSize"])
txt += "\n"
+ txt += "# Etude 'Min/Max'\n"
+ txt += "# Calcul\n"
+ txt += "%s = %d\n" % (self.variable["inSize"], size)
+ txt += "%s = RandomVector( %s, %s )\n" % (self.variable["outputRandomVector"], self.variable["model"], self.variable["inputRandomVector"])
+ txt += "%s = %s.getNumericalSample( %s )\n" % (self.variable["outputSample"], self.variable["outputRandomVector"], self.variable["inSize"])
return txt
def InputDistribution (self):
Cree la loi jointe des variables d entree
'''
txt = "# Definit la loi jointe des variables d'entree\n"
- txt += "%s = DistributionCollection( %d )\n" % (self.variable["collection"], len( self.ListeVariables ))
+ txt += "%s = DistributionCollection( %s )\n" % (self.variable["collection"], self.variable["n"])
+ txt += "%s = Description( %s )\n" % (self.variable["description"], self.variable["n"])
txt += "\n"
dictVariables = {}
- for variable in self.ListeVariables:
+ for variable in self.ListeVariablesIn:
nomVar = variable['ModelVariable'].get_name()
dictVariables[ nomVar ] = variable['Distribution']
marginale = "%s_%d" % (self.variable["marginal"], i)
txt += "# Definit la loi marginale de la composante %d\n" % i
txt += "%s = %s\n" % (marginale, apply( STDGenerateur.__dict__[ loi[ 'Kind' ] ], (self, loi, i, self.variable["collection"]) ))
+ txt += "%s.setName( '%s' )\n" % (marginale, conceptloi.get_name())
+ txt += "%s[ %d ] = '%s'\n" % (self.variable["description"], i, variable)
txt += "%s[ %d ] = Distribution( %s )\n" % (self.variable["collection"], i, marginale)
txt += "\n"
i += 1
- txt += self.Copula( len( self.ListeVariables ) )
+ txt += self.Copula()
txt += "# Definit la loi jointe\n"
txt += "%s = ComposedDistribution( %s, Copula( %s ) )\n" % (self.variable["distribution"], self.variable["collection"], self.variable["copula"])
+ txt += "%s.setDescription( %s )\n" % (self.variable["distribution"], self.variable["description"])
txt += "\n"
return txt
- def Copula (self, dimension):
+ def Copula (self):
'''
Cree la copule de la loi jointe
'''
txt = "# Definit la copule de la loi jointe\n"
- txt += "%s = IndependentCopula( %d )\n" % (self.variable["copula"], dimension)
+ txt += "%s = IndependentCopula( %s )\n" % (self.variable["copula"], self.variable["n"])
txt += "\n"
return txt
'''
Cree le vector aleatoire de sortie
'''
+ nomVar = "output"
+ for variable in self.ListeVariablesOut:
+ nomVar = variable['ModelVariable'].get_name()
+
txt = "# Definit le vecteur aleatoire de sortie\n"
txt += "%s = RandomVector( %s, %s )\n" % (self.variable["outputRandomVector"], self.variable["model"], self.variable["inputRandomVector"])
+ txt += "%s.setName( '%s' )\n" % (self.variable["outputRandomVector"], nomVar)
txt += "\n"
return txt
txt += "\n"
return txt
- def MinMaxComputation (self):
- '''
- Realise le calcul deterministe
- '''
- txt = "# Calcul\n"
- txt += "%s = %s( %s )\n" % (self.variable["outputSample"], self.variable["model"], self.variable["inputSample"])
- txt += "\n"
- return txt
-
def MinMaxResult (self):
'''
Produit les resultats de l etude
'''
txt = "# Resultats\n"
txt += "%s = %s.getMin()\n" % (self.variable["minValue"], self.variable["outputSample"])
- txt += "print '%s = ', %s\n" % (self.variable["minValue"], self.variable["minValue"])
+ txt += "print '%s = ', %s\n" % ("minValue", self.variable["minValue"])
txt += "\n"
txt += "%s = %s.getMax()\n" % (self.variable["maxValue"], self.variable["outputSample"])
- txt += "print '%s = ', %s\n" % (self.variable["maxValue"], self.variable["maxValue"])
+ txt += "print '%s = ', %s\n" % ("maxValue", self.variable["maxValue"])
txt += "\n"
return txt
Produit le fichier study correspondant a une analyse d incertitude en valeur centrale
'''
txt = self.Header()
- txt += "# Etude 'Central Uncertainty'\n"
-
txt += self.Model()
txt += self.InputDistribution()
txt += self.InputRandomVector()
Traitement = subDict[ Methode ]
if ( Traitement is not None ):
+ txt += "# Etude 'Central Uncertainty'\n"
txt += apply( STDGenerateur.__dict__[ Traitement ], (self,) )
txt += self.Footer()
if ( self.DictMCVal.has_key( 'MeanFirstOrder' ) ):
if ( self.DictMCVal[ 'MeanFirstOrder' ] == "yes" ):
txt += "%s = %s.getMeanFirstOrder()\n" % (self.variable["meanFirstOrder"], self.variable["myQuadraticCumul"])
- txt += "print '%s = ', %s\n" % (self.variable["meanFirstOrder"], self.variable["meanFirstOrder"])
+ txt += "print '%s = ', %s\n" % ("meanFirstOrder", self.variable["meanFirstOrder"])
txt += "\n"
if ( self.DictMCVal.has_key( 'MeanSecondOrder' ) ):
if ( self.DictMCVal[ 'MeanSecondOrder' ] == "yes" ):
txt += "%s = %s.getMeanSecondOrder()\n" % (self.variable["meanSecondOrder"], self.variable["myQuadraticCumul"])
- txt += "print '%s = ', %s\n" % (self.variable["meanSecondOrder"], self.variable["meanSecondOrder"])
+ txt += "print '%s = ', %s\n" % ("meanSecondOrder", self.variable["meanSecondOrder"])
txt += "\n"
if ( self.DictMCVal.has_key( 'StandardDeviationFirstOrder' ) ):
txt += "dim = %s.getDimension()\n" % self.variable["standardDeviationFirstOrder"]
txt += "for i in range( dim ):\n"
txt += " %s[ i, i ] = math.sqrt( %s[ i, i ] )\n" % (self.variable["standardDeviationFirstOrder"], self.variable["standardDeviationFirstOrder"])
- txt += "print '%s = ', %s\n" % (self.variable["standardDeviationFirstOrder"], self.variable["standardDeviationFirstOrder"])
+ txt += "print '%s = ', %s\n" % ("standardDeviationFirstOrder", self.variable["standardDeviationFirstOrder"])
txt += "\n"
- if ( self.DictMCVal.has_key( 'NumericalResults' ) ):
- if ( self.DictMCVal[ 'NumericalResults' ] == "yes" ):
- txt += "if ( %s.getDimension() == 1):\n" % self.variable["outputRandomVector"]
- txt += " %s = %s.getImportanceFactors()\n" % (self.variable["importanceFactors"], self.variable["myQuadraticCumul"])
- txt += " print '%s = ', %s\n" % (self.variable["importanceFactors"], self.variable["importanceFactors"])
+ if ( self.DictMCVal.has_key( 'ImportanceFactor' ) ):
+ if ( self.DictMCVal[ 'ImportanceFactor' ] == "yes" ):
+ txt += "%s = %s.getImportanceFactors()\n" % (self.variable["importanceFactors"], self.variable["myQuadraticCumul"])
+ txt += "for i in range(%s.getDimension()):\n" % self.variable["importanceFactors"]
+ txt += " print %s.getDescription()[i], ':', %s[i]*100., '%%'\n" % (self.variable["distribution"], self.variable["importanceFactors"])
txt += "\n"
-
- if ( self.DictMCVal.has_key( 'GraphicalResults' ) ):
- if ( self.DictMCVal[ 'GraphicalResults' ] == "yes" ):
txt += "%s = %s.drawImportanceFactors()\n" % (self.variable["importanceFactorsGraph"], self.variable["myQuadraticCumul"])
- txt += "Show( %s )\n" % self.variable["importanceFactorsGraph"]
- txt += "%s.draw( '%s' )\n" % (self.variable["importanceFactorsGraph"], self.variable["importanceFactorsDrawing"])
+ txt += "#Show( %s )\n" % self.variable["importanceFactorsGraph"]
+ txt += "%s = '%s'\n" % (self.variable["importanceFactorsDrawing"], self.DictMCVal[ 'ImportanceFactorDrawingFilename' ])
+ txt += "%s.draw( %s )\n" % (self.variable["importanceFactorsGraph"], self.variable["importanceFactorsDrawing"])
txt += "ViewImage( %s.getBitmap() )\n" % self.variable["importanceFactorsGraph"]
txt += "print 'bitmap =', %s.getBitmap()\n" % self.variable["importanceFactorsGraph"]
txt += "print 'postscript =', %s.getPostscript()\n" % self.variable["importanceFactorsGraph"]
Etude par echantillonage aleatoire
'''
size = 0
- if ( self.DictMCVal.has_key( 'PointsNumber' ) ):
- size = self.DictMCVal[ 'PointsNumber' ]
+ if ( self.DictMCVal.has_key( 'SimulationsNumber' ) ):
+ size = self.DictMCVal[ 'SimulationsNumber' ]
txt = "# Echantillonnage aleatoire de la variable de sortie\n"
txt += "%s = %d\n" % (self.variable["inSize"], size)
- txt += "%s = %s.getNumericalSample( %s )\n" % (self.variable["outputSample"], self.variable["outputRandomVector"], self.variable["inSize"])
+ txt += "%s = %s.getNumericalSample( %s )\n" % (self.variable["inputSample"], self.variable["inputRandomVector"], self.variable["inSize"])
+ txt += "%s = %s( %s )\n" % (self.variable["outputSample"], self.variable["model"], self.variable["inputSample"])
txt += "\n"
if ( self.DictMCVal.has_key( 'EmpiricalMean' ) ):
if ( self.DictMCVal[ 'EmpiricalMean' ] == "yes" ):
txt += "%s = %s.computeMean()\n" % (self.variable["empiricalMean"], self.variable["outputSample"])
- txt += "print '%s =', %s\n" % (self.variable["empiricalMean"], self.variable["empiricalMean"])
+ txt += "print '%s =', %s\n" % ("empiricalMean", self.variable["empiricalMean"])
txt += "\n"
if ( self.DictMCVal.has_key( 'EmpiricalStandardDeviation' ) ):
txt += "dim = %s.getDimension()\n" % self.variable["empiricalStandardDeviation"]
txt += "for i in range( dim ):\n"
txt += " %s[ i, i ] = math.sqrt( %s[ i, i ] )\n" % (self.variable["empiricalStandardDeviation"], self.variable["empiricalStandardDeviation"])
- txt += "print '%s = ', %s\n" % (self.variable["empiricalStandardDeviation"], self.variable["empiricalStandardDeviation"])
+ txt += "print '%s = ', %s\n" % ("empiricalStandardDeviation", self.variable["empiricalStandardDeviation"])
txt += "\n"
if ( self.DictMCVal.has_key( 'EmpiricalQuantile_Order' ) ):
ordre = self.DictMCVal[ 'EmpiricalQuantile_Order' ]
txt += "%s = %s.computeQuantile( %s )\n" % (self.variable["empiricalQuantile"], self.variable["outputSample"], ordre)
- txt += "print '%s =', %s\n" % (self.variable["empiricalQuantile"], self.variable["empiricalQuantile"])
+ txt += "print '%s ( %s ) =', %s\n" % ("empiricalQuantile", ordre, self.variable["empiricalQuantile"])
txt += "\n"
- if ( self.DictMCVal.has_key( 'AnalysedCorrelations' ) ):
- if ( self.DictMCVal[ 'AnalysedCorrelations' ] == "yes" ):
- txt += "# Ou est le %s ?\n" % self.variable["inputSample"]
- txt += "#if ( ( %s.getDimension() == 1 ) and ( %s.getDimension() == 1 ) ):\n" % (self.variable["inputSample"], self.variable["outputSample"])
- txt += "# %s = CorrelationAnalysis.PCC( %s, %s )\n" % (self.variable["PCCcoefficient"], self.variable["inputSample"], self.variable["outputSample"])
- txt += "# print '%s = ', %s\n" % (self.variable["PCCcoefficient"], self.variable["PCCcoefficient"])
- txt += "# %s = CorrelationAnalysis.PRCC( %s, %s )\n" % (self.variable["PRCCcoefficient"], self.variable["inputSample"], self.variable["outputSample"])
- txt += "# print '%s = ', %s\n" % (self.variable["PRCCcoefficient"], self.variable["PRCCcoefficient"])
- txt += "# %s = CorrelationAnalysis.SRC( %s, %s )\n" % (self.variable["SRCcoefficient"], self.variable["inputSample"], self.variable["outputSample"])
- txt += "# print '%s = ', %s\n" % (self.variable["SRCcoefficient"], self.variable["SRCcoefficient"])
- txt += "# %s = CorrelationAnalysis.SRRC( %s, %s )\n" % (self.variable["SRRCcoefficient"], self.variable["inputSample"], self.variable["outputSample"])
- txt += "# print '%s = ', %s\n" % (self.variable["SRRCcoefficient"], self.variable["SRRCcoefficient"])
+ if ( self.DictMCVal.has_key( 'CorrelationAnalysis' ) ):
+ if ( self.DictMCVal[ 'CorrelationAnalysis' ] == "yes" ):
+ txt += "if ( %s.getDimension() == 1 ):\n" % self.variable["outputSample"]
+ txt += " %s = CorrelationAnalysis.PCC( %s, %s )\n" % (self.variable["PCCcoefficient"], self.variable["inputSample"], self.variable["outputSample"])
+ txt += " print 'PCC Coefficients:'\n"
+ txt += " for i in range( %s ):\n" % self.variable["n"]
+ txt += " print %s.getDescription()[i], ':', %s[i]\n" % (self.variable["distribution"], self.variable["PCCcoefficient"])
+ txt += "\n"
+ txt += " %s = CorrelationAnalysis.PRCC( %s, %s )\n" % (self.variable["PRCCcoefficient"], self.variable["inputSample"], self.variable["outputSample"])
+ txt += " print 'PRCC Coefficients:'\n"
+ txt += " for i in range( %s ):\n" % self.variable["n"]
+ txt += " print %s.getDescription()[i], ':', %s[i]\n" % (self.variable["distribution"], self.variable["PRCCcoefficient"])
+ txt += "\n"
+ txt += " %s = CorrelationAnalysis.SRC( %s, %s )\n" % (self.variable["SRCcoefficient"], self.variable["inputSample"], self.variable["outputSample"])
+ txt += " print 'SRC Coefficients:'\n"
+ txt += " for i in range( %s ):\n" % self.variable["n"]
+ txt += " print %s.getDescription()[i], ':', %s[i]\n" % (self.variable["distribution"], self.variable["SRCcoefficient"])
+ txt += "\n"
+ txt += " %s = CorrelationAnalysis.SRRC( %s, %s )\n" % (self.variable["SRRCcoefficient"], self.variable["inputSample"], self.variable["outputSample"])
+ txt += " print 'SRRC Coefficients:'\n"
+ txt += " for i in range( %s ):\n" % self.variable["n"]
+ txt += " print %s.getDescription()[i], ':', %s[i]\n" % (self.variable["distribution"], self.variable["SRRCcoefficient"])
txt += "\n"
if ( self.DictMCVal.has_key( 'KernelSmoothing' ) ):
txt += "# Kernel Smoohing\n"
txt += "%s = KernelSmoothing()\n" % self.variable["kernel"]
txt += "if ( %s.getDimension() == 1 ):\n" % self.variable["outputSample"]
+ txt += " %s.setName( 'Output' )\n" % self.variable["outputSample"]
txt += " %s = %s.buildImplementation( %s, 'TRUE')\n" % (self.variable["kernelSmoothedDist"], self.variable["kernel"], self.variable["outputSample"])
- txt += " %s = %s.drawPDF()\n" % (self.variable["kernelSmoothedPDF"], self.variable["kernelSmoothedDist"])
- txt += " Show( %s )\n" % self.variable["kernelSmoothedPDF"]
+ txt += " %s = %s.drawPDF()\n" % (self.variable["kernelSmoothedGraph"], self.variable["kernelSmoothedDist"])
+ txt += " #Show( %s )\n" % self.variable["kernelSmoothedGraph"]
+ txt += " %s = '%s'\n" % (self.variable["kernelSmoothedPDFDrawing"], self.DictMCVal[ 'KernelSmoothingDrawingFilename' ])
+ txt += " %s.draw( %s )\n" % (self.variable["kernelSmoothedGraph"], self.variable["kernelSmoothedPDFDrawing"])
+ txt += " ViewImage( %s.getBitmap() )\n" % self.variable["kernelSmoothedGraph"]
+ txt += " print 'bitmap =', %s.getBitmap()\n" % self.variable["kernelSmoothedGraph"]
+ txt += " print 'postscript =', %s.getPostscript()\n" % self.variable["kernelSmoothedGraph"]
txt += "\n"
return txt
blockSize = None
if ( self.DictMCVal.has_key( 'BlockSize' ) ):
- maxOuterSampling = self.DictMCVal[ 'BlockSize' ]
+ blockSize = self.DictMCVal[ 'BlockSize' ]
txt += "%s.setBlockSize( %s )\n" % (self.variable["myAlgo"], blockSize)
maxCoefficientOfVariation = None
if ( self.DictMCVal.has_key( 'Probability' ) ):
if ( self.DictMCVal[ 'Probability' ] == "yes" ):
txt += "%s = %s.getProbabilityEstimate()\n" % (self.variable["probability"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["probability"], self.variable["probability"])
+ txt += "print '%s =', %s\n" % ("probability", self.variable["probability"])
txt += "\n"
if ( self.DictMCVal.has_key( 'StandardDeviation' ) ):
if ( self.DictMCVal[ 'StandardDeviation' ] == "yes" ):
txt += "%s = math.sqrt( %s.getProbabilityEstimate() )\n" % (self.variable["standardDeviation"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["standardDeviation"], self.variable["standardDeviation"])
+ txt += "print '%s =', %s\n" % ("standardDeviation", self.variable["standardDeviation"])
txt += "\n"
if ( self.DictMCVal.has_key( 'ConfidenceInterval' ) and self.DictMCVal.has_key( 'Probability' ) ):
if ( self.DictMCVal.has_key( 'VariationCoefficient' ) ):
if ( self.DictMCVal[ 'VariationCoefficient' ] == "yes" ):
txt += "%s = %s.getCoefficientOfVariation()\n" % (self.variable["coefficientOfVariation"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["coefficientOfVariation"], self.variable["coefficientOfVariation"])
+ txt += "print '%s =', %s\n" % ("coefficientOfVariation", self.variable["coefficientOfVariation"])
txt += "\n"
- if ( self.DictMCVal.has_key( 'IterationNumber' ) ):
- if ( self.DictMCVal[ 'IterationNumber' ] == "yes" ):
- txt += "%s = %s.getOuterSampling()\n" % (self.variable["iterations"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["iterations"], self.variable["iterations"])
+ if ( self.DictMCVal.has_key( 'SimulationsNumber' ) ):
+ if ( self.DictMCVal[ 'SimulationsNumber' ] == "yes" ):
+ txt += "%s = %s.getOuterSampling()\n" % (self.variable["simulationNumbers"], self.variable["myResult"])
+ txt += "print '%s =', %s\n" % ("simulationNumbers", self.variable["simulationNumbers"])
txt += "\n"
- if ( self.DictMCVal.has_key( 'ConvergenceGraph' ) ):
- if ( self.DictMCVal[ 'ConvergenceGraph' ] == "yes" ):
- txt += "%s = %s.drawProbabilityConvergence()\n" % (self.variable["convergenceGraph"], self.variable["myAlgo"])
- txt += "Show( %s )\n" % self.variable["convergenceGraph"]
+ if ( self.DictMCVal.has_key( 'ConvergenceGraph' ) and self.DictMCVal.has_key( 'ConfidenceInterval' ) ):
+ if ( ( self.DictMCVal[ 'ConvergenceGraph' ] == "yes" ) and ( self.DictMCVal[ 'ConfidenceInterval' ] == "yes" ) ):
+ txt += "%s = %s\n" % (self.variable["alpha"], self.DictMCVal[ 'Level' ])
+ txt += "%s = %s.drawProbabilityConvergence( %s )\n" % (self.variable["convergenceGraph"], self.variable["myAlgo"], self.variable["alpha"])
+ txt += "#Show( %s )\n" % self.variable["convergenceGraph"]
+ txt += "%s = '%s'\n" % (self.variable["convergenceDrawing"], self.DictMCVal[ 'ConvergenceDrawingFilename' ])
+ txt += "%s.draw( %s )\n" % (self.variable["convergenceGraph"], self.variable["convergenceDrawing"])
+ txt += "ViewImage( %s.getBitmap() )\n" % self.variable["convergenceGraph"]
txt += "\n"
return txt
'''
txt = ""
- iterations = None
+ simulationNumbers = None
if ( self.DictMCVal.has_key( 'MaximumIterationsNumber' ) ):
- iterations = self.DictMCVal[ 'MaximumIterationsNumber' ]
- txt += "%s.setMaximumIterationsNumber( %s )\n" % (self.variable["myOptimizer"], iterations)
+ simulationNumbers = self.DictMCVal[ 'MaximumIterationsNumber' ]
+ txt += "%s.setMaximumIterationsNumber( %s )\n" % (self.variable["myOptimizer"], simulationNumbers)
absoluteError = None
if ( self.DictMCVal.has_key( 'MaximumAbsoluteError' ) ):
if ( self.DictMCVal.has_key( 'HasoferReliabilityIndex' ) ):
if ( self.DictMCVal[ 'HasoferReliabilityIndex' ] == "yes" ):
txt += "%s = %s.getHasoferReliabilityIndex()\n" % (self.variable["hasoferReliabilityIndex"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["hasoferReliabilityIndex"], self.variable["hasoferReliabilityIndex"])
+ txt += "print '%s =', %s\n" % ("hasoferReliabilityIndex", self.variable["hasoferReliabilityIndex"])
txt += "\n"
if ( self.DictMCVal.has_key( 'DesignPoint' ) ):
if ( self.DictMCVal[ 'DesignPoint' ] == "yes" ):
txt += "%s = %s.getStandardSpaceDesignPoint()\n" % (self.variable["standardSpaceDesignPoint"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["standardSpaceDesignPoint"], self.variable["standardSpaceDesignPoint"])
+ txt += "print '%s =', %s\n" % ("standardSpaceDesignPoint", self.variable["standardSpaceDesignPoint"])
txt += "%s = %s.getPhysicalSpaceDesignPoint()\n" % (self.variable["physicalSpaceDesignPoint"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["physicalSpaceDesignPoint"], self.variable["physicalSpaceDesignPoint"])
+ txt += "print '%s =', %s\n" % ("physicalSpaceDesignPoint", self.variable["physicalSpaceDesignPoint"])
txt += "\n"
- if ( self.DictMCVal.has_key( 'ImportanceFactorNumericalResults' ) ):
- if ( self.DictMCVal[ 'ImportanceFactorNumericalResults' ] == "yes" ):
+ if ( self.DictMCVal.has_key( 'ImportanceFactor' ) ):
+ if ( self.DictMCVal[ 'ImportanceFactor' ] == "yes" ):
txt += "%s = %s.getImportanceFactors()\n" % (self.variable["importanceFactors"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["importanceFactors"], self.variable["importanceFactors"])
+ txt += "for i in range(%s.getDimension()):\n" % self.variable["importanceFactors"]
+ txt += " print %s.getDescription()[i], ':', %s[i]*100., '%%'\n" % (self.variable["distribution"], self.variable["importanceFactors"])
txt += "\n"
-
- if ( self.DictMCVal.has_key( 'ImportanceFactorGraphicalResults' ) ):
- if ( self.DictMCVal[ 'ImportanceFactorGraphicalResults' ] == "yes" ):
txt += "%s = %s.drawImportanceFactors()\n" % (self.variable["importanceFactorsGraph"], self.variable["myResult"])
- txt += "Show( %s )\n" % self.variable["importanceFactorsGraph"]
+ txt += "#Show( %s )\n" % self.variable["importanceFactorsGraph"]
+ txt += "%s = '%s'\n" % (self.variable["importanceFactorsDrawing"], self.DictMCVal[ 'ImportanceFactorDrawingFilename' ])
+ txt += "%s.draw( %s )\n" % (self.variable["importanceFactorsGraph"], self.variable["importanceFactorsDrawing"])
+ txt += "ViewImage( %s.getBitmap() )\n" % self.variable["importanceFactorsGraph"]
+ txt += "print 'bitmap =', %s.getBitmap()\n" % self.variable["importanceFactorsGraph"]
+ txt += "print 'postscript =', %s.getPostscript()\n" % self.variable["importanceFactorsGraph"]
txt += "\n"
- if ( self.DictMCVal.has_key( 'FORMEventProbabilitySensitivityNumericalResults' ) ):
- if ( self.DictMCVal[ 'FORMEventProbabilitySensitivityNumericalResults' ] == "yes" ):
+ if ( self.DictMCVal.has_key( 'FORMEventProbabilitySensitivity' ) ):
+ if ( self.DictMCVal[ 'FORMEventProbabilitySensitivity' ] == "yes" ):
txt += "%s = %s.getEventProbabilitySensitivity()\n" % (self.variable["eventProbabilitySensitivity"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["eventProbabilitySensitivity"], self.variable["eventProbabilitySensitivity"])
+ txt += "print 'FORM Event Probability Sensitivity:'\n"
+ txt += "for i in range( %s ):\n" % self.variable["n"]
+ txt += " print %s.getDescription()[i], ':'\n" % self.variable["distribution"]
+ txt += " for j in range( %s[i].getDimension() ):\n" % self.variable["eventProbabilitySensitivity"]
+ txt += " print ' ', %s[i].getDescription()[j], ':', %s[i][j]\n" % (self.variable["eventProbabilitySensitivity"], self.variable["eventProbabilitySensitivity"])
txt += "\n"
-
- if ( self.DictMCVal.has_key( 'FORMEventProbabilitySensitivityGraphicalResults' ) ):
- if ( self.DictMCVal[ 'FORMEventProbabilitySensitivityGraphicalResults' ] == "yes" ):
- txt += "%s = %s.drawEventProbabilitySensitivity()\n" % (self.variable["eventProbabilitySensitivityGraph"], self.variable["myResult"])
- txt += "Show( %s[0] )\n" % self.variable["eventProbabilitySensitivityGraph"]
+ txt += "%s = %s.drawEventProbabilitySensitivity()[0]\n" % (self.variable["eventProbabilitySensitivityGraph"], self.variable["myResult"])
+ txt += "#Show( %s )\n" % self.variable["eventProbabilitySensitivityGraph"]
+ txt += "%s = '%s'\n" % (self.variable["eventProbabilitySensitivityDrawing"], self.DictMCVal[ 'FORMEventProbabilitySensitivityDrawingFilename' ])
+ txt += "%s.draw( %s )\n" % (self.variable["ieventProbabilitySensitivityGraph"], self.variable["eventProbabilitySensitivityDrawing"])
+ txt += "ViewImage( %s.getBitmap() )\n" % self.variable["eventProbabilitySensitivityGraph"]
+ txt += "print 'bitmap =', %s.getBitmap()\n" % self.variable["eventProbabilitySensitivityGraph"]
+ txt += "print 'postscript =', %s.getPostscript()\n" % self.variable["eventProbabilitySensitivityGraph"]
txt += "\n"
- if ( self.DictMCVal.has_key( 'HasoferReliabilityIndexSensitivityNumericalResults' ) ):
- if ( self.DictMCVal[ 'HasoferReliabilityIndexSensitivityNumericalResults' ] == "yes" ):
+ if ( self.DictMCVal.has_key( 'HasoferReliabilityIndexSensitivity' ) ):
+ if ( self.DictMCVal[ 'HasoferReliabilityIndexSensitivity' ] == "yes" ):
txt += "%s = %s.getHasoferReliabilityIndexSensitivity()\n" % (self.variable["hasoferReliabilityIndexSensitivity"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["hasoferReliabilityIndexSensitivity"], self.variable["hasoferReliabilityIndexSensitivity"])
+ txt += "print 'Hasofer Reliability Index Sensitivity:'\n"
+ txt += "for i in range( %s ):\n" % self.variable["n"]
+ txt += " print %s.getDescription()[i], ':'\n" % self.variable["distribution"]
+ txt += " for j in range( %s[i].getDimension() ):\n" % self.variable["hasoferReliabilityIndexSensitivity"]
+ txt += " print ' ', %s[i].getDescription()[j], ':', %s[i][j]\n" % (self.variable["hasoferReliabilityIndexSensitivity"], self.variable["hasoferReliabilityIndexSensitivity"])
txt += "\n"
-
- if ( self.DictMCVal.has_key( 'HasoferReliabilityIndexSensitivityGraphicalResults' ) ):
- if ( self.DictMCVal[ 'HasoferReliabilityIndexSensitivityGraphicalResults' ] == "yes" ):
- txt += "%s = %s.drawHasoferReliabilityIndexSensitivity()\n" % (self.variable["hasoferReliabilityIndexSensitivityGraph"], self.variable["myResult"])
- txt += "Show( %s[0] )\n" % self.variable["hasoferReliabilityIndexSensitivityGraph"]
+ txt += "%s = %s.drawHasoferReliabilityIndexSensitivity()[0]\n" % (self.variable["hasoferReliabilityIndexSensitivityGraph"], self.variable["myResult"])
+ txt += "#Show( %s )\n" % self.variable["hasoferReliabilityIndexSensitivityGraph"]
+ txt += "%s = '%s'\n" % (self.variable["hasoferReliabilityIndexSensitivityDrawing"], self.DictMCVal[ 'HasoferReliabilityIndexSensitivityDrawingFilename' ])
+ txt += "%s.draw( %s )\n" % (self.variable["hasoferReliabilityIndexSensitivityGraph"], self.variable["hasoferReliabilityIndexSensitivityDrawing"])
+ txt += "ViewImage( %s.getBitmap() )\n" % self.variable["hasoferReliabilityIndexSensitivityGraph"]
+ txt += "print 'bitmap =', %s.getBitmap()\n" % self.variable["hasoferReliabilityIndexSensitivityGraph"]
+ txt += "print 'postscript =', %s.getPostscript()\n" % self.variable["hasoferReliabilityIndexSensitivityGraph"]
txt += "\n"
if ( self.DictMCVal.has_key( 'TvedtApproximation' ) ):
if ( self.DictMCVal[ 'TvedtApproximation' ] == "yes" ):
txt += "%s = %s.getEventProbabilityTvedt()\n" % (self.variable["tvedtApproximation"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["tvedtApproximation"], self.variable["tvedtApproximation"])
+ txt += "print '%s =', %s\n" % ("tvedtApproximation", self.variable["tvedtApproximation"])
txt += "\n"
if ( self.DictMCVal.has_key( 'HohenBichlerApproximation' ) ):
if ( self.DictMCVal[ 'HohenBichlerApproximation' ] == "yes" ):
txt += "%s = %s.getEventProbabilityHohenBichler()\n" % (self.variable["hohenBichlerApproximation"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["hohenBichlerApproximation"], self.variable["tvedtApproximation"])
+ txt += "print '%s =', %s\n" % ("hohenBichlerApproximation", self.variable["tvedtApproximation"])
txt += "\n"
if ( self.DictMCVal.has_key( 'BreitungApproximation' ) ):
if ( self.DictMCVal[ 'BreitungApproximation' ] == "yes" ):
txt += "%s = %s.getEventProbabilityBreitung()\n" % (self.variable["breitungApproximation"], self.variable["myResult"])
- txt += "print '%s =', %s\n" % (self.variable["breitungApproximation"], self.variable["breitungApproximation"])
+ txt += "print '%s =', %s\n" % ("breitungApproximation", self.variable["breitungApproximation"])
txt += "\n"
txt = "# Evenement de defaillance\n"
txt += "%s = Event( %s, ComparisonOperator( %s() ), %s )\n" % (self.variable["myEvent"], self.variable["outputRandomVector"], operator, threshold)
+ txt += "%s.setName( '%s' )\n" % (self.variable["myEvent"], "myEvent")
txt += "\n"
return txt
'''
Methode de tirage d importance
'''
+ dimension = 0
+ if ( self.DictMCVal.has_key( 'MeanVector' ) ):
+ meanVector = self.DictMCVal[ 'MeanVector' ]
+ dimension = len( meanVector )
+
txt = "# Simulation par Tirage d'importance\n"
- txt += "%s = ImportanceSampling( %s )\n" % (self.variable["myAlgo"], self.variable["myEvent"])
+ txt += "# Densite d'importance\n"
+ txt += "%s = NumericalPoint( %s )\n" % (self.variable["meanVector"], self.variable["n"])
+ for i in range(dimension):
+ txt += "%s[%d] = %g\n" % (self.variable["meanVector"], i, meanVector[i])
+
+ if ( self.DictMCVal.has_key( 'Correlation' ) ):
+ if ( self.DictMCVal[ 'Correlation' ] in ( 'Independent', ) ):
+ txt += "%s = Normal( %s, CovarianceMatrix( IdentityMatrix( %s ) ) )\n" % (self.variable["importanceDensity"], self.variable["meanVector"], self.variable["n"])
+ elif ( self.DictMCVal[ 'Correlation' ] in ( 'Linear', ) ):
+ txt += "# Linear correlation not yet implemented\n"
+ txt += "%s = ImportanceSampling( %s, Distribution( %s ) )\n" % (self.variable["myAlgo"], self.variable["myEvent"], self.variable["importanceDensity"])
txt += "\n"
return txt
'''
Do the computation
'''
+ txt = ""
if ( self.DictMCVal.has_key( 'FunctionCallsNumber' ) ):
if ( self.DictMCVal[ 'FunctionCallsNumber' ] == "yes" ):
- txt = "%s = %s.getEvaluationCallsNumber()\n" % (self.variable["modelEvaluationCalls"], self.variable["model"])
+ txt += "%s = %s.getEvaluationCallsNumber()\n" % (self.variable["modelEvaluationCalls"], self.variable["model"])
txt += "%s = %s.getGradientCallsNumber()\n" % (self.variable["modelGradientCalls"], self.variable["model"])
txt += "%s = %s.getHessianCallsNumber()\n" % (self.variable["modelHessianCalls"], self.variable["model"])
txt += "\n"
txt += "%s = %s.getGradientCallsNumber() - %s\n" % (self.variable["modelGradientCalls"], self.variable["model"], self.variable["modelGradientCalls"])
txt += "%s = %s.getHessianCallsNumber() - %s\n" % (self.variable["modelHessianCalls"], self.variable["model"], self.variable["modelHessianCalls"])
txt += "\n"
- txt += "print '%s =', %s\n" % (self.variable["modelEvaluationCalls"], self.variable["modelEvaluationCalls"])
- txt += "print '%s =', %s\n" % (self.variable["modelGradientCalls"], self.variable["modelGradientCalls"])
- txt += "print '%s =', %s\n" % (self.variable["modelHessianCalls"], self.variable["modelHessianCalls"])
+ txt += "print '%s =', %s\n" % ("modelEvaluationCalls", self.variable["modelEvaluationCalls"])
+ txt += "print '%s =', %s\n" % ("modelGradientCalls", self.variable["modelGradientCalls"])
+ txt += "print '%s =', %s\n" % ("modelHessianCalls", self.variable["modelHessianCalls"])
txt += "\n"
return txt
Definition de la loi Gumbel
'''
settings = {
- "AlphaBeta" : "Gamma.ALPHABETA",
- "MuSigma" : "Gamma.MUSIGMA",
+ "AlphaBeta" : "Gumbel.ALPHABETA",
+ "MuSigma" : "Gumbel.MUSIGMA",
}
if loi[ 'Settings' ] == 'AlphaBeta' :
arg1 = loi[ 'Alpha' ]
arg1 = loi[ 'Mu' ]
arg2 = loi[ 'Sigma' ]
- txt = "Gamma( %g, %g, %s )" % (arg1, arg2, settings[ loi[ 'Settings' ] ])
+ txt = "Gumbel( %g, %g, %s )" % (arg1, arg2, settings[ loi[ 'Settings' ] ])
return txt
def Histogram (self, loi, i, collection):
txt = "Histogram( %g, %s )" % (arg1, arg2)
return txt
+ def Laplace (self, loi, i, collection):
+ '''
+ Definition de la loi Laplace
+ '''
+ arg1 = loi[ 'Lambda' ]
+ arg2 = loi[ 'Mu' ]
+ txt = "Laplace( %g, %g )" % (arg1, arg2)
+ return txt
+
def Logistic (self, loi, i, collection):
'''
Definition de la loi Logistic
txt = "MultiNomial( NumericalPoint( %s ) , %d)" % (arg1, arg2)
return txt
+ def NonCentralStudent (self, loi, i, collection):
+ '''
+ Definition de la loi NonCentralStudent
+ '''
+ arg1 = loi[ 'Nu' ]
+ arg2 = loi[ 'Delta' ]
+ arg3 = loi[ 'Gamma' ]
+ txt = "NonCentralStudent( %g, %g )" % (arg1, arg2, arg3)
+ return txt
+
def Normal (self, loi, i, collection):
'''
Definition de la loi Normal
def Poisson (self, loi, i, collection):
'''
- Definition de la loi
+ Definition de la loi Poisson
'''
txt = "Poisson( %g )" % loi[ 'Lambda' ]
return txt
+ def Rayleigh (self, loi, i, collection):
+ '''
+ Definition de la loi Rayleigh
+ '''
+ arg1 = loi[ 'Sigma' ]
+ arg2 = loi[ 'Gamma' ]
+ txt = "Rayleigh( %g, %g )" % (arg1, arg2)
+ return txt
+
def Student (self, loi, i, collection):
'''
Definition de la loi Student
'''
arg1 = loi[ 'Mu' ]
arg2 = loi[ 'Nu' ]
- txt = "Student( %g, %g )" % (arg1, arg2)
+ arg3 = loi[ 'Sigma' ]
+ txt = "Student( %g, %g, %g )" % (arg1, arg2, arg3)
return txt
def Triangular (self, loi, i, collection):
arg2 = loi[ 'Sigma' ]
arg3 = loi[ 'Gamma' ]
- txt = "Weibull( %g, %g, %s )" % (arg1, arg2, arg3, settings[ loi[ 'Settings' ] ])
+ txt = "Weibull( %g, %g, %g, %s )" % (arg1, arg2, arg3, settings[ loi[ 'Settings' ] ])
return txt
Ecrit les donnees liees a l utilisation d un framework englobant
'''
framework = openturns.WrapperFrameworkData()
- #framework.studycase_ = "12:23:34"
- framework.componentname_ = self.GetMCVal('SolverComponentName')
+# framework.studycase_ = "12:23:34"
+# framework.componentname_ = self.GetMCVal('SolverComponentName', 'UNDEFINED')
+ CN = self.GetMCVal('SolverComponentName', 'UNDEFINED')
+ print 'CN = ', CN
+ framework.componentname_ = CN
return framework
Convertit un objet MCSIMP en une liste de chaines de caractères à la
syntaxe python
"""
+ waitTuple=0
if type(obj.valeur) in (types.TupleType,types.ListType) :
s = ''
- for val in obj.valeur :
- s =s +self.format_item(val,obj.etape) + ','
- if len(obj.valeur) > 1:
- s = '(' + s + '),'
+ for ss_type in obj.definition.type:
+ if repr(ss_type).find('Tuple') != -1 :
+ waitTuple=1
+ break
+
+ if waitTuple :
+ s = str(obj.valeur) +','
+ else :
+ for val in obj.valeur :
+ s =s +self.format_item(val,obj.etape) + ','
+ if len(obj.valeur) > 1:
+ s = '(' + s + '),'
if obj.nbrColonnes() :
s=self.formatColonnes(obj.nbrColonnes(),s)
else :
#else :
textformat=text
return textformat
-
-