From: cvs2git Date: Mon, 1 Dec 2008 14:39:14 +0000 (+0000) Subject: This commit was manufactured by cvs2git to create tag 'V1_15a1'. X-Git-Tag: V1_15a1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a585aada971393e53e4469eb5fceb003144f4bf;p=tools%2Feficas.git This commit was manufactured by cvs2git to create tag 'V1_15a1'. Sprout from BR_dev_V1_15 2008-12-01 14:39:13 UTC Pascale Noyret '*** empty log message ***' Cherrypick from BR_dev_V1_15 2008-11-25 13:54:39 UTC Pascale Noyret '*** empty log message ***': Openturns_Study/catalogues_openturns.ini generator/OpenturnsBase.py generator/OpenturnsSTD.py generator/OpenturnsXML.py generator/generator_openturns_study.py generator/generator_openturns_wrapper.py Delete: Openturns_Study/OpenTURNS_Cata_Study_V2.py Openturns_Study/test/MinMax_ExpPlane.comm Openturns_Study/test/MinMax_ExpPlane.py Openturns_Study/test/MinMax_RandomSampling.comm --- diff --git a/Openturns_Study/OpenTURNS_Cata_Study_V2.py b/Openturns_Study/OpenTURNS_Cata_Study_V2.py deleted file mode 100644 index 58128f14..00000000 --- a/Openturns_Study/OpenTURNS_Cata_Study_V2.py +++ /dev/null @@ -1,1486 +0,0 @@ -# -*- coding: utf-8 -*- - -# -------------------------------------------------- -# debut entete -# -------------------------------------------------- - -import Accas -from Accas import * - -class loi ( ASSD ) : pass - - -#CONTEXT.debug = 1 -JdC = JDC_CATA ( code = 'OPENTURNS_STUDY', - execmodul = None, - regles = ( AU_MOINS_UN ( 'CRITERIA' ), AU_MOINS_UN ( 'MODEL' ), ), - ) # Fin JDC_CATA - -# -------------------------------------------------- -# fin entete -# -------------------------------------------------- - -LOG = PROC ( nom = "LOG", - op = None, - docu = "", - - DebugMessages = SIMP ( statut = "o", - typ = "TXM", - into = ( 'yes', 'no' ), - defaut = 'no', - fr = "Affichage du niveau de debug de la bibliotheque Open TURNS", - ang = "Open TURNS library debug level print", - ), - - WrapperMessages = SIMP ( statut = "o", - typ = "TXM", - into = ( 'yes', 'no' ), - defaut = 'no', - fr = "Affichage du niveau de wrapper de la bibliotheque Open TURNS", - ang = "Open TURNS library debug level print", - ), - - UserMessages = SIMP ( statut = "o", - typ = "TXM", - into = ( 'yes', 'no' ), - defaut = 'no', - fr = "Affichage du niveau de user de la bibliotheque Open TURNS", - ang = "Open TURNS library user level print", - ), - - InfoMessages = SIMP ( statut = "o", - typ = "TXM", - into = ( 'yes', 'no' ), - defaut = 'yes', - fr = "Affichage du niveau de info de la bibliotheque Open TURNS", - ang = "Open TURNS library info level print", - ), - - WarningMessages = SIMP ( statut = "o", - typ = "TXM", - into = ( 'yes', 'no' ), - defaut = 'yes', - fr = "Affichage du niveau de warning de la bibliotheque Open TURNS", - ang = "Open TURNS library warning level print", - ), - - ErrorMessages = SIMP ( statut = "o", - typ = "TXM", - into = ( 'yes', 'no' ), - defaut = 'yes', - fr = "Affichage du niveau de error de la bibliotheque Open TURNS", - ang = "Open TURNS library error level print", - ), - -) # Fin PROC LOG - - - - -#================================ -# 0. Definition du modele physique -#================================ - -MODEL = PROC ( nom = "MODEL", - op = None, - docu = "", - - Name = SIMP ( statut = "o", - typ = "TXM", - fr = "Nom du modele physique", - ang = "Physical model identifier", - ), - -) # Fin PROC MODEL - - - - - - -#================================ -# 1. Definition des LOIS -#================================ - -# Nota : les variables de type OPER doivent etre en majuscules ! -# Nota : les variables de type OPER doivent etre de premier niveau (pas imbriquees dans un autre type) -DISTRIBUTION = OPER ( nom = "DISTRIBUTION", - sd_prod = loi, - op = 68, - fr = "Definitions des lois marginales utilisees par les variables d'entree", - - -#==== -# Type de distribution -#==== - - Kind = SIMP ( statut = "o", typ = "TXM", - into = ( "Beta", - "Exponential", - "Gamma", - "Geometric", - "Gumbel", - "Histogram", - "Logistic", - "LogNormal", - "MultiNomial", - "Normal", - "TruncatedNormal", - "Poisson", - "Student", - "Triangular", - "Uniform", - "UserDefined", - "Weibull", - ), - fr = "Choix du type de la loi marginale", - ang = "1D marginal distribution", - ), - -#==== -# Definition des parametres selon le type de la loi -#==== - - BETA = BLOC ( condition = " Kind in ( 'Beta', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "RT", "MuSigma" ), - defaut = "RT", - fr = "Parametrage de la loi beta", - ang = "Beta distribution parameter set", - ), - - RT_Parameters = BLOC ( condition = " Settings in ( 'RT', ) ", - - R = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre R de la loi", - ang = "R parameter", - ), - - # T > R - T = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre T de la loi | T > R", - ang = "T parameter | T > R", - ), - - ), # Fin BLOC RT_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter", - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0", - ), - - ), # Fin BLOC MuSigma_Parameters - - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre A de la loi", - ang = "A parameter", - ), - - # B > A - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre B de la loi | B > A", - ang = "B parameter | B > A", - ), - - ), # Fin BLOC BETA - - - - EXPONENTIAL = BLOC ( condition = " Kind in ( 'Exponential', ) ", - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda | Lambda > 0", - ang = "Lambda parameter | Lambda > 0", - ), - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter", - ), - - ), # Fin BLOC EXPONENTIAL - - - - GAMMA = BLOC ( condition = " Kind in ( 'Gamma', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "KLambda", "MuSigma" ), - defaut = "KLambda", - fr = "Parametrage de la loi gamma", - ang = "Gamma distribution parameter set", - ), - - KLambda_Parameters = BLOC ( condition = " Settings in ( 'KLambda', ) ", - - K = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre K de la loi | K > 0", - ang = "K parameter | K > 0", - ), - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda de la loi | Lambda > 0", - ang = "Lambda parameter | Lambda > 0", - ), - - ), # Fin BLOC KLambda_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - defaut = 0.0, - fr = "Parametre Mu de la loi", - ang = "Mu parameter", - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - defaut = 1.0, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0", - ), - - ), # Fin BLOC MuSigma_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter", - ), - - - ), # Fin BLOC GAMMA - - - - GEOMETRIC = BLOC ( condition = " Kind in ( 'Geometric', ) ", - - P = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - val_max = 1., - fr = "Parametre P | 0 < P < 1", - ang = "P parameter | 0 < P < 1", - ), - - ), # Fin BLOC GEOMETRIC - - - - GUMBEL = BLOC ( condition = " Kind in ( 'Gumbel', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "AlphaBeta", "MuSigma" ), - defaut = "AlphaBeta", - fr = "Parametrage de la loi gumbel", - ang = "Gumbel distribution parameter set", - ), - - AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Alpha de la loi | Alpha > 0", - ang = "Alpha parameter | Alpha > 0", - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Beta de la loi", - ang = "Beta parameter", - ), - - ), # Fin BLOC AlphaBeta_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter", - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0", - ), - - ), # Fin BLOC MuSigma_Parameters - - ), # Fin BLOC GUMBEL - - - - HISTOGRAM = BLOC ( condition = " Kind in ( 'Histogram', ) ", - - Sup = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la distribution", - ang = "Upper bound", - ), - - # Il faut definir une collection de couples ( x,p ) - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**', - ), - - ), # Fin BLOC HISTOGRAM - - - - LOGNORMAL = BLOC ( condition = " Kind in ( 'LogNormal', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "MuSigmaLog", "MuSigma", "MuSigmaOverMu" ), - defaut = "MuSigmaLog", - fr = "Parametrage de la loi lognormale", - ang = "Lognormal distribution parameter set", - ), - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi | Mu > Gamma", - ang = "Mu parameter | Mu > Gamma", - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0", - ), - - ), # Fin BLOC MuSigma_Parameters - - MuSigmaOverMu_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaOverMu', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi | Mu > Gamma", - ang = "Mu parameter | Mu > Gamma", - ), - - SigmaOverMu = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre SigmaOverMu de la loi | SigmaOverMu > 0", - ang = "SigmaOverMu parameter | SigmaOverMu > 0", - ), - - ), # Fin BLOC MuSigmaOverMu_Parameters - - MuSigmaLog_Parameters = BLOC ( condition = " Settings in ( 'MuSigmaLog', ) ", - - MuLog = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu log de la loi", - ang = "Mu log parameter", - ), - - SigmaLog = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma log de la loi | SigmaLog > 0", - ang = "Sigma log parameter | SigmaLog > 0", - ), - - ), # Fin BLOC MuSigmaLog_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter", - ), - - ), # Fin BLOC LOGNORMAL - - - - LOGISTIC = BLOC ( condition = " Kind in ( 'Logistic', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Alpha de la loi", - ang = "Alpha parameter", - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Beta de la loi | Beta > = 0", - ang = "Beta parameter | Beta > = 0", - ), - - ), # Fin BLOC LOGISTIC - - - - MULTINOMIAL = BLOC ( condition = " Kind in ( 'MultiNomial', ) ", - - N = SIMP ( statut = "o", - typ = "I", - max = 1, - fr = "Dimension de la loi", - ang = "Distribution dimension", - ), - - # Il faut un vecteur P de taille N - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**', - ), - - ), # Fin BLOC MULTINOMIAL - - - - NORMAL = BLOC ( condition = " Kind in ( 'Normal', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter", - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0", - ), - - ), # Fin BLOC NORMAL - - - - POISSON = BLOC ( condition = " Kind in ( 'Poisson', ) ", - - Lambda = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Lambda de la loi | Lambda > 0", - ang = "Lambda parameter | Lambda > 0", - ), - - ), # Fin BLOC POISSON - - - - STUDENT = BLOC ( condition = " Kind in ( 'Student', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter", - ), - - Nu = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 2., - fr = "Parametre Nu de la loi | V > = 2", - ang = "Nu parameter | V > = 2", - ), - - ), # Fin BLOC STUDENT - - - - TRIANGULAR = BLOC ( condition = " Kind in ( 'Triangular', ) ", - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = M < = B", - ang = "Lower bound | A < = M < = B", - ), - - M = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Mode de la loi | A < = M < = B", - ang = "Mode | A < = M < = B", - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = M < = B", - ang = "Upper bound | A < = M < = B", - ), - - ), # Fin BLOC TRIANGULAR - - - - TRUNCATEDNORMAL = BLOC ( condition = " Kind in ( 'TruncatedNormal', ) ", - - MuN = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter", - ), - - SigmaN = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre SigmaN de la loi | SigmaN > 0", - ang = "SigmaN parameter | SigmaN> 0", - ), - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = B", - ang = "Lower bound | A < = B", - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = B", - ang = "Upper bound | A < = B", - ), - - ), # Fin BLOC TRUNCATEDNORMAL - - - - UNIFORM = BLOC ( condition = " Kind in ( 'Uniform', ) ", - - A = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne inferieure de la loi | A < = B", - ang = "Lower bound | A < = B", - ), - - B = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Borne superieure de la loi | A < = B", - ang = "Upper bound | A < = B", - ), - - ), # Fin BLOC UNIFORM - - - - USERDEFINED = BLOC ( condition = " Kind in ( 'UserDefined', ) ", - - # Il faut definir une collection de couples ( x,p ) - Values = SIMP ( statut = 'o', - typ = 'R', - max = '**', - ), - - ), # Fin BLOC USERDEFINED - - - - WEIBULL = BLOC ( condition = " Kind in ( 'Weibull', ) ", - - Settings = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "AlphaBeta", "MuSigma" ), - defaut = "AlphaBeta", - fr = "Parametrage de la loi weibull", - ang = "Weibull distribution parameter set", - ), - - AlphaBeta_Parameters = BLOC ( condition = " Settings in ( 'AlphaBeta', ) ", - - Alpha = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Alpha de la loi | Alpha > 0", - ang = "Alpha parameter | Alpha > 0", - ), - - Beta = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Beta de la loi | Beta > 0", - ang = "Beta parameter | Beta > 0", - ), - - ), # Fin BLOC AlphaBeta_Parameters - - - MuSigma_Parameters = BLOC ( condition = " Settings in ( 'MuSigma', ) ", - - Mu = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Mu de la loi", - ang = "Mu parameter", - ), - - Sigma = SIMP ( statut = "o", - typ = "R", - max = 1, - val_min = 0., - fr = "Parametre Sigma de la loi | Sigma > 0", - ang = "Sigma parameter | Sigma > 0", - ), - - ), # Fin BLOC MuSigma_Parameters - - Gamma = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Parametre Gamma", - ang = "Gamma parameter", - ), - - ), # Fin BLOC WEIBULL - -) # Fin OPER DISTRIBUTION - - - - - - -#================================ -# 3. Definition de l'etude -#================================ - -# Nota : les variables de type PROC doivent etre en majuscules ! -CRITERIA = PROC ( nom = "CRITERIA", - op = None, - docu = "", - fr = "Mise en donnee pour le fichier de configuration de OPENTURNS.", - ang = "Writes the configuration file for OPENTURNS.", - - - - Type = SIMP ( statut = "o", - typ = "TXM", - into = ( "Min/Max", "Central Uncertainty", "Threshold Exceedence" ), - fr = "Type d'Analyse", - ang = "Analysis", - ), - - - - - - - - MinMax = BLOC ( condition = " Type in ( 'Min/Max', ) ", - - Method = SIMP ( statut = "o", - typ = "TXM", - into = ( "Experiment Plane", "Random Sampling" ), - fr = "Methode", - ang = "Method", - ), - # UC 3.1.1 - ExperimentPlaneSettings = BLOC ( condition = " Method in ( 'Experiment Plane', ) ", - - ExperimentPlane = SIMP ( statut = "o", - typ = "TXM", - into = ( "Axial", "Factorial", "Composite", ), - fr = "Methode", - ang = "Method", - ), - - Levels = SIMP ( statut = "o", - typ = "R", - val_min = 0.0, - max = '**', - fr = "Nombre de niveaux dans chaque direction", - ang = "Levels in each direction", - ), - - # Scaled Vector - UnitsPerDimension = SIMP ( statut = "o", - typ = "R", - max = '**', - fr = "Unite par dimension (autant que de variables declarees)", - ang = "Units per dimension (as much as declared variables)", - ), - - # Translation Vector - Center = SIMP ( statut = "o", - typ = "R", - max = '**', - fr = "Unite par dimension", - ang = "Units per dimension", - ), - - ), # Fin BLOC ExperimentPlaneSettings - - - - RandomSamplingSettings = BLOC ( condition = " Method in ( 'Random Sampling', ) ", - - PointsNumber = SIMP ( statut = "o", - typ = "I", - val_min = 1, - fr = "Nombre de points", - ang = "Points number", - ), - - ), # Fin BLOC RandomSamplingSettings - - Result = SIMP ( statut = "o", - typ = "TXM", - into = ( "Min/Max", ), - defaut = "Min/Max", - fr = "Le minimum et le maximum", - ang = "The min and max values", - ), - - - ), # Fin BLOC MinMax - - - - - CentralUncertainty = BLOC ( condition = " Type in ( 'Central Uncertainty', ) ", - - Method = SIMP ( statut = "o", - typ = "TXM", - into = ( "Taylor Variance Decomposition", "Random Sampling" ), - fr = "Methode", - ang = "Method", - ), - - # UC 3.2. - TaylorVarianceDecompositionSettings = BLOC ( condition = " Method in ( 'Taylor Variance Decomposition', ) ", - - Result = FACT ( statut = "o", - min = 1, - max = "**", - - MeanFirstOrder = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Moyenne au premier ordre", - ang = "MeanFirstOrder", - ), - - StandardDeviationFirstOrder = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Ecart-type au premier ordre", - ang = "StandardDeviationFirstOrder", - ), - - MeanSecondOrder = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Moyenne au second ordre", - ang = "MeanSecondOrder", - ), - - ImportanceFactor = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Facteur d'importance pour variable de sortie scalaire", - ang = "ImportanceFactor", - ), - - ImportanceFactorSettings = BLOC ( condition = " ImportanceFactor in ( 'yes', ) ", - - NumericalResults = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Resultats numeriques", - ang = "NumericalResults", - ), - - GraphicalResults = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Resultats graphiques", - ang = "GraphicalResults", - ), - - ), # Fin BLOC ImportanceFactorSettings - - ), # Fin FACT Result - - ), # Fin BLOC TaylorVarianceDecompositionSettings - - - - RandomSamplingSettings = BLOC ( condition = " Method in ( 'Random Sampling', ) ", - - PointsNumber = SIMP ( statut = "o", - typ = "I", - val_min = 1, - fr = "Nombre de points", - ang = "Points number", - ), - - Result = FACT ( statut = "o", - min = 1, - max = "**", - - EmpiricalMean = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Moyenne empirique", - ang = "Empirical mean", - ), - - EmpiricalStandardDeviation = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Ecart-type empirique", - ang = "Empirical standard deviation", - ), - - EmpiricalQuantile = SIMP ( statut = "o", - typ = 'R', - defaut = 0.0, - max = 1, - val_min = 0.0, - val_max = 1.0, - fr = "Quantile empirique", - ang = "Empirical quantile", - ), - - AnalysedCorrelations = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Correlations analysees", - ang = "Analysed correlations", - ), - - KernelSmoothing = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Kernel smoothing de l'echantillon", - ang = "Kernel smoothing of the sample", - ), - - ), # Fin FACT Result - - ), # Fin BLOC RandomSamplingSettings - - ), # Fin BLOC CentralUncertainty - - - - - ThresholdExceedence = BLOC ( condition = " Type in ( 'Threshold Exceedence', ) ", - - Event = FACT ( statut = "o", - min = 1, - max = 1, - - Threshold = SIMP ( statut = "o", - typ = "R", - max = 1, - fr = "Le seuil de defaillance", - ang = "Failure threshold", - ), - - ComparisonOperator = SIMP ( statut = "o", - typ = "TXM", - max = 1, - into = ( "Less", "LessOrEqual", "Equal", "GreaterOrEqual", "Greater" ), - fr = "Que faut-il ne pas depasser : un maximum ou un minimum", - ang = "What is the failure threshold : maximum or minimum", - ), - ), # Fin FACT Event - - - Method = SIMP ( statut = "o", - typ = "TXM", - into = ( "Simulation", "Analytical" ), - fr = "Methode", - ang = "Method", - ), - - SimulationSettings = BLOC ( condition = " Method in ( 'Simulation', ) ", - - Algorithm = SIMP ( statut = "o", - typ = "TXM", - into = ( "MonteCarlo", "LHS", "ImportanceSampling" ), - fr = "Algorithme de simulation", - ang = "Simulation algorithm", - ), - - - RandomGenerator = FACT ( statut = "o", - min = 1, - max = 1, - - SeedToBeSet = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "La racine du generateur aleatoire doit-elle etre positionnee ?", - ang = "Does the random generator seed need to be set ?", - ), - - SeedSettings = BLOC ( condition = " SeedToBeSet in ( 'yes', ) ", - - RandomGeneratorSeed = SIMP ( statut = "o", - typ = "I", - max = 1, - fr = "Racine du generateur aleatoire", - ang = "Random generator seed", - ), - - ), # Fin BLOC SeedSettings - - ), # Fin FACT RandomGenerator - - - BlockSize = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - defaut = 1, - fr = "Nombre de calculs realises en bloc", - ang = "Number of computations as a block", - ), - - MaximumOuterSampling = SIMP ( statut = "o", - typ = "I", - max = 1, - val_min = 1, - fr = "Maximum d'iterations externes", - ang = "Maximum outer Sampling value", - ), - - MaximumCoefficientOfVariation = SIMP ( statut = "f", - typ = "R", - max = 1, - defaut = 0.1, - val_min = 0.0, - fr = " maximum ...", - ang = "Absolute maximum ...." - ), - - ImportanceSamplingSettings = BLOC ( condition = " Algorithm in ( 'ImportanceSampling', ) ", - - MeanVector = SIMP ( statut = "o", - typ = "R", - max = "**", - fr = "Moyenne", - ang = "Mean vector", - ), - - Correlation = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'Independent', 'Linear' ), - defaut = 'Linear', - max = 1, - fr = "Le type de correlation entre les variables", - ang = "Correlation between variables", - ), - - ), # Fin BLOC ImportanceSamplingSettings - - Result = FACT ( statut = "o", - min = 1, - max = "**", - - Probability = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', ), - defaut = 'yes', - max = 1, - fr = "Probabiblite", - ang = "Probability", - ), - - ConfidenceInterval = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Ecart-type empirique", - ang = "Empirical standard deviation", - ), - - ConfidenceIntervalSettings = BLOC ( condition = " ConfidenceInterval in ( 'yes', ) ", - - Level = SIMP ( statut = "o", - typ = 'R', - defaut = 0.0, - max = 1, - val_min = 0.0, - val_max = 1.0, - fr = "Niveau de confiance", - ang = "Confidence level", - ), - - ), # Fin BLOC ConfidenceIntervalSettings - - VariationCoefficient = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Coefficient de variation", - ang = "VariationCoefficient", - ), - - IterationNumber = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Nombre d'iterations", - ang = "Iteration number", - ), - - ConvergenceGraph = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Graphe de convergence", - ang = "Convergence graph", - ), - - ), # Fin FACT Result - - - - ), # Fin BLOC SimulationSettings - - - - AnalyticalSettings = BLOC ( condition = " Method in ( 'Analytical', ) ", - - Approximation = SIMP ( statut = "o", - typ = "TXM", - into = ( "FORM", "SORM" ), - fr = "Approximation", - ang = "Approximation", - ), - - OptimizationAlgorithm = SIMP ( statut = "o", - typ = "TXM", - into = ( "Cobyla", "AbdoRackwitz" ), - fr = "Methode d'optimisation", - ang = "Optimisation method", - ), - - - PhysicalStartingPoint = SIMP ( statut = "f", - typ = "R", - max = "**", - fr = "Point de demarrage de l'algorithme iteratif", - ang = "Initial point for iterative process", - ), - - MaximumIterationsNumber = SIMP ( statut = "f", - typ = "I", - max = 1, - val_min = 1, - fr = "Nombre maximum d iterations", - ang = "Maximum number of iterations", - ), - - regles = ( EXCLUS ( "MaximumAbsoluteError", "RelativeAbsoluteError" ), ), - - MaximumAbsoluteError = SIMP ( statut = "f", - typ = "R", - max = 1, - defaut = 1E-6, - val_min = 0.0, - fr = "Distance maximum absolue entre 2 iterations successifs", - ang = "Absolute maximum distance between 2 successive iterates", - ), - - RelativeAbsoluteError = SIMP ( statut = "f", - typ = "R", - max = 1, - defaut = 1E-6, - val_min = 0.0, - fr = "Distance maximum relative entre 2 iterations successives", - ang = "Relative maximum distance between 2 successive iterates", - ), - - MaximumConstraintError = SIMP ( statut = "f", - typ = "R", - max = 1, - val_min = 0.0, - fr = "Valeur maximum absolue de la fonction moins la valeur du niveau", - ang = "Maximum absolute value of the constraint function minus the level value", - ), - - ImportanceSampling = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Tirage d'importance au point de conception", - ang = "Importance sampling at design point", - ), - - FORM = BLOC ( condition = " Approximation in ( 'FORM', ) ", - - Probability = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', ), - defaut = 'yes', - max = 1, - fr = "Probabiblite", - ang = "Probability", - ), - - DesignPoint = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Point de conception", - ang = "Design point", - ), - - HasReliabilityIndex = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Indice de fiabilite", - ang = "Reliability index", - ), - - ImportanceFactor = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Facteur d'importance pour variable de sortie scalaire", - ang = "ImportanceFactor", - ), - - ImportanceFactorSettings = BLOC ( condition = " ImportanceFactor in ( 'yes', ) ", - - NumericalResults = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Resultats numeriques", - ang = "NumericalResults", - ), - - GraphicalResults = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Resultats graphiques", - ang = "GraphicalResults", - ), - - ), # Fin BLOC ImportanceFactorSettings - - - SensitivityAnalysis = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Analyse de sensibilite", - ang = "Sensitivity analysis", - ), - - SensitivityAnalysisSettings = BLOC ( condition = " SensitivityAnalysis in ( 'yes', ) ", - - HasoferReliabilityIndex = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Indice de fiabilite de Hasofer", - ang = "Hasofer reliability index", - ), - - HasoferReliabilityIndexSettings = BLOC ( condition = " HasoferReliabilityIndex in ( 'yes', ) ", - - NumericalResults = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Resultats numeriques", - ang = "NumericalResults", - ), - - GraphicalResults = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Resultats graphiques", - ang = "GraphicalResults", - ), - - ), # Fin BLOC HasoferReliabilityIndexSettings - - ), # Fin BLOC SensitivityAnalysisSettings - - FunctionCallsNumber = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Nombre d'appels a la fonction", - ang = "Function calls number", - ), - - - ), # Fin BLOC FORM - - - SORM = BLOC ( condition = " Approximation in ( 'SORM', ) ", - - - TvedtApproximation = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Approximation de Tvedt", - ang = "Tvedt approximation", - ), - - HohenBichlerApproximation = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Approximation de HohenBichler", - ang = "HohenBichler approximation", - ), - - BreitungApproximation = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Approximation de Breitung", - ang = "Breitung approximation", - ), - - DesignPoint = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Point de conception", - ang = "Design point", - ), - - ImportanceFactor = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Facteur d'importance pour variable de sortie scalaire", - ang = "ImportanceFactor", - ), - - ImportanceFactorSettings = BLOC ( condition = " ImportanceFactor in ( 'yes', ) ", - - NumericalResults = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Resultats numeriques", - ang = "NumericalResults", - ), - - GraphicalResults = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Resultats graphiques", - ang = "GraphicalResults", - ), - - ), # Fin BLOC ImportanceFactorSettings - - - SensitivityAnalysis = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Analyse de sensibilite", - ang = "Sensitivity analysis", - ), - - SensitivityAnalysisSettings = BLOC ( condition = " SensitivityAnalysis in ( 'yes', ) ", - - HasoferReliabilityIndex = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Indice de fiabilite de Hasofer", - ang = "Hasofer reliability index", - ), - - HasoferReliabilityIndexSettings = BLOC ( condition = " HasoferReliabilityIndex in ( 'yes', ) ", - - NumericalResults = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'yes', - max = 1, - fr = "Resultats numeriques", - ang = "NumericalResults", - ), - - GraphicalResults = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Resultats graphiques", - ang = "GraphicalResults", - ), - - ), # Fin BLOC HasoferReliabilityIndexSettings - - ), # Fin BLOC SensitivityAnalysisSettings - - FunctionCallsNumber = SIMP ( statut = "o", - typ = 'TXM', - into = ( 'yes', 'no' ), - defaut = 'no', - max = 1, - fr = "Nombre d'appels a la fonction", - ang = "Function calls number", - ), - - - ), # Fin BLOC SORM - - - - ), # Fin BLOC AnalyticalSettings - - - - ), # Fin BLOC ThresholdExceedence - - - -) # Fin PROC CRITERIA - - - - - - - diff --git a/Openturns_Study/catalogues_openturns.ini b/Openturns_Study/catalogues_openturns.ini index 511e50a2..8a16ff62 100644 --- a/Openturns_Study/catalogues_openturns.ini +++ b/Openturns_Study/catalogues_openturns.ini @@ -6,7 +6,7 @@ rep_cata=os.getcwd() catalogues = ( # (code,version,catalogue,formatIn,formatOut) #('OPENTURNS_WRAPPER','V1',os.path.join(rep_cata,'OpenTURNS_Cata_Wrapper_V1.py'),'openturns_wrapper','wrapper'), - ('OPENTURNS_STUDY','V2',os.path.join(rep_cata,'OpenTURNS_Cata_Study_V2.py'),'openturns_study','wrapper'), + ('OPENTURNS_STUDY','V1',os.path.join(rep_cata,'OpenTURNS_Cata_Study.py'),'openturns_study','wrapper'), #('OPENTURNS','Wrapper',os.path.join(rep_cata,'OpenTURNS_Cata_Wrapper_V1.py'),'openturns'), ) diff --git a/Openturns_Study/test/MinMax_ExpPlane.comm b/Openturns_Study/test/MinMax_ExpPlane.comm deleted file mode 100644 index 6f671ab3..00000000 --- a/Openturns_Study/test/MinMax_ExpPlane.comm +++ /dev/null @@ -1,17 +0,0 @@ - -LOG(DebugMessages='no', - WrapperMessages='no', - UserMessages='no', - InfoMessages='yes', - WarningMessages='yes', - ErrorMessages='yes',); - -MODEL(Name='poutre',); - -CRITERIA(Type='Min/Max', - Method='Experiment Plane', - ExperimentPlane='Axial', - Levels=(1.0,2.0,5.0,), - UnitsPerDimension=(100.0,5.0,0.5,1e-07,), - Center=(3000000000.0,300.0,2.5,4e-06,), - Result='Min/Max',); diff --git a/Openturns_Study/test/MinMax_ExpPlane.py b/Openturns_Study/test/MinMax_ExpPlane.py deleted file mode 100644 index 098c853e..00000000 --- a/Openturns_Study/test/MinMax_ExpPlane.py +++ /dev/null @@ -1,68 +0,0 @@ -#! /usr/bin/env python - -# Chargement du module systeme -import sys -sys.path.append( '/local00/home/dutka/OpenTURNS/trunk/build/install/lib/python2.4/site-packages/openturns' ) - -# Chargement du module Open TURNS -from openturns import * - -# Definit le niveau d'affichage de la log -flags = Log.NONE -flags = flags + Log.WARN -flags = flags + Log.ERROR -flags = flags - Log.WRAPPER -flags = flags + Log.INFO -flags = flags - Log.USER -flags = flags - Log.DBG -Log.Show( flags ) - -# Etude 'Min/Max' -# Charge le modele physique -model = NumericalMathFunction( 'poutre' ) -n = model.getInputNumericalPointDimension() - -# Etude par plan d'experience -# Definit les niveaux de la structure de grille -levels = NumericalPoint( 3 ) -levels[0] = 1 -levels[1] = 2 -levels[2] = 5 - -# Cree le plan d'experience centre reduit -myCenteredReductedGrid = Axial(n, levels) -myExperimentPlane = myCenteredReductedGrid.generate() - -# Definit les facteurs d'echelle dans chaque direction -scaledVector = NumericalPoint( n ) -scaledVector[0] = 100 -scaledVector[1] = 5 -scaledVector[2] = 0.5 -scaledVector[3] = 1e-07 -myExperimentPlane.scale( scaledVector ) - -# Definit le vecteur de translation -translationVector = NumericalPoint( n ) -translationVector[0] = 3e+09 -translationVector[1] = 300 -translationVector[2] = 2.5 -translationVector[3] = 4e-06 -myExperimentPlane.translate( translationVector ) - - -inputSample = myExperimentPlane - -# Calcul -outputSample = model( inputSample ) - -# Resultats -minValue = outputSample.getMin() -maxValue = outputSample.getMax() - -print 'minValue = ', minValue -print 'maxValue = ', maxValue - - - -# Terminaison du fichier -sys.exit( 0 ) diff --git a/Openturns_Study/test/MinMax_RandomSampling.comm b/Openturns_Study/test/MinMax_RandomSampling.comm deleted file mode 100644 index e9ed474b..00000000 --- a/Openturns_Study/test/MinMax_RandomSampling.comm +++ /dev/null @@ -1,30 +0,0 @@ - -LOG(DebugMessages='no', - WrapperMessages='no', - UserMessages='no', - InfoMessages='yes', - WarningMessages='yes', - ErrorMessages='yes',); - -MODEL(Name='poutre',); - -L_E=DISTRIBUTION(Kind='Normal', - Mu=0.1, - Sigma=0.1,); - -L_F=DISTRIBUTION(Kind='Exponential', - Lambda=1.0, - Gamma=2.0,); - -L_L=DISTRIBUTION(Kind='MultiNomial', - N=1, - Values=1.0,); - -L_I=DISTRIBUTION(Kind='Uniform', - A=10.0, - B=20.0,); - -CRITERIA(Type='Min/Max', - Method='Random Sampling', - PointsNumber=1000, - Result='Min/Max',); diff --git a/generator/OpenturnsBase.py b/generator/OpenturnsBase.py index da8da81f..316a34eb 100644 --- a/generator/OpenturnsBase.py +++ b/generator/OpenturnsBase.py @@ -30,7 +30,7 @@ class Generateur : ListeVariables : chaque variable est decrite par un dictionnaire ; cette liste les regroupe DictLois : dictionnaires des lois ''' - def __init__ (self, appli, DictMCVal, ListeVariables, DictLois ) : + def __init__ (self, DictMCVal, ListeVariables, DictLois ) : #---------------------------------------------------------# self.ListeVariables = ListeVariables self.ListeVariablesIn = [] @@ -39,7 +39,6 @@ class Generateur : self.DictTypeVar = {} self.nbVarIn = 0 self.creeInfoVar() - self.appli = appli # # On charge eventuellement le Solver par defaut # et les valeurs par defaut du Solver (dans l init) @@ -62,7 +61,7 @@ class Generateur : monSTDGenerateur=gener( self.DictMCVal, self.ListeVariablesIn, self.DictLois ) except : from OpenturnsSTD import STDGenerateur - monSTDGenerateur = STDGenerateur( self.appli, self.DictMCVal, self.ListeVariablesIn, self.DictLois ) + monSTDGenerateur = STDGenerateur( self.DictMCVal, self.ListeVariablesIn, self.DictLois ) return monSTDGenerateur def getXMLGenerateur(self) : @@ -72,7 +71,7 @@ class Generateur : monXMLGenerateur=gener( self.DictMCVal, self.ListeVariables, self.DictLois ) except : from OpenturnsXML import XMLGenerateur - monXMLGenerateur = XMLGenerateur( self.appli, self.DictMCVal, self.ListeVariables, self.DictLois ) + monXMLGenerateur = XMLGenerateur( self.DictMCVal, self.ListeVariables, self.DictLois ) return monXMLGenerateur def creeInfoVar (self) : diff --git a/generator/OpenturnsSTD.py b/generator/OpenturnsSTD.py index dba6a227..bbe2873d 100644 --- a/generator/OpenturnsSTD.py +++ b/generator/OpenturnsSTD.py @@ -10,33 +10,7 @@ __revision__ = "V1.0" import os -defaultSTD = """#! /usr/bin/env python -class StudyFileGenerationError: - def __init__ (self, st): - self.st = st - def __str__(self): - return "'%s'" % self.st - -raise StudyFileGenerationError, "The study file was not generated" -""" - -headerSTD = """#! /usr/bin/env python - -# Chargement du module systeme -import sys -sys.path.append( '%s' ) - -# Chargement du module Open TURNS -from openturns import * - -""" - -footerSTD = """ - -# Terminaison du fichier -sys.exit( 0 ) -""" #============================================= # La classe de creation du fichier STD @@ -47,518 +21,18 @@ class STDGenerateur : ''' Generation du fichier python ''' - def __init__ (self, appli, DictMCVal, ListeVariables, DictLois ) : + def __init__ (self, DictMCVal, ListeVariables, DictLois ) : self.DictMCVal = DictMCVal self.ListeVariables = ListeVariables self.DictLois = DictLois print "DictMCVal=", DictMCVal print "ListeVariables=", ListeVariables print "DictLois=", DictLois - self.texteSTD = defaultSTD - self.OpenTURNS_path = appli.CONFIGURATION.OpenTURNS_path - - # Ce dictionnaire fait la correspondance entre le mot lu dans le dictionnaire des mots-clefs et la methode a appeler - self.traitement = { - "Min/Max" : "MinMax", - "Central Uncertainty" : "CentralUncertainty", - "Threshold Exceedence" : "ThresholdExceedence", - "Experiment Plane" : "ExperimentPlane", - "Random Sampling" : "RandomSampling", - } - - # Ce dictionnaire liste le nom des variables utilisees dans le script - # La clef est le nom attendu par les methodes, la valeur est le nom produit dans le fichier de sortie - # Le fait de passer par un dictionnaire permet de controler que les variables existent et sont correctement nommees - # meme si clef == valeur - self.variable = { - "n" : "n", - "p" : "p", - "model" : "model", - "scaledVector" : "scaledVector", - "translationVector" : "translationVector", - "levels" : "levels", - "myCenteredReductedGrid" : "myCenteredReductedGrid", - "myExperimentPlane" : "myExperimentPlane", - "inputSample" : "inputSample", - "outputSample" : "outputSample", - "minValue" : "minValue", - "maxValue" : "maxValue", - "flags" : "flags", - "inSize" : "inSize", - "distribution" : "distribution", - "marginal" : "marginal", - "collection" : "collection", - "copula" : "copula", - "inputRandomVector" : "inputRandomVector", - "outputRandomVector" : "outputRandomVector", - } - # Ce dictionnaire fait la correspondance entre le mot-clef du catalogue et le flag de la bibliotheque - self.logFlags = { - "DebugMessages" : "Log.DBG", - "WrapperMessages" : "Log.WRAPPER", - "UserMessages" : "Log.USER", - "InfoMessages" : "Log.INFO", - "WarningMessages" : "Log.WARN", - "ErrorMessages" : "Log.ERROR", - } - def CreeSTD (self) : ''' Pilotage de la creation du fichier python ''' - TypeAnalyse = None - if ( self.DictMCVal.has_key( 'Type' ) ): - TypeAnalyse = self.DictMCVal[ 'Type' ] - - Traitement = None - if ( self.traitement.has_key( TypeAnalyse ) ): - Traitement = self.traitement[ TypeAnalyse ] - - if ( Traitement is not None ): - self.texteSTD = apply( STDGenerateur.__dict__[ Traitement ], (self,) ) - - return self.texteSTD - - def Header (self) : - ''' - Imprime l entete commun a tous les fichiers - ''' - txt = headerSTD % self.OpenTURNS_path - txt += "# Definit le niveau d'affichage de la log\n" - txt += "%s = Log.NONE\n" % self.variable["flags"] - for flag in self.logFlags.keys(): - if ( self.DictMCVal.has_key( flag ) ): - val = self.DictMCVal[ flag ] - op = "-" - if val == 'yes' : - op = "+" - txt += "%s = %s %s %s\n" % (self.variable["flags"], self.variable["flags"], op, self.logFlags[ flag ]) - txt += "Log.Show( %s )\n" % self.variable["flags"] - txt += "\n" - return txt - - def Footer (self) : - ''' - Imprime le pied de page commun a tous les fichiers - ''' - return footerSTD - - def MinMax (self): - ''' - Produit le fichier study correspondant a une analyse Min/Max - ''' - txt = self.Header() - txt += "# Etude 'Min/Max'\n" - - txt += self.Model() - - Methode = None - if ( self.DictMCVal.has_key( 'Method' ) ): - Methode = self.DictMCVal[ 'Method' ] - - Traitement = None - if ( self.traitement.has_key( Methode ) ): - Traitement = self.traitement[ Methode ] - - if ( Traitement is not None ): - txt += apply( STDGenerateur.__dict__[ Traitement ], (self,) ) - - txt += self.MinMaxComputation() - txt += self.MinMaxResult() - - txt += self.Footer() - return txt - - def Model (self): - ''' - Importe le modele physique - ''' - fonction = None - if ( self.DictMCVal.has_key( 'Name' ) ): - fonction = self.DictMCVal[ 'Name' ] - - txt = "# Charge le modele physique\n" - txt += "%s = NumericalMathFunction( '%s' )\n" % (self.variable["model"], fonction) - txt += "%s = %s.getInputNumericalPointDimension()\n" % (self.variable["n"], self.variable["model"]) - txt += "\n" - return txt - - def ExperimentPlane (self): - ''' - Etude par plan d experience - ''' - txt = "# Etude par plan d'experience\n" - txt += self.Levels() - txt += self.CenteredReductedGrid() - txt += self.ScaledVector() - txt += self.TranslationVector() - txt += "%s = %s\n" % (self.variable["inputSample"], self.variable["myExperimentPlane"]) - txt += "\n" - return txt - - def RandomSampling (self): - ''' - Etude par echantillonage aleatoire - ''' - size = 0 - if ( self.DictMCVal.has_key( 'PointsNumber' ) ): - size = self.DictMCVal[ 'PointsNumber' ] - - 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" - 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.DictLois )) - txt += "\n" - i = 0 - for concept in self.DictLois.keys(): - loi = self.DictLois[ concept ] - if loi.has_key( 'Kind' ): - 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[ %d ] = Distribution( %s )\n" % (self.variable["collection"], i, marginale) - txt += "\n" - i += 1 - - 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 += "\n" - return txt - - def Copula (self): - ''' - Cree la copule de la loi jointe - ''' - txt = "# Definit la copule de la loi jointe\n" - txt += "%s = IndependentCopula()\n" % self.variable["copula"] - txt += "\n" - return txt + return 'Zloup !' - def InputRandomVector (self): - ''' - Cree le vector aleatoire d entree - ''' - txt = "# Definit le vecteur aleatoire d'entree\n" - txt += "%s = RandomVector( %s )\n" % (self.variable["inputRandomVector"], self.variable["distribution"]) - txt += "\n" - return txt - - def ScaledVector (self): - ''' - Definit les coefficients multiplicateurs par composante du vecteur - ''' - dimension = 0 - if ( self.DictMCVal.has_key( 'UnitsPerDimension' ) ): - unitsPerDimension = self.DictMCVal[ 'UnitsPerDimension' ] - dimension = len( unitsPerDimension ) - - txt = "# Definit les facteurs d'echelle dans chaque direction\n" - txt += "%s = NumericalPoint( %s )\n" % (self.variable["scaledVector"], self.variable["n"]) - for i in range(dimension): - txt += "%s[%d] = %g\n" % (self.variable["scaledVector"], i, unitsPerDimension[i]) - txt += "%s.scale( %s )\n" % (self.variable["myExperimentPlane"], self.variable["scaledVector"]) - txt += "\n" - return txt - - def TranslationVector (self): - ''' - Definit le vecteur de translation - ''' - dimension = 0 - if ( self.DictMCVal.has_key( 'Center' ) ): - center = self.DictMCVal[ 'Center' ] - dimension = len( center ) - - txt = "# Definit le vecteur de translation\n" - txt += "%s = NumericalPoint( %s )\n" % (self.variable["translationVector"], self.variable["n"]) - for i in range(dimension): - txt += "%s[%d] = %g\n" % (self.variable["translationVector"], i, center[i]) - txt += "%s.translate( %s )\n" % (self.variable["myExperimentPlane"], self.variable["translationVector"]) - txt += "\n" - return txt - - def Levels (self): - ''' - Definit les niveaux du plan d experience - ''' - dimension = 0 - if ( self.DictMCVal.has_key( 'Levels' ) ): - levels = self.DictMCVal[ 'Levels' ] - dimension = len( levels ) - - txt = "# Definit les niveaux de la structure de grille\n" - txt += "%s = NumericalPoint( %d )\n" % (self.variable["levels"], dimension) - for i in range(dimension): - txt += "%s[%d] = %g\n" % (self.variable["levels"], i, levels[i]) - txt += "\n" - return txt - - def CenteredReductedGrid (self): - ''' - Definit la grille reduite du plan d experience - ''' - plane = None - if ( self.DictMCVal.has_key( 'ExperimentPlane' ) ): - plane = self.DictMCVal[ 'ExperimentPlane' ] - - txt = "# Cree le plan d'experience centre reduit\n" - txt += "%s = %s(%s, %s)\n" % (self.variable["myCenteredReductedGrid"], plane, self.variable["n"], self.variable["levels"]) - txt += "%s = %s.generate()\n" % (self.variable["myExperimentPlane"], self.variable["myCenteredReductedGrid"]) - 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 += "%s = %s.getMax()\n" % (self.variable["maxValue"], self.variable["outputSample"]) - txt += "\n" - txt += "print '%s = ', %s\n" % (self.variable["minValue"], self.variable["minValue"]) - txt += "print '%s = ', %s\n" % (self.variable["maxValue"], self.variable["maxValue"]) - txt += "\n" - return txt - - def CentralUncertainty (self): - ''' - Produit le fichier study correspondant a une analyse d incertitude en valeur centrale - ''' - txt = self.Header() - txt += "# Etude 'Central Uncertainty'\n\n" - txt += self.Footer() - return txt - - def ThresholdExceedence (self): - ''' - Produit le fichier study correspondant a une analyse de depassement de seuil - ''' - txt = self.Header() - txt += "# Etude 'Threshold Exceedence'\n\n" - txt += self.Footer() - return txt - - def Beta (self, loi, i, collection): - ''' - Definition de la loi Beta - ''' - settings = { - "RT" : "Beta.RT", - "MuSigma" : "Beta.MUSIGMA", - } - if loi[ 'Settings' ] == 'RT' : - arg1 = loi[ 'R' ] - arg2 = loi[ 'T' ] - else : - arg1 = loi[ 'Mu' ] - arg2 = loi[ 'Sigma' ] - - arg3 = loi[ 'A' ] - arg4 = loi[ 'B' ] - txt = "Beta( %g, %g, %g, %g, %s )" % (arg1, arg2, arg3, arg4, settings[ loi[ 'Settings' ] ]) - return txt - - def Exponential (self, loi, i, collection): - ''' - Definition de la loi Exponential - ''' - arg1 = loi[ 'Lambda' ] - arg2 = loi[ 'Gamma' ] - txt = "Exponential( %g, %g )" % (arg1, arg2) - return txt - def Gamma (self, loi, i, collection): - ''' - Definition de la loi Gamma - ''' - settings = { - "KLambda" : "Gamma.KLAMBDA", - "MuSigma" : "Gamma.MUSIGMA", - } - if loi[ 'Settings' ] == 'KLambda' : - arg1 = loi[ 'K' ] - arg2 = loi[ 'Lambda' ] - else : - arg1 = loi[ 'Mu' ] - arg2 = loi[ 'Sigma' ] - - arg3 = loi[ 'Gamma' ] - txt = "Gamma( %g, %g, %g, %s )" % (arg1, arg2, arg3, settings[ loi[ 'Settings' ] ]) - return txt - - def Geometric (self, loi, i, collection): - ''' - Definition de la loi Geometric - ''' - txt = "Geometric( %g )" % loi[ 'P' ] - return txt - - def Gumbel (self, loi, i, collection): - ''' - Definition de la loi Gumbel - ''' - settings = { - "AlphaBeta" : "Gamma.ALPHABETA", - "MuSigma" : "Gamma.MUSIGMA", - } - if loi[ 'Settings' ] == 'AlphaBeta' : - arg1 = loi[ 'Alpha' ] - arg2 = loi[ 'Beta' ] - else : - arg1 = loi[ 'Mu' ] - arg2 = loi[ 'Sigma' ] - - txt = "Gamma( %g, %g, %s )" % (arg1, arg2, settings[ loi[ 'Settings' ] ]) - return txt - - def Histogram (self, loi, i, collection): - ''' - Definition de la loi Histogram - ''' - txt = "** Histogram not defined yet **" - return txt - - def Logistic (self, loi, i, collection): - ''' - Definition de la loi Logistic - ''' - arg1 = loi[ 'Alpha' ] - arg2 = loi[ 'Beta' ] - txt = "Logistic( %g, %g )" % (arg1, arg2) - return txt - - def LogNormal (self, loi, i, collection): - ''' - Definition de la loi LogNormal - ''' - settings = { - "MuSigmaLog" : "LogNormal.MUSIGMA_LOG", - "MuSigma" : "LogNormal.MUSIGMA", - "MuSigmaOverMu" : "LogNormal.MU_SIGMAOVERMU", - } - if loi[ 'Settings' ] == 'MuSigmaLog' : - arg1 = loi[ 'MuLog' ] - arg2 = loi[ 'SigmaLog' ] - elif loi[ 'Settings' ] == 'MuSigmaOverMu' : - arg1 = loi[ 'Mu' ] - arg2 = loi[ 'SigmaOverMu' ] - else : - arg1 = loi[ 'Mu' ] - arg2 = loi[ 'Sigma' ] - - arg3 = loi[ 'Gamma' ] - txt = "LogNormal( %g, %g, %g, %s )" % (arg1, arg2, arg3, settings[ loi[ 'Settings' ] ]) - return txt - - def MultiNomial (self, loi, i, collection): - ''' - Definition de la loi MultiNomial - ''' - arg1 = loi[ 'Values' ] - arg2 = loi[ 'N' ] - txt = "MultiNomial( NumericalPoint( %s ) , %d)" % (arg1, arg2) - return txt - - def Normal (self, loi, i, collection): - ''' - Definition de la loi Normal - ''' - arg1 = loi[ 'Mu' ] - arg2 = loi[ 'Sigma' ] - txt = "Normal( %g, %g )" % (arg1, arg2) - return txt - - def TruncatedNormal (self, loi, i, collection): - ''' - Definition de la loi TruncatedNormal - ''' - arg1 = loi[ 'MuN' ] - arg2 = loi[ 'SigmaN' ] - arg3 = loi[ 'A' ] - arg4 = loi[ 'B' ] - txt = "TruncatedNormal( %g, %g, %g, %g )" % (arg1, arg2, arg3, arg4) - return txt - - def Poisson (self, loi, i, collection): - ''' - Definition de la loi - ''' - txt = "Poisson( %g )" % loi[ 'Lambda' ] - 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) - return txt - - def Triangular (self, loi, i, collection): - ''' - Definition de la loi Triangular - ''' - arg1 = loi[ 'A' ] - arg2 = loi[ 'M' ] - arg3 = loi[ 'B' ] - txt = "Triangular( %g, %g, %g )" % (arg1, arg2, arg3) - return txt - - def Uniform (self, loi, i, collection): - ''' - Definition de la loi Uniform - ''' - arg1 = loi[ 'A' ] - arg2 = loi[ 'B' ] - txt = "Uniform( %g, %g )" % (arg1, arg2) - return txt - - def UserDefined (self, loi, i, collection): - ''' - Definition de la loi UserDefined - ''' - txt = "** UserDefined not defined yet **" - return txt - - def Weibull (self, loi, i, collection): - ''' - Definition de la loi Weibull - ''' - settings = { - "AlphaBeta" : "Weibull.ALPHABETA", - "MuSigma" : "Weibull.MUSIGMA", - } - if loi[ 'Settings' ] == 'AlphaBeta' : - arg1 = loi[ 'Alpha' ] - arg2 = loi[ 'Beta' ] - else : - arg1 = loi[ 'Mu' ] - arg2 = loi[ 'Sigma' ] - - arg3 = loi[ 'Gamma' ] - txt = "Weibull( %g, %g, %s )" % (arg1, arg2, arg3, settings[ loi[ 'Settings' ] ]) - return txt - diff --git a/generator/OpenturnsXML.py b/generator/OpenturnsXML.py index 0c12acb3..74903cac 100644 --- a/generator/OpenturnsXML.py +++ b/generator/OpenturnsXML.py @@ -60,11 +60,10 @@ class XMLGenerateur : ''' Generation du fichier XML ''' - def __init__ (self, appli, DictMCVal, ListeVariables, DictLois ) : + def __init__ (self, DictMCVal, ListeVariables, DictLois ) : self.DictMCVal = DictMCVal self.ListeVariables = ListeVariables self.DictLois = DictLois - self.appli = appli def CreeXML (self) : ''' diff --git a/generator/generator_openturns_study.py b/generator/generator_openturns_study.py index 7aad619d..be56baf9 100644 --- a/generator/generator_openturns_study.py +++ b/generator/generator_openturns_study.py @@ -115,7 +115,7 @@ class OpenturnsGenerator(PythonGenerator): def genereSTD(self): print "IDM: genereSTD dans generator_openturns_study.py" - MonBaseGenerateur=Generateur(self.appli,self.dictMCVal, self.listeVariables, self.dictMCLois) + MonBaseGenerateur=Generateur(self.dictMCVal, self.listeVariables, self.dictMCLois) MonGenerateur=MonBaseGenerateur.getSTDGenerateur() #try : if 1== 1 : diff --git a/generator/generator_openturns_wrapper.py b/generator/generator_openturns_wrapper.py index 4caa19a4..6db16932 100644 --- a/generator/generator_openturns_wrapper.py +++ b/generator/generator_openturns_wrapper.py @@ -109,7 +109,7 @@ class OpenturnsGenerator(PythonGenerator): #print "appli.CONFIGURATION=",self.appli.CONFIGURATION.__dict__ if self.listeFichiers != [] : self.dictMCVal["Files"]=self.listeFichiers - MonBaseGenerateur=Generateur(self.appli,self.dictMCVal, self.listeVariables, self.dictMCLois) + MonBaseGenerateur=Generateur(self.dictMCVal, self.listeVariables, self.dictMCLois) MonGenerateur=MonBaseGenerateur.getXMLGenerateur() #try : if 1== 1 :