]> SALOME platform Git repositories - tools/eficas.git/blob - Adao/ADAO_Cata_V0_V7_6_0.py
Salome HOME
avant PSEN
[tools/eficas.git] / Adao / ADAO_Cata_V0_V7_6_0.py
1 #-*-coding:iso-8859-1-*-
2 #
3 # Copyright (C) 2008-2015 EDF R&D
4 #
5 # This file is part of SALOME ADAO module
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 #
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #
23 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
24
25 # --------------------------------------------------------
26 # Generated by AdaoCatalogGenerator on 2015-06-10 11:34:00
27 # --------------------------------------------------------
28
29 import os, re
30 import Accas
31 from Accas import *
32
33 JdC = JDC_CATA (
34     code = 'ADAO',
35     execmodul = None,
36     regles = ( AU_MOINS_UN ('ASSIMILATION_STUDY','CHECKING_STUDY'), AU_PLUS_UN ('ASSIMILATION_STUDY','CHECKING_STUDY')),
37     )
38 VERSION_CATALOGUE='V7_6_0'
39
40 def NoCheckInNS(filename):
41     return 1
42 NoCheckInNS.info = ""
43 def DirectOperatorInNS(filename):
44     if os.path.exists(filename):
45         fc = open(filename, 'r').readlines()
46         cr = re.compile("^def[\s]*DirectOperator[\s]*\(")
47         for ln in fc:
48             if cr.match(ln): return 1
49         cr = re.compile("^DirectOperator[\s]*=")
50         for ln in fc:
51             if cr.match(ln): return 1
52     return 0
53 DirectOperatorInNS.info = u"The Python file has to contain explicitly a \"DirectOperator\" function definition with only one vector as argument."
54 def TangentOperatorInNS(filename):
55     if os.path.exists(filename):
56         fc = open(filename, 'r').readlines()
57         cr = re.compile("^def[\s]*TangentOperator[\s]*\(")
58         for ln in fc:
59             if cr.match(ln): return 1
60         cr = re.compile("^TangentOperator[\s]*=")
61         for ln in fc:
62             if cr.match(ln): return 1
63     return 0
64 TangentOperatorInNS.info = u"The Python file has to contain explicitly a \"TangentOperator\" function definition with only one pair of vectors as argument."
65 def AdjointOperatorInNS(filename):
66     if os.path.exists(filename):
67         fc = open(filename, 'r').readlines()
68         cr = re.compile("^def[\s]*AdjointOperator[\s]*\(")
69         for ln in fc:
70             if cr.match(ln): return 1
71         cr = re.compile("^AdjointOperator[\s]*=")
72         for ln in fc:
73             if cr.match(ln): return 1
74     return 0
75 AdjointOperatorInNS.info = u"The Python file has to contain explicitly an \"AdjointOperator\" function definition with only one pair of vectors as argument."
76
77 def F_VectorSerie(statut, fv=NoCheckInNS) : return FACT(
78     statut = statut,
79     FROM = SIMP(statut = "o", typ = "TXM", into=("String", "Script", ), defaut="Script"),
80     SCRIPT_DATA = BLOC ( condition = " FROM in ( 'Script', ) ",
81         SCRIPT_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(fv)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant si nécessaire la définition d'une variable interne de même nom que le concept parent", ang="Waiting for a script file name, with or without the full path to find it, containing if necessary the definition of an internal variable of the same name as the parent concept"),
82         ),
83     STRING_DATA = BLOC ( condition = " FROM in ( 'String', ) ",
84         STRING = SIMP(statut = "o", typ = "TXM", fr="En attente d'une chaine de caractères entre guillements. Pour construire un vecteur ou une matrice, ce doit être une suite de nombres, utilisant un espace ou une virgule pour séparer deux éléments et un point-virgule pour séparer deux lignes", ang="Waiting for a string in quotes. To build a vector or a matrix, it has to be a float serie, using a space or comma to separate two elements in a line, a semi-colon to separate rows"),
85         ),
86     SCRIPTWITHFUNCTIONS_DATA = BLOC ( condition = " FROM in ( 'ScriptWithFunctions', ) ",
87         SCRIPTWITHFUNCTIONS_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS), FunctionVal(TangentOperatorInNS), FunctionVal(AdjointOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variables internes trois fonctions de calcul nommées DirectOperator, TangentOperator et AdjointOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variables three computation functions named DirectOperator, TangentOperator and AdjointOperator"),
88         ),
89     SCRIPTWITHONEFUNCTION_DATA = BLOC ( condition = " FROM in ( 'ScriptWithOneFunction', ) ",
90         SCRIPTWITHONEFUNCTION_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variable interne une seule fonction de calcul nommée DirectOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variable only one function named DirectOperator"),
91         DifferentialIncrement = SIMP(statut="o", typ = "R", val_min=0, val_max=1, defaut=0.01, fr="Incrément de la perturbation dX pour calculer la dérivée, construite en multipliant X par l'incrément en évitant les valeurs nulles", ang="Increment of dX perturbation to calculate the derivative, build multiplying X by the increment avoiding null values"),
92         CenteredFiniteDifference = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Formulation centrée (1) ou décentrée (0) pour la méthode des différences finies", ang="Centered (1) or uncentered (0) formulation for the finite differences method"),
93         EnableMultiProcessing = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0, fr="Calculs élémentaires effectués en séquentiel (0) ou en parallèle (1) dans la méthode des différences finies", ang="Elementary calculations done sequentially (0) or in parallel (1) in the finite differences method"),
94         NumberOfProcesses = SIMP(statut="f", typ = "I", val_min=0, defaut=0, fr="Nombre de processus parallèles, 0 pour un contrôle automatique", ang="Number of parallel processes, 0 for automatic control"),
95         ),
96     SCRIPTWITHSWITCH_DATA = BLOC ( condition = " FROM in ( 'ScriptWithSwitch', ) ",
97         SCRIPTWITHSWITCH_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant un switch pour les calculs direct, tangent et adjoint", ang="Waiting for a script file name, with or without the full path to find it, containing a switch for direct, tangent and adjoint computations"),
98         ),
99     TEMPLATE_DATA =  BLOC (condition = " FROM in ( 'Template', ) ",
100         Template = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "AnalysisPrinter", into=("AnalysisPrinter", "AnalysisSaver", "AnalysisPrinterAndSaver")),
101         AnalysisPrinter = BLOC (condition = " Template == 'AnalysisPrinter' ",
102             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa" ),
103             ),
104         AnalysisSaver = BLOC (condition = " Template == 'AnalysisSaver' ",
105             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
106             ),
107         AnalysisPrinterAndSaver = BLOC (condition = " Template == 'AnalysisPrinterAndSaver' ",
108             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
109             ),
110         ),
111     )
112
113 def F_Function(statut, fv=NoCheckInNS) : return FACT(
114     statut = statut,
115     FROM = SIMP(statut = "o", typ = "TXM", into=("ScriptWithOneFunction", "ScriptWithFunctions", "ScriptWithSwitch", "FunctionDict", ), defaut="ScriptWithOneFunction"),
116     SCRIPT_DATA = BLOC ( condition = " FROM in ( 'Script', ) ",
117         SCRIPT_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(fv)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant si nécessaire la définition d'une variable interne de même nom que le concept parent", ang="Waiting for a script file name, with or without the full path to find it, containing if necessary the definition of an internal variable of the same name as the parent concept"),
118         ),
119     STRING_DATA = BLOC ( condition = " FROM in ( 'String', ) ",
120         STRING = SIMP(statut = "o", typ = "TXM", fr="En attente d'une chaine de caractères entre guillements. Pour construire un vecteur ou une matrice, ce doit être une suite de nombres, utilisant un espace ou une virgule pour séparer deux éléments et un point-virgule pour séparer deux lignes", ang="Waiting for a string in quotes. To build a vector or a matrix, it has to be a float serie, using a space or comma to separate two elements in a line, a semi-colon to separate rows"),
121         ),
122     SCRIPTWITHFUNCTIONS_DATA = BLOC ( condition = " FROM in ( 'ScriptWithFunctions', ) ",
123         SCRIPTWITHFUNCTIONS_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS), FunctionVal(TangentOperatorInNS), FunctionVal(AdjointOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variables internes trois fonctions de calcul nommées DirectOperator, TangentOperator et AdjointOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variables three computation functions named DirectOperator, TangentOperator and AdjointOperator"),
124         ),
125     SCRIPTWITHONEFUNCTION_DATA = BLOC ( condition = " FROM in ( 'ScriptWithOneFunction', ) ",
126         SCRIPTWITHONEFUNCTION_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variable interne une seule fonction de calcul nommée DirectOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variable only one function named DirectOperator"),
127         DifferentialIncrement = SIMP(statut="o", typ = "R", val_min=0, val_max=1, defaut=0.01, fr="Incrément de la perturbation dX pour calculer la dérivée, construite en multipliant X par l'incrément en évitant les valeurs nulles", ang="Increment of dX perturbation to calculate the derivative, build multiplying X by the increment avoiding null values"),
128         CenteredFiniteDifference = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Formulation centrée (1) ou décentrée (0) pour la méthode des différences finies", ang="Centered (1) or uncentered (0) formulation for the finite differences method"),
129         EnableMultiProcessing = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0, fr="Calculs élémentaires effectués en séquentiel (0) ou en parallèle (1) dans la méthode des différences finies", ang="Elementary calculations done sequentially (0) or in parallel (1) in the finite differences method"),
130         NumberOfProcesses = SIMP(statut="f", typ = "I", val_min=0, defaut=0, fr="Nombre de processus parallèles, 0 pour un contrôle automatique", ang="Number of parallel processes, 0 for automatic control"),
131         ),
132     SCRIPTWITHSWITCH_DATA = BLOC ( condition = " FROM in ( 'ScriptWithSwitch', ) ",
133         SCRIPTWITHSWITCH_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant un switch pour les calculs direct, tangent et adjoint", ang="Waiting for a script file name, with or without the full path to find it, containing a switch for direct, tangent and adjoint computations"),
134         ),
135     TEMPLATE_DATA =  BLOC (condition = " FROM in ( 'Template', ) ",
136         Template = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "AnalysisPrinter", into=("AnalysisPrinter", "AnalysisSaver", "AnalysisPrinterAndSaver")),
137         AnalysisPrinter = BLOC (condition = " Template == 'AnalysisPrinter' ",
138             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa" ),
139             ),
140         AnalysisSaver = BLOC (condition = " Template == 'AnalysisSaver' ",
141             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
142             ),
143         AnalysisPrinterAndSaver = BLOC (condition = " Template == 'AnalysisPrinterAndSaver' ",
144             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
145             ),
146         ),
147     )
148
149 def F_Matrix(statut, fv=NoCheckInNS) : return FACT(
150     statut = statut,
151     FROM = SIMP(statut = "o", typ = "TXM", into=("String", "Script", ), defaut="Script"),
152     SCRIPT_DATA = BLOC ( condition = " FROM in ( 'Script', ) ",
153         SCRIPT_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(fv)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant si nécessaire la définition d'une variable interne de même nom que le concept parent", ang="Waiting for a script file name, with or without the full path to find it, containing if necessary the definition of an internal variable of the same name as the parent concept"),
154         ),
155     STRING_DATA = BLOC ( condition = " FROM in ( 'String', ) ",
156         STRING = SIMP(statut = "o", typ = "TXM", fr="En attente d'une chaine de caractères entre guillements. Pour construire un vecteur ou une matrice, ce doit être une suite de nombres, utilisant un espace ou une virgule pour séparer deux éléments et un point-virgule pour séparer deux lignes", ang="Waiting for a string in quotes. To build a vector or a matrix, it has to be a float serie, using a space or comma to separate two elements in a line, a semi-colon to separate rows"),
157         ),
158     SCRIPTWITHFUNCTIONS_DATA = BLOC ( condition = " FROM in ( 'ScriptWithFunctions', ) ",
159         SCRIPTWITHFUNCTIONS_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS), FunctionVal(TangentOperatorInNS), FunctionVal(AdjointOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variables internes trois fonctions de calcul nommées DirectOperator, TangentOperator et AdjointOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variables three computation functions named DirectOperator, TangentOperator and AdjointOperator"),
160         ),
161     SCRIPTWITHONEFUNCTION_DATA = BLOC ( condition = " FROM in ( 'ScriptWithOneFunction', ) ",
162         SCRIPTWITHONEFUNCTION_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variable interne une seule fonction de calcul nommée DirectOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variable only one function named DirectOperator"),
163         DifferentialIncrement = SIMP(statut="o", typ = "R", val_min=0, val_max=1, defaut=0.01, fr="Incrément de la perturbation dX pour calculer la dérivée, construite en multipliant X par l'incrément en évitant les valeurs nulles", ang="Increment of dX perturbation to calculate the derivative, build multiplying X by the increment avoiding null values"),
164         CenteredFiniteDifference = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Formulation centrée (1) ou décentrée (0) pour la méthode des différences finies", ang="Centered (1) or uncentered (0) formulation for the finite differences method"),
165         EnableMultiProcessing = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0, fr="Calculs élémentaires effectués en séquentiel (0) ou en parallèle (1) dans la méthode des différences finies", ang="Elementary calculations done sequentially (0) or in parallel (1) in the finite differences method"),
166         NumberOfProcesses = SIMP(statut="f", typ = "I", val_min=0, defaut=0, fr="Nombre de processus parallèles, 0 pour un contrôle automatique", ang="Number of parallel processes, 0 for automatic control"),
167         ),
168     SCRIPTWITHSWITCH_DATA = BLOC ( condition = " FROM in ( 'ScriptWithSwitch', ) ",
169         SCRIPTWITHSWITCH_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant un switch pour les calculs direct, tangent et adjoint", ang="Waiting for a script file name, with or without the full path to find it, containing a switch for direct, tangent and adjoint computations"),
170         ),
171     TEMPLATE_DATA =  BLOC (condition = " FROM in ( 'Template', ) ",
172         Template = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "AnalysisPrinter", into=("AnalysisPrinter", "AnalysisSaver", "AnalysisPrinterAndSaver")),
173         AnalysisPrinter = BLOC (condition = " Template == 'AnalysisPrinter' ",
174             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa" ),
175             ),
176         AnalysisSaver = BLOC (condition = " Template == 'AnalysisSaver' ",
177             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
178             ),
179         AnalysisPrinterAndSaver = BLOC (condition = " Template == 'AnalysisPrinterAndSaver' ",
180             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
181             ),
182         ),
183     )
184
185 def F_DiagonalSparseMatrix(statut, fv=NoCheckInNS) : return FACT(
186     statut = statut,
187     FROM = SIMP(statut = "o", typ = "TXM", into=("String", "Script", ), defaut="String"),
188     SCRIPT_DATA = BLOC ( condition = " FROM in ( 'Script', ) ",
189         SCRIPT_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(fv)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant si nécessaire la définition d'une variable interne de même nom que le concept parent", ang="Waiting for a script file name, with or without the full path to find it, containing if necessary the definition of an internal variable of the same name as the parent concept"),
190         ),
191     STRING_DATA = BLOC ( condition = " FROM in ( 'String', ) ",
192         STRING = SIMP(statut = "o", typ = "TXM", fr="En attente d'une chaine de caractères entre guillements. Pour construire un vecteur ou une matrice, ce doit être une suite de nombres, utilisant un espace ou une virgule pour séparer deux éléments et un point-virgule pour séparer deux lignes", ang="Waiting for a string in quotes. To build a vector or a matrix, it has to be a float serie, using a space or comma to separate two elements in a line, a semi-colon to separate rows"),
193         ),
194     SCRIPTWITHFUNCTIONS_DATA = BLOC ( condition = " FROM in ( 'ScriptWithFunctions', ) ",
195         SCRIPTWITHFUNCTIONS_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS), FunctionVal(TangentOperatorInNS), FunctionVal(AdjointOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variables internes trois fonctions de calcul nommées DirectOperator, TangentOperator et AdjointOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variables three computation functions named DirectOperator, TangentOperator and AdjointOperator"),
196         ),
197     SCRIPTWITHONEFUNCTION_DATA = BLOC ( condition = " FROM in ( 'ScriptWithOneFunction', ) ",
198         SCRIPTWITHONEFUNCTION_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variable interne une seule fonction de calcul nommée DirectOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variable only one function named DirectOperator"),
199         DifferentialIncrement = SIMP(statut="o", typ = "R", val_min=0, val_max=1, defaut=0.01, fr="Incrément de la perturbation dX pour calculer la dérivée, construite en multipliant X par l'incrément en évitant les valeurs nulles", ang="Increment of dX perturbation to calculate the derivative, build multiplying X by the increment avoiding null values"),
200         CenteredFiniteDifference = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Formulation centrée (1) ou décentrée (0) pour la méthode des différences finies", ang="Centered (1) or uncentered (0) formulation for the finite differences method"),
201         EnableMultiProcessing = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0, fr="Calculs élémentaires effectués en séquentiel (0) ou en parallèle (1) dans la méthode des différences finies", ang="Elementary calculations done sequentially (0) or in parallel (1) in the finite differences method"),
202         NumberOfProcesses = SIMP(statut="f", typ = "I", val_min=0, defaut=0, fr="Nombre de processus parallèles, 0 pour un contrôle automatique", ang="Number of parallel processes, 0 for automatic control"),
203         ),
204     SCRIPTWITHSWITCH_DATA = BLOC ( condition = " FROM in ( 'ScriptWithSwitch', ) ",
205         SCRIPTWITHSWITCH_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant un switch pour les calculs direct, tangent et adjoint", ang="Waiting for a script file name, with or without the full path to find it, containing a switch for direct, tangent and adjoint computations"),
206         ),
207     TEMPLATE_DATA =  BLOC (condition = " FROM in ( 'Template', ) ",
208         Template = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "AnalysisPrinter", into=("AnalysisPrinter", "AnalysisSaver", "AnalysisPrinterAndSaver")),
209         AnalysisPrinter = BLOC (condition = " Template == 'AnalysisPrinter' ",
210             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa" ),
211             ),
212         AnalysisSaver = BLOC (condition = " Template == 'AnalysisSaver' ",
213             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
214             ),
215         AnalysisPrinterAndSaver = BLOC (condition = " Template == 'AnalysisPrinterAndSaver' ",
216             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
217             ),
218         ),
219     )
220
221 def F_Vector(statut, fv=NoCheckInNS) : return FACT(
222     statut = statut,
223     FROM = SIMP(statut = "o", typ = "TXM", into=("String", "Script", ), defaut="Script"),
224     SCRIPT_DATA = BLOC ( condition = " FROM in ( 'Script', ) ",
225         SCRIPT_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(fv)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant si nécessaire la définition d'une variable interne de même nom que le concept parent", ang="Waiting for a script file name, with or without the full path to find it, containing if necessary the definition of an internal variable of the same name as the parent concept"),
226         ),
227     STRING_DATA = BLOC ( condition = " FROM in ( 'String', ) ",
228         STRING = SIMP(statut = "o", typ = "TXM", fr="En attente d'une chaine de caractères entre guillements. Pour construire un vecteur ou une matrice, ce doit être une suite de nombres, utilisant un espace ou une virgule pour séparer deux éléments et un point-virgule pour séparer deux lignes", ang="Waiting for a string in quotes. To build a vector or a matrix, it has to be a float serie, using a space or comma to separate two elements in a line, a semi-colon to separate rows"),
229         ),
230     SCRIPTWITHFUNCTIONS_DATA = BLOC ( condition = " FROM in ( 'ScriptWithFunctions', ) ",
231         SCRIPTWITHFUNCTIONS_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS), FunctionVal(TangentOperatorInNS), FunctionVal(AdjointOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variables internes trois fonctions de calcul nommées DirectOperator, TangentOperator et AdjointOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variables three computation functions named DirectOperator, TangentOperator and AdjointOperator"),
232         ),
233     SCRIPTWITHONEFUNCTION_DATA = BLOC ( condition = " FROM in ( 'ScriptWithOneFunction', ) ",
234         SCRIPTWITHONEFUNCTION_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variable interne une seule fonction de calcul nommée DirectOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variable only one function named DirectOperator"),
235         DifferentialIncrement = SIMP(statut="o", typ = "R", val_min=0, val_max=1, defaut=0.01, fr="Incrément de la perturbation dX pour calculer la dérivée, construite en multipliant X par l'incrément en évitant les valeurs nulles", ang="Increment of dX perturbation to calculate the derivative, build multiplying X by the increment avoiding null values"),
236         CenteredFiniteDifference = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Formulation centrée (1) ou décentrée (0) pour la méthode des différences finies", ang="Centered (1) or uncentered (0) formulation for the finite differences method"),
237         EnableMultiProcessing = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0, fr="Calculs élémentaires effectués en séquentiel (0) ou en parallèle (1) dans la méthode des différences finies", ang="Elementary calculations done sequentially (0) or in parallel (1) in the finite differences method"),
238         NumberOfProcesses = SIMP(statut="f", typ = "I", val_min=0, defaut=0, fr="Nombre de processus parallèles, 0 pour un contrôle automatique", ang="Number of parallel processes, 0 for automatic control"),
239         ),
240     SCRIPTWITHSWITCH_DATA = BLOC ( condition = " FROM in ( 'ScriptWithSwitch', ) ",
241         SCRIPTWITHSWITCH_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant un switch pour les calculs direct, tangent et adjoint", ang="Waiting for a script file name, with or without the full path to find it, containing a switch for direct, tangent and adjoint computations"),
242         ),
243     TEMPLATE_DATA =  BLOC (condition = " FROM in ( 'Template', ) ",
244         Template = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "AnalysisPrinter", into=("AnalysisPrinter", "AnalysisSaver", "AnalysisPrinterAndSaver")),
245         AnalysisPrinter = BLOC (condition = " Template == 'AnalysisPrinter' ",
246             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa" ),
247             ),
248         AnalysisSaver = BLOC (condition = " Template == 'AnalysisSaver' ",
249             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
250             ),
251         AnalysisPrinterAndSaver = BLOC (condition = " Template == 'AnalysisPrinterAndSaver' ",
252             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
253             ),
254         ),
255     )
256
257 def F_Dict(statut, fv=NoCheckInNS) : return FACT(
258     statut = statut,
259     FROM = SIMP(statut = "o", typ = "TXM", into=("String", "Script", ), defaut="Script"),
260     SCRIPT_DATA = BLOC ( condition = " FROM in ( 'Script', ) ",
261         SCRIPT_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(fv)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant si nécessaire la définition d'une variable interne de même nom que le concept parent", ang="Waiting for a script file name, with or without the full path to find it, containing if necessary the definition of an internal variable of the same name as the parent concept"),
262         ),
263     STRING_DATA = BLOC ( condition = " FROM in ( 'String', ) ",
264         STRING = SIMP(statut = "o", typ = "TXM", fr="En attente d'une chaine de caractères entre guillements. Pour construire un vecteur ou une matrice, ce doit être une suite de nombres, utilisant un espace ou une virgule pour séparer deux éléments et un point-virgule pour séparer deux lignes", ang="Waiting for a string in quotes. To build a vector or a matrix, it has to be a float serie, using a space or comma to separate two elements in a line, a semi-colon to separate rows"),
265         ),
266     SCRIPTWITHFUNCTIONS_DATA = BLOC ( condition = " FROM in ( 'ScriptWithFunctions', ) ",
267         SCRIPTWITHFUNCTIONS_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS), FunctionVal(TangentOperatorInNS), FunctionVal(AdjointOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variables internes trois fonctions de calcul nommées DirectOperator, TangentOperator et AdjointOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variables three computation functions named DirectOperator, TangentOperator and AdjointOperator"),
268         ),
269     SCRIPTWITHONEFUNCTION_DATA = BLOC ( condition = " FROM in ( 'ScriptWithOneFunction', ) ",
270         SCRIPTWITHONEFUNCTION_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variable interne une seule fonction de calcul nommée DirectOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variable only one function named DirectOperator"),
271         DifferentialIncrement = SIMP(statut="o", typ = "R", val_min=0, val_max=1, defaut=0.01, fr="Incrément de la perturbation dX pour calculer la dérivée, construite en multipliant X par l'incrément en évitant les valeurs nulles", ang="Increment of dX perturbation to calculate the derivative, build multiplying X by the increment avoiding null values"),
272         CenteredFiniteDifference = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Formulation centrée (1) ou décentrée (0) pour la méthode des différences finies", ang="Centered (1) or uncentered (0) formulation for the finite differences method"),
273         EnableMultiProcessing = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0, fr="Calculs élémentaires effectués en séquentiel (0) ou en parallèle (1) dans la méthode des différences finies", ang="Elementary calculations done sequentially (0) or in parallel (1) in the finite differences method"),
274         NumberOfProcesses = SIMP(statut="f", typ = "I", val_min=0, defaut=0, fr="Nombre de processus parallèles, 0 pour un contrôle automatique", ang="Number of parallel processes, 0 for automatic control"),
275         ),
276     SCRIPTWITHSWITCH_DATA = BLOC ( condition = " FROM in ( 'ScriptWithSwitch', ) ",
277         SCRIPTWITHSWITCH_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant un switch pour les calculs direct, tangent et adjoint", ang="Waiting for a script file name, with or without the full path to find it, containing a switch for direct, tangent and adjoint computations"),
278         ),
279     TEMPLATE_DATA =  BLOC (condition = " FROM in ( 'Template', ) ",
280         Template = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "AnalysisPrinter", into=("AnalysisPrinter", "AnalysisSaver", "AnalysisPrinterAndSaver")),
281         AnalysisPrinter = BLOC (condition = " Template == 'AnalysisPrinter' ",
282             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa" ),
283             ),
284         AnalysisSaver = BLOC (condition = " Template == 'AnalysisSaver' ",
285             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
286             ),
287         AnalysisPrinterAndSaver = BLOC (condition = " Template == 'AnalysisPrinterAndSaver' ",
288             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
289             ),
290         ),
291     )
292
293 def F_ScalarSparseMatrix(statut, fv=NoCheckInNS) : return FACT(
294     statut = statut,
295     FROM = SIMP(statut = "o", typ = "TXM", into=("String", "Script", ), defaut="String"),
296     SCRIPT_DATA = BLOC ( condition = " FROM in ( 'Script', ) ",
297         SCRIPT_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(fv)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant si nécessaire la définition d'une variable interne de même nom que le concept parent", ang="Waiting for a script file name, with or without the full path to find it, containing if necessary the definition of an internal variable of the same name as the parent concept"),
298         ),
299     STRING_DATA = BLOC ( condition = " FROM in ( 'String', ) ",
300         STRING = SIMP(statut = "o", typ = "TXM", defaut="1.", fr="En attente d'une chaine de caractères entre guillements. Pour construire un vecteur ou une matrice, ce doit être une suite de nombres, utilisant un espace ou une virgule pour séparer deux éléments et un point-virgule pour séparer deux lignes", ang="Waiting for a string in quotes. To build a vector or a matrix, it has to be a float serie, using a space or comma to separate two elements in a line, a semi-colon to separate rows"),
301         ),
302     SCRIPTWITHFUNCTIONS_DATA = BLOC ( condition = " FROM in ( 'ScriptWithFunctions', ) ",
303         SCRIPTWITHFUNCTIONS_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS), FunctionVal(TangentOperatorInNS), FunctionVal(AdjointOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variables internes trois fonctions de calcul nommées DirectOperator, TangentOperator et AdjointOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variables three computation functions named DirectOperator, TangentOperator and AdjointOperator"),
304         ),
305     SCRIPTWITHONEFUNCTION_DATA = BLOC ( condition = " FROM in ( 'ScriptWithOneFunction', ) ",
306         SCRIPTWITHONEFUNCTION_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variable interne une seule fonction de calcul nommée DirectOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variable only one function named DirectOperator"),
307         DifferentialIncrement = SIMP(statut="o", typ = "R", val_min=0, val_max=1, defaut=0.01, fr="Incrément de la perturbation dX pour calculer la dérivée, construite en multipliant X par l'incrément en évitant les valeurs nulles", ang="Increment of dX perturbation to calculate the derivative, build multiplying X by the increment avoiding null values"),
308         CenteredFiniteDifference = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Formulation centrée (1) ou décentrée (0) pour la méthode des différences finies", ang="Centered (1) or uncentered (0) formulation for the finite differences method"),
309         EnableMultiProcessing = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0, fr="Calculs élémentaires effectués en séquentiel (0) ou en parallèle (1) dans la méthode des différences finies", ang="Elementary calculations done sequentially (0) or in parallel (1) in the finite differences method"),
310         NumberOfProcesses = SIMP(statut="f", typ = "I", val_min=0, defaut=0, fr="Nombre de processus parallèles, 0 pour un contrôle automatique", ang="Number of parallel processes, 0 for automatic control"),
311         ),
312     SCRIPTWITHSWITCH_DATA = BLOC ( condition = " FROM in ( 'ScriptWithSwitch', ) ",
313         SCRIPTWITHSWITCH_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant un switch pour les calculs direct, tangent et adjoint", ang="Waiting for a script file name, with or without the full path to find it, containing a switch for direct, tangent and adjoint computations"),
314         ),
315     TEMPLATE_DATA =  BLOC (condition = " FROM in ( 'Template', ) ",
316         Template = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "AnalysisPrinter", into=("AnalysisPrinter", "AnalysisSaver", "AnalysisPrinterAndSaver")),
317         AnalysisPrinter = BLOC (condition = " Template == 'AnalysisPrinter' ",
318             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa" ),
319             ),
320         AnalysisSaver = BLOC (condition = " Template == 'AnalysisSaver' ",
321             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
322             ),
323         AnalysisPrinterAndSaver = BLOC (condition = " Template == 'AnalysisPrinterAndSaver' ",
324             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
325             ),
326         ),
327     )
328
329 def ObservationErrorInNS(filename):
330     if os.path.exists(filename):
331         fc = open(filename, 'r').readlines()
332         cr = re.compile("^ObservationError[\s]*=")
333         for ln in fc:
334             if cr.match(ln): return 1
335     return 0
336 ObservationErrorInNS.info = u"The Python file has to contain explicitly a \"ObservationError\" variable."
337 def F_ObservationError(statut, fv=NoCheckInNS) : return FACT(
338     statut=statut,
339     Stored = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Choix de stockage interne ou non du concept parent", ang="Choice of the storage or not of the parent concept"),
340     INPUT_TYPE = SIMP(statut="o", typ = "TXM", into=("Matrix", "ScalarSparseMatrix", "DiagonalSparseMatrix", ), defaut="ScalarSparseMatrix"),
341     Matrix = BLOC ( condition = " INPUT_TYPE in ( 'Matrix', ) ",
342         data = F_Matrix("o", fv),
343         ),
344     ScalarSparseMatrix = BLOC ( condition = " INPUT_TYPE in ( 'ScalarSparseMatrix', ) ",
345         data = F_ScalarSparseMatrix("o", fv),
346         ),
347     DiagonalSparseMatrix = BLOC ( condition = " INPUT_TYPE in ( 'DiagonalSparseMatrix', ) ",
348         data = F_DiagonalSparseMatrix("o", fv),
349         ),
350     )
351
352 def ObservationInNS(filename):
353     if os.path.exists(filename):
354         fc = open(filename, 'r').readlines()
355         cr = re.compile("^Observation[\s]*=")
356         for ln in fc:
357             if cr.match(ln): return 1
358     return 0
359 ObservationInNS.info = u"The Python file has to contain explicitly a \"Observation\" variable."
360 def F_Observation(statut, fv=NoCheckInNS) : return FACT(
361     statut=statut,
362     Stored = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Choix de stockage interne ou non du concept parent", ang="Choice of the storage or not of the parent concept"),
363     INPUT_TYPE = SIMP(statut="o", typ = "TXM", into=("Vector", "VectorSerie", ), defaut="Vector"),
364     Vector = BLOC ( condition = " INPUT_TYPE in ( 'Vector', ) ",
365         data = F_Vector("o", fv),
366         ),
367     VectorSerie = BLOC ( condition = " INPUT_TYPE in ( 'VectorSerie', ) ",
368         data = F_VectorSerie("o", fv),
369         ),
370     )
371
372 def BackgroundErrorInNS(filename):
373     if os.path.exists(filename):
374         fc = open(filename, 'r').readlines()
375         cr = re.compile("^BackgroundError[\s]*=")
376         for ln in fc:
377             if cr.match(ln): return 1
378     return 0
379 BackgroundErrorInNS.info = u"The Python file has to contain explicitly a \"BackgroundError\" variable."
380 def F_BackgroundError(statut, fv=NoCheckInNS) : return FACT(
381     statut=statut,
382     Stored = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Choix de stockage interne ou non du concept parent", ang="Choice of the storage or not of the parent concept"),
383     INPUT_TYPE = SIMP(statut="o", typ = "TXM", into=("Matrix", "ScalarSparseMatrix", "DiagonalSparseMatrix", ), defaut="ScalarSparseMatrix"),
384     Matrix = BLOC ( condition = " INPUT_TYPE in ( 'Matrix', ) ",
385         data = F_Matrix("o", fv),
386         ),
387     ScalarSparseMatrix = BLOC ( condition = " INPUT_TYPE in ( 'ScalarSparseMatrix', ) ",
388         data = F_ScalarSparseMatrix("o", fv),
389         ),
390     DiagonalSparseMatrix = BLOC ( condition = " INPUT_TYPE in ( 'DiagonalSparseMatrix', ) ",
391         data = F_DiagonalSparseMatrix("o", fv),
392         ),
393     )
394
395 def ObservationOperatorInNS(filename):
396     if os.path.exists(filename):
397         fc = open(filename, 'r').readlines()
398         cr = re.compile("^ObservationOperator[\s]*=")
399         for ln in fc:
400             if cr.match(ln): return 1
401     return 0
402 ObservationOperatorInNS.info = u"The Python file has to contain explicitly a \"ObservationOperator\" variable."
403 def F_ObservationOperator(statut, fv=NoCheckInNS) : return FACT(
404     statut=statut,
405     Stored = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Choix de stockage interne ou non du concept parent", ang="Choice of the storage or not of the parent concept"),
406     INPUT_TYPE = SIMP(statut="o", typ = "TXM", into=("Matrix", "Function", ), defaut="Function"),
407     Matrix = BLOC ( condition = " INPUT_TYPE in ( 'Matrix', ) ",
408         data = F_Matrix("o", fv),
409         ),
410     Function = BLOC ( condition = " INPUT_TYPE in ( 'Function', ) ",
411         data = F_Function("o", fv),
412         ),
413     )
414
415 def CheckingPointInNS(filename):
416     if os.path.exists(filename):
417         fc = open(filename, 'r').readlines()
418         cr = re.compile("^CheckingPoint[\s]*=")
419         for ln in fc:
420             if cr.match(ln): return 1
421     return 0
422 CheckingPointInNS.info = u"The Python file has to contain explicitly a \"CheckingPoint\" variable."
423 def F_CheckingPoint(statut, fv=NoCheckInNS) : return FACT(
424     statut=statut,
425     Stored = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Choix de stockage interne ou non du concept parent", ang="Choice of the storage or not of the parent concept"),
426     INPUT_TYPE = SIMP(statut="o", typ = "TXM", into=("Vector", ), defaut="Vector"),
427     Vector = BLOC ( condition = " INPUT_TYPE in ( 'Vector', ) ",
428         data = F_Vector("o", fv),
429         ),
430     )
431
432 def ControlInputInNS(filename):
433     if os.path.exists(filename):
434         fc = open(filename, 'r').readlines()
435         cr = re.compile("^ControlInput[\s]*=")
436         for ln in fc:
437             if cr.match(ln): return 1
438     return 0
439 ControlInputInNS.info = u"The Python file has to contain explicitly a \"ControlInput\" variable."
440 def F_ControlInput(statut, fv=NoCheckInNS) : return FACT(
441     statut=statut,
442     Stored = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Choix de stockage interne ou non du concept parent", ang="Choice of the storage or not of the parent concept"),
443     INPUT_TYPE = SIMP(statut="o", typ = "TXM", into=("Vector", "VectorSerie", ), defaut="Vector"),
444     Vector = BLOC ( condition = " INPUT_TYPE in ( 'Vector', ) ",
445         data = F_Vector("o", fv),
446         ),
447     VectorSerie = BLOC ( condition = " INPUT_TYPE in ( 'VectorSerie', ) ",
448         data = F_VectorSerie("o", fv),
449         ),
450     )
451
452 def BackgroundInNS(filename):
453     if os.path.exists(filename):
454         fc = open(filename, 'r').readlines()
455         cr = re.compile("^Background[\s]*=")
456         for ln in fc:
457             if cr.match(ln): return 1
458     return 0
459 BackgroundInNS.info = u"The Python file has to contain explicitly a \"Background\" variable."
460 def F_Background(statut, fv=NoCheckInNS) : return FACT(
461     statut=statut,
462     Stored = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Choix de stockage interne ou non du concept parent", ang="Choice of the storage or not of the parent concept"),
463     INPUT_TYPE = SIMP(statut="o", typ = "TXM", into=("Vector", "VectorSerie", ), defaut="Vector"),
464     Vector = BLOC ( condition = " INPUT_TYPE in ( 'Vector', ) ",
465         data = F_Vector("o", fv),
466         ),
467     VectorSerie = BLOC ( condition = " INPUT_TYPE in ( 'VectorSerie', ) ",
468         data = F_VectorSerie("o", fv),
469         ),
470     )
471
472 def AlgorithmParametersInNS(filename):
473     if os.path.exists(filename):
474         fc = open(filename, 'r').readlines()
475         cr = re.compile("^AlgorithmParameters[\s]*=")
476         for ln in fc:
477             if cr.match(ln): return 1
478     return 0
479 AlgorithmParametersInNS.info = u"The Python file has to contain explicitly a \"AlgorithmParameters\" variable."
480 def F_AlgorithmParameters(statut, fv=NoCheckInNS) : return FACT(
481     statut=statut,
482
483     INPUT_TYPE = SIMP(statut="o", typ = "TXM", into=("Dict", ), defaut="Dict"),
484     Dict = BLOC ( condition = " INPUT_TYPE in ( 'Dict', ) ",
485         data = F_Dict("o", fv),
486         ),
487     )
488
489 def EvolutionErrorInNS(filename):
490     if os.path.exists(filename):
491         fc = open(filename, 'r').readlines()
492         cr = re.compile("^EvolutionError[\s]*=")
493         for ln in fc:
494             if cr.match(ln): return 1
495     return 0
496 EvolutionErrorInNS.info = u"The Python file has to contain explicitly a \"EvolutionError\" variable."
497 def F_EvolutionError(statut, fv=NoCheckInNS) : return FACT(
498     statut=statut,
499     Stored = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Choix de stockage interne ou non du concept parent", ang="Choice of the storage or not of the parent concept"),
500     INPUT_TYPE = SIMP(statut="o", typ = "TXM", into=("Matrix", "ScalarSparseMatrix", "DiagonalSparseMatrix", ), defaut="ScalarSparseMatrix"),
501     Matrix = BLOC ( condition = " INPUT_TYPE in ( 'Matrix', ) ",
502         data = F_Matrix("o", fv),
503         ),
504     ScalarSparseMatrix = BLOC ( condition = " INPUT_TYPE in ( 'ScalarSparseMatrix', ) ",
505         data = F_ScalarSparseMatrix("o", fv),
506         ),
507     DiagonalSparseMatrix = BLOC ( condition = " INPUT_TYPE in ( 'DiagonalSparseMatrix', ) ",
508         data = F_DiagonalSparseMatrix("o", fv),
509         ),
510     )
511
512 def UserDataInitInNS(filename):
513     if os.path.exists(filename):
514         fc = open(filename, 'r').readlines()
515         cr = re.compile("^UserDataInit[\s]*=")
516         for ln in fc:
517             if cr.match(ln): return 1
518     return 0
519 UserDataInitInNS.info = u"The Python file has to contain explicitly a \"UserDataInit\" variable."
520 def F_UserDataInit(statut, fv=NoCheckInNS) : return FACT(
521     statut=statut,
522
523     INPUT_TYPE = SIMP(statut="o", typ = "TXM", into=("Dict", ), defaut="Dict"),
524     Dict = BLOC ( condition = " INPUT_TYPE in ( 'Dict', ) ",
525         data = F_Dict("o", fv),
526         ),
527     )
528
529 def EvolutionModelInNS(filename):
530     if os.path.exists(filename):
531         fc = open(filename, 'r').readlines()
532         cr = re.compile("^EvolutionModel[\s]*=")
533         for ln in fc:
534             if cr.match(ln): return 1
535     return 0
536 EvolutionModelInNS.info = u"The Python file has to contain explicitly a \"EvolutionModel\" variable."
537 def F_EvolutionModel(statut, fv=NoCheckInNS) : return FACT(
538     statut=statut,
539     Stored = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Choix de stockage interne ou non du concept parent", ang="Choice of the storage or not of the parent concept"),
540     INPUT_TYPE = SIMP(statut="o", typ = "TXM", into=("Matrix", "Function", ), defaut="Function"),
541     Matrix = BLOC ( condition = " INPUT_TYPE in ( 'Matrix', ) ",
542         data = F_Matrix("o", fv),
543         ),
544     Function = BLOC ( condition = " INPUT_TYPE in ( 'Function', ) ",
545         data = F_Function("o", fv),
546         ),
547     )
548
549 def F_UserPostAnalysis(statut, fv=NoCheckInNS) : return FACT(
550     statut = statut,
551     FROM = SIMP(statut = "o", typ = "TXM", into=("String", "Script", "Template", ), defaut="Template"),
552     SCRIPT_DATA = BLOC ( condition = " FROM in ( 'Script', ) ",
553         SCRIPT_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(fv)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant si nécessaire la définition d'une variable interne de même nom que le concept parent", ang="Waiting for a script file name, with or without the full path to find it, containing if necessary the definition of an internal variable of the same name as the parent concept"),
554         ),
555     STRING_DATA = BLOC ( condition = " FROM in ( 'String', ) ",
556         STRING = SIMP(statut = "o", typ = "TXM", fr="En attente d'une chaine de caractères entre guillements. Pour construire un vecteur ou une matrice, ce doit être une suite de nombres, utilisant un espace ou une virgule pour séparer deux éléments et un point-virgule pour séparer deux lignes", ang="Waiting for a string in quotes. To build a vector or a matrix, it has to be a float serie, using a space or comma to separate two elements in a line, a semi-colon to separate rows"),
557         ),
558     SCRIPTWITHFUNCTIONS_DATA = BLOC ( condition = " FROM in ( 'ScriptWithFunctions', ) ",
559         SCRIPTWITHFUNCTIONS_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS), FunctionVal(TangentOperatorInNS), FunctionVal(AdjointOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variables internes trois fonctions de calcul nommées DirectOperator, TangentOperator et AdjointOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variables three computation functions named DirectOperator, TangentOperator and AdjointOperator"),
560         ),
561     SCRIPTWITHONEFUNCTION_DATA = BLOC ( condition = " FROM in ( 'ScriptWithOneFunction', ) ",
562         SCRIPTWITHONEFUNCTION_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py'), FunctionVal(DirectOperatorInNS)], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant en variable interne une seule fonction de calcul nommée DirectOperator", ang="Waiting for a script file name, with or without the full path to find it, containing as internal variable only one function named DirectOperator"),
563         DifferentialIncrement = SIMP(statut="o", typ = "R", val_min=0, val_max=1, defaut=0.01, fr="Incrément de la perturbation dX pour calculer la dérivée, construite en multipliant X par l'incrément en évitant les valeurs nulles", ang="Increment of dX perturbation to calculate the derivative, build multiplying X by the increment avoiding null values"),
564         CenteredFiniteDifference = SIMP(statut="o", typ = "I", into=(0, 1), defaut=0, fr="Formulation centrée (1) ou décentrée (0) pour la méthode des différences finies", ang="Centered (1) or uncentered (0) formulation for the finite differences method"),
565         EnableMultiProcessing = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0, fr="Calculs élémentaires effectués en séquentiel (0) ou en parallèle (1) dans la méthode des différences finies", ang="Elementary calculations done sequentially (0) or in parallel (1) in the finite differences method"),
566         NumberOfProcesses = SIMP(statut="f", typ = "I", val_min=0, defaut=0, fr="Nombre de processus parallèles, 0 pour un contrôle automatique", ang="Number of parallel processes, 0 for automatic control"),
567         ),
568     SCRIPTWITHSWITCH_DATA = BLOC ( condition = " FROM in ( 'ScriptWithSwitch', ) ",
569         SCRIPTWITHSWITCH_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')], fr="En attente d'un nom de fichier script, avec ou sans le chemin complet pour le trouver, contenant un switch pour les calculs direct, tangent et adjoint", ang="Waiting for a script file name, with or without the full path to find it, containing a switch for direct, tangent and adjoint computations"),
570         ),
571     TEMPLATE_DATA =  BLOC (condition = " FROM in ( 'Template', ) ",
572         Template = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "AnalysisPrinter", into=("AnalysisPrinter", "AnalysisSaver", "AnalysisPrinterAndSaver")),
573         AnalysisPrinter = BLOC (condition = " Template == 'AnalysisPrinter' ",
574             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa" ),
575             ),
576         AnalysisSaver = BLOC (condition = " Template == 'AnalysisSaver' ",
577             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
578             ),
579         AnalysisPrinterAndSaver = BLOC (condition = " Template == 'AnalysisPrinterAndSaver' ",
580             ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nxa=numpy.ravel(ADD.get('Analysis')[-1])\nprint 'Analysis:',xa\nf='/tmp/analysis.txt'\nprint 'Analysis saved in \"%s\"'%f\nnumpy.savetxt(f,xa)" ),
581             ),
582         ),
583     )
584
585 def F_InitChoice() : return  ("Background",
586                               "BackgroundError",
587                               "Observation",
588                               "ObservationError",
589                               "ObservationOperator",
590                               "EvolutionModel",
591                               "EvolutionError",
592                               "AlgorithmParameters",
593                               "UserPostAnalysis",
594                              )
595
596 def F_Init(statut) : return FACT(statut = statut,
597     INIT_FILE = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')]),
598     TARGET_LIST = SIMP(statut = "o", typ = "TXM", min=1, max="**", into=F_InitChoice(),  validators=(VerifExiste(2))),
599     )
600
601 def F_ObserverTemplate() : return BLOC(condition = " NodeType == 'Template' ",
602                 Template = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "ValuePrinter", into=("ValuePrinter", "ValueSeriePrinter", "ValueSaver", "ValueSerieSaver", "ValuePrinterAndSaver", "ValueSeriePrinterAndSaver", "ValueGnuPlotter", "ValueSerieGnuPlotter", "ValuePrinterAndGnuPlotter", "ValueSeriePrinterAndGnuPlotter", "ValuePrinterSaverAndGnuPlotter", "ValueSeriePrinterSaverAndGnuPlotter")),
603                 ValuePrinter = BLOC (condition = " Template == 'ValuePrinter' ",
604                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print info, var[-1]" ),
605                     ),
606                 ValueSeriePrinter = BLOC (condition = " Template == 'ValueSeriePrinter' ",
607                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print info, var[:] " ),
608                     ),
609                 ValueSaver = BLOC (condition = " Template == 'ValueSaver' ",
610                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy, re\nv=numpy.array(var[-1], ndmin=1)\nglobal istep\ntry:\n    istep += 1\nexcept:\n    istep = 0\nf='/tmp/value_%s_%05i.txt'%(info,istep)\nf=re.sub('\s','_',f)\nprint 'Value saved in \"%s\"'%f\nnumpy.savetxt(f,v)" ),
611                     ),
612                 ValueSerieSaver = BLOC (condition = " Template == 'ValueSerieSaver' ",
613                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy, re\nv=numpy.array(var[:],  ndmin=1)\nglobal istep\ntry:\n    istep += 1\nexcept:\n    istep = 0\nf='/tmp/value_%s_%05i.txt'%(info,istep)\nf=re.sub('\s','_',f)\nprint 'Value saved in \"%s\"'%f\nnumpy.savetxt(f,v)" ),
614                     ),
615                 ValuePrinterAndSaver = BLOC (condition = " Template == 'ValuePrinterAndSaver' ",
616                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy, re\nv=numpy.array(var[-1], ndmin=1)\nprint info,v\nglobal istep\ntry:\n    istep += 1\nexcept:\n    istep = 0\nf='/tmp/value_%s_%05i.txt'%(info,istep)\nf=re.sub('\s','_',f)\nprint 'Value saved in \"%s\"'%f\nnumpy.savetxt(f,v)" ),
617                     ),
618                 ValueSeriePrinterAndSaver = BLOC (condition = " Template == 'ValueSeriePrinterAndSaver' ",
619                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy, re\nv=numpy.array(var[:],  ndmin=1)\nprint info,v\nglobal istep\ntry:\n    istep += 1\nexcept:\n    istep = 0\nf='/tmp/value_%s_%05i.txt'%(info,istep)\nf=re.sub('\s','_',f)\nprint 'Value saved in \"%s\"'%f\nnumpy.savetxt(f,v)" ),
620                     ),
621                 ValueGnuPlotter = BLOC (condition = " Template == 'ValueGnuPlotter' ",
622                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy, Gnuplot\nv=numpy.array(var[-1], ndmin=1)\nglobal ifig, gp\ntry:\n    ifig += 1\n    gp('set style data lines')\nexcept:\n    ifig = 0\n    gp = Gnuplot.Gnuplot(persist=1)\n    gp('set style data lines')\ngp('set title  \"%s (Figure %i)\"'%(info,ifig))\ngp.plot( Gnuplot.Data( v, with_='lines lw 2' ) )" ),
623                     ),
624                 ValueSerieGnuPlotter = BLOC (condition = " Template == 'ValueSerieGnuPlotter' ",
625                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy, Gnuplot\nv=numpy.array(var[:],  ndmin=1)\nglobal ifig, gp\ntry:\n    ifig += 1\n    gp('set style data lines')\nexcept:\n    ifig = 0\n    gp = Gnuplot.Gnuplot(persist=1)\n    gp('set style data lines')\ngp('set title  \"%s (Figure %i)\"'%(info,ifig))\ngp.plot( Gnuplot.Data( v, with_='lines lw 2' ) )" ),
626                     ),
627                 ValuePrinterAndGnuPlotter = BLOC (condition = " Template == 'ValuePrinterAndGnuPlotter' ",
628                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print info, var[-1]\nimport numpy, Gnuplot\nv=numpy.array(var[-1], ndmin=1)\nglobal ifig,gp\ntry:\n    ifig += 1\n    gp('set style data lines')\nexcept:\n    ifig = 0\n    gp = Gnuplot.Gnuplot(persist=1)\n    gp('set style data lines')\ngp('set title  \"%s (Figure %i)\"'%(info,ifig))\ngp.plot( Gnuplot.Data( v, with_='lines lw 2' ) )" ),
629                     ),
630                 ValueSeriePrinterAndGnuPlotter = BLOC (condition = " Template == 'ValueSeriePrinterAndGnuPlotter' ",
631                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print info, var[:] \nimport numpy, Gnuplot\nv=numpy.array(var[:],  ndmin=1)\nglobal ifig,gp\ntry:\n    ifig += 1\n    gp('set style data lines')\nexcept:\n    ifig = 0\n    gp = Gnuplot.Gnuplot(persist=1)\n    gp('set style data lines')\ngp('set title  \"%s (Figure %i)\"'%(info,ifig))\ngp.plot( Gnuplot.Data( v, with_='lines lw 2' ) )" ),
632                     ),
633                 ValuePrinterSaverAndGnuPlotter = BLOC (condition = " Template == 'ValuePrinterSaverAndGnuPlotter' ",
634                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print info, var[-1]\nimport numpy, re\nv=numpy.array(var[-1], ndmin=1)\nglobal istep\ntry:\n    istep += 1\nexcept:\n    istep = 0\nf='/tmp/value_%s_%05i.txt'%(info,istep)\nf=re.sub('\s','_',f)\nprint 'Value saved in \"%s\"'%f\nnumpy.savetxt(f,v)\nimport Gnuplot\nglobal ifig,gp\ntry:\n    ifig += 1\n    gp('set style data lines')\nexcept:\n    ifig = 0\n    gp = Gnuplot.Gnuplot(persist=1)\n    gp('set style data lines')\ngp('set title  \"%s (Figure %i)\"'%(info,ifig))\ngp.plot( Gnuplot.Data( v, with_='lines lw 2' ) )" ),
635                     ),
636                 ValueSeriePrinterSaverAndGnuPlotter = BLOC (condition = " Template == 'ValueSeriePrinterSaverAndGnuPlotter' ",
637                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print info, var[:] \nimport numpy, re\nv=numpy.array(var[:],  ndmin=1)\nglobal istep\ntry:\n    istep += 1\nexcept:\n    istep = 0\nf='/tmp/value_%s_%05i.txt'%(info,istep)\nf=re.sub('\s','_',f)\nprint 'Value saved in \"%s\"'%f\nnumpy.savetxt(f,v)\nimport Gnuplot\nglobal ifig,gp\ntry:\n    ifig += 1\n    gp('set style data lines')\nexcept:\n    ifig = 0\n    gp = Gnuplot.Gnuplot(persist=1)\n    gp('set style data lines')\ngp('set title  \"%s (Figure %i)\"'%(info,ifig))\ngp.plot( Gnuplot.Data( v, with_='lines lw 2' ) )" ),
638                     ),
639                 )
640
641 def F_Observers(statut) : return FACT(
642     statut=statut,
643     SELECTION = SIMP(statut="o", defaut=[], typ="TXM", min=0, max="**", validators=NoRepeat(), into=(['Analysis', 'Innovation', 'CurrentState', 'CurrentOptimum', 'IndexOfOptimum', 'SimulatedObservationAtBackground', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum', 'SimulatedObservationAtCurrentOptimum', 'BMA', 'OMA', 'OMB', 'CostFunctionJ', 'CostFunctionJb', 'CostFunctionJo', 'GradientOfCostFunctionJ', 'GradientOfCostFunctionJb', 'GradientOfCostFunctionJo', 'SigmaObs2', 'SigmaBck2', 'APosterioriCorrelations', 'APosterioriCovariance', 'APosterioriStandardDeviations', 'APosterioriVariances']),homo="SansOrdreNiDoublon"),
644     Analysis = BLOC (condition=" 'Analysis' in set(SELECTION) ",
645         Analysis_data = FACT(statut = "o",
646             Scheduler    = SIMP(statut = "f", typ = "TXM"),
647             Info         = SIMP(statut = "o", typ = "TXM", defaut = "Analysis"),
648             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
649             PythonScript = BLOC (condition = " NodeType == 'String' ",
650                 Value = SIMP(statut = "o", typ = "TXM")
651                 ),
652             UserFile = BLOC (condition = " NodeType == 'Script' ",
653                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
654                 ),
655             ObserverTemplate = F_ObserverTemplate(),
656             ),
657         ),
658     Innovation = BLOC (condition=" 'Innovation' in set(SELECTION) ",
659         Innovation_data = FACT(statut = "o",
660             Scheduler    = SIMP(statut = "f", typ = "TXM"),
661             Info         = SIMP(statut = "o", typ = "TXM", defaut = "Innovation"),
662             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
663             PythonScript = BLOC (condition = " NodeType == 'String' ",
664                 Value = SIMP(statut = "o", typ = "TXM")
665                 ),
666             UserFile = BLOC (condition = " NodeType == 'Script' ",
667                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
668                 ),
669             ObserverTemplate = F_ObserverTemplate(),
670             ),
671         ),
672     CurrentState = BLOC (condition=" 'CurrentState' in set(SELECTION) ",
673         CurrentState_data = FACT(statut = "o",
674             Scheduler    = SIMP(statut = "f", typ = "TXM"),
675             Info         = SIMP(statut = "o", typ = "TXM", defaut = "CurrentState"),
676             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
677             PythonScript = BLOC (condition = " NodeType == 'String' ",
678                 Value = SIMP(statut = "o", typ = "TXM")
679                 ),
680             UserFile = BLOC (condition = " NodeType == 'Script' ",
681                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
682                 ),
683             ObserverTemplate = F_ObserverTemplate(),
684             ),
685         ),
686     CurrentOptimum = BLOC (condition=" 'CurrentOptimum' in set(SELECTION) ",
687         CurrentOptimum_data = FACT(statut = "o",
688             Scheduler    = SIMP(statut = "f", typ = "TXM"),
689             Info         = SIMP(statut = "o", typ = "TXM", defaut = "CurrentOptimum"),
690             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
691             PythonScript = BLOC (condition = " NodeType == 'String' ",
692                 Value = SIMP(statut = "o", typ = "TXM")
693                 ),
694             UserFile = BLOC (condition = " NodeType == 'Script' ",
695                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
696                 ),
697             ObserverTemplate = F_ObserverTemplate(),
698             ),
699         ),
700     IndexOfOptimum = BLOC (condition=" 'IndexOfOptimum' in set(SELECTION) ",
701         IndexOfOptimum_data = FACT(statut = "o",
702             Scheduler    = SIMP(statut = "f", typ = "TXM"),
703             Info         = SIMP(statut = "o", typ = "TXM", defaut = "IndexOfOptimum"),
704             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
705             PythonScript = BLOC (condition = " NodeType == 'String' ",
706                 Value = SIMP(statut = "o", typ = "TXM")
707                 ),
708             UserFile = BLOC (condition = " NodeType == 'Script' ",
709                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
710                 ),
711             ObserverTemplate = F_ObserverTemplate(),
712             ),
713         ),
714     SimulatedObservationAtBackground = BLOC (condition=" 'SimulatedObservationAtBackground' in set(SELECTION) ",
715         SimulatedObservationAtBackground_data = FACT(statut = "o",
716             Scheduler    = SIMP(statut = "f", typ = "TXM"),
717             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SimulatedObservationAtBackground"),
718             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
719             PythonScript = BLOC (condition = " NodeType == 'String' ",
720                 Value = SIMP(statut = "o", typ = "TXM")
721                 ),
722             UserFile = BLOC (condition = " NodeType == 'Script' ",
723                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
724                 ),
725             ObserverTemplate = F_ObserverTemplate(),
726             ),
727         ),
728     SimulatedObservationAtCurrentState = BLOC (condition=" 'SimulatedObservationAtCurrentState' in set(SELECTION) ",
729         SimulatedObservationAtCurrentState_data = FACT(statut = "o",
730             Scheduler    = SIMP(statut = "f", typ = "TXM"),
731             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SimulatedObservationAtCurrentState"),
732             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
733             PythonScript = BLOC (condition = " NodeType == 'String' ",
734                 Value = SIMP(statut = "o", typ = "TXM")
735                 ),
736             UserFile = BLOC (condition = " NodeType == 'Script' ",
737                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
738                 ),
739             ObserverTemplate = F_ObserverTemplate(),
740             ),
741         ),
742     SimulatedObservationAtOptimum = BLOC (condition=" 'SimulatedObservationAtOptimum' in set(SELECTION) ",
743         SimulatedObservationAtOptimum_data = FACT(statut = "o",
744             Scheduler    = SIMP(statut = "f", typ = "TXM"),
745             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SimulatedObservationAtOptimum"),
746             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
747             PythonScript = BLOC (condition = " NodeType == 'String' ",
748                 Value = SIMP(statut = "o", typ = "TXM")
749                 ),
750             UserFile = BLOC (condition = " NodeType == 'Script' ",
751                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
752                 ),
753             ObserverTemplate = F_ObserverTemplate(),
754             ),
755         ),
756     SimulatedObservationAtCurrentOptimum = BLOC (condition=" 'SimulatedObservationAtCurrentOptimum' in set(SELECTION) ",
757         SimulatedObservationAtCurrentOptimum_data = FACT(statut = "o",
758             Scheduler    = SIMP(statut = "f", typ = "TXM"),
759             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SimulatedObservationAtCurrentOptimum"),
760             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
761             PythonScript = BLOC (condition = " NodeType == 'String' ",
762                 Value = SIMP(statut = "o", typ = "TXM")
763                 ),
764             UserFile = BLOC (condition = " NodeType == 'Script' ",
765                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
766                 ),
767             ObserverTemplate = F_ObserverTemplate(),
768             ),
769         ),
770     BMA = BLOC (condition=" 'BMA' in set(SELECTION) ",
771         BMA_data = FACT(statut = "o",
772             Scheduler    = SIMP(statut = "f", typ = "TXM"),
773             Info         = SIMP(statut = "o", typ = "TXM", defaut = "BMA"),
774             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
775             PythonScript = BLOC (condition = " NodeType == 'String' ",
776                 Value = SIMP(statut = "o", typ = "TXM")
777                 ),
778             UserFile = BLOC (condition = " NodeType == 'Script' ",
779                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
780                 ),
781             ObserverTemplate = F_ObserverTemplate(),
782             ),
783         ),
784     OMA = BLOC (condition=" 'OMA' in set(SELECTION) ",
785         OMA_data = FACT(statut = "o",
786             Scheduler    = SIMP(statut = "f", typ = "TXM"),
787             Info         = SIMP(statut = "o", typ = "TXM", defaut = "OMA"),
788             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
789             PythonScript = BLOC (condition = " NodeType == 'String' ",
790                 Value = SIMP(statut = "o", typ = "TXM")
791                 ),
792             UserFile = BLOC (condition = " NodeType == 'Script' ",
793                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
794                 ),
795             ObserverTemplate = F_ObserverTemplate(),
796             ),
797         ),
798     OMB = BLOC (condition=" 'OMB' in set(SELECTION) ",
799         OMB_data = FACT(statut = "o",
800             Scheduler    = SIMP(statut = "f", typ = "TXM"),
801             Info         = SIMP(statut = "o", typ = "TXM", defaut = "OMB"),
802             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
803             PythonScript = BLOC (condition = " NodeType == 'String' ",
804                 Value = SIMP(statut = "o", typ = "TXM")
805                 ),
806             UserFile = BLOC (condition = " NodeType == 'Script' ",
807                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
808                 ),
809             ObserverTemplate = F_ObserverTemplate(),
810             ),
811         ),
812     CostFunctionJ = BLOC (condition=" 'CostFunctionJ' in set(SELECTION) ",
813         CostFunctionJ_data = FACT(statut = "o",
814             Scheduler    = SIMP(statut = "f", typ = "TXM"),
815             Info         = SIMP(statut = "o", typ = "TXM", defaut = "CostFunctionJ"),
816             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
817             PythonScript = BLOC (condition = " NodeType == 'String' ",
818                 Value = SIMP(statut = "o", typ = "TXM")
819                 ),
820             UserFile = BLOC (condition = " NodeType == 'Script' ",
821                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
822                 ),
823             ObserverTemplate = F_ObserverTemplate(),
824             ),
825         ),
826     CostFunctionJb = BLOC (condition=" 'CostFunctionJb' in set(SELECTION) ",
827         CostFunctionJb_data = FACT(statut = "o",
828             Scheduler    = SIMP(statut = "f", typ = "TXM"),
829             Info         = SIMP(statut = "o", typ = "TXM", defaut = "CostFunctionJb"),
830             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
831             PythonScript = BLOC (condition = " NodeType == 'String' ",
832                 Value = SIMP(statut = "o", typ = "TXM")
833                 ),
834             UserFile = BLOC (condition = " NodeType == 'Script' ",
835                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
836                 ),
837             ObserverTemplate = F_ObserverTemplate(),
838             ),
839         ),
840     CostFunctionJo = BLOC (condition=" 'CostFunctionJo' in set(SELECTION) ",
841         CostFunctionJo_data = FACT(statut = "o",
842             Scheduler    = SIMP(statut = "f", typ = "TXM"),
843             Info         = SIMP(statut = "o", typ = "TXM", defaut = "CostFunctionJo"),
844             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
845             PythonScript = BLOC (condition = " NodeType == 'String' ",
846                 Value = SIMP(statut = "o", typ = "TXM")
847                 ),
848             UserFile = BLOC (condition = " NodeType == 'Script' ",
849                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
850                 ),
851             ObserverTemplate = F_ObserverTemplate(),
852             ),
853         ),
854     GradientOfCostFunctionJ = BLOC (condition=" 'GradientOfCostFunctionJ' in set(SELECTION) ",
855         GradientOfCostFunctionJ_data = FACT(statut = "o",
856             Scheduler    = SIMP(statut = "f", typ = "TXM"),
857             Info         = SIMP(statut = "o", typ = "TXM", defaut = "GradientOfCostFunctionJ"),
858             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
859             PythonScript = BLOC (condition = " NodeType == 'String' ",
860                 Value = SIMP(statut = "o", typ = "TXM")
861                 ),
862             UserFile = BLOC (condition = " NodeType == 'Script' ",
863                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
864                 ),
865             ObserverTemplate = F_ObserverTemplate(),
866             ),
867         ),
868     GradientOfCostFunctionJb = BLOC (condition=" 'GradientOfCostFunctionJb' in set(SELECTION) ",
869         GradientOfCostFunctionJb_data = FACT(statut = "o",
870             Scheduler    = SIMP(statut = "f", typ = "TXM"),
871             Info         = SIMP(statut = "o", typ = "TXM", defaut = "GradientOfCostFunctionJb"),
872             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
873             PythonScript = BLOC (condition = " NodeType == 'String' ",
874                 Value = SIMP(statut = "o", typ = "TXM")
875                 ),
876             UserFile = BLOC (condition = " NodeType == 'Script' ",
877                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
878                 ),
879             ObserverTemplate = F_ObserverTemplate(),
880             ),
881         ),
882     GradientOfCostFunctionJo = BLOC (condition=" 'GradientOfCostFunctionJo' in set(SELECTION) ",
883         GradientOfCostFunctionJo_data = FACT(statut = "o",
884             Scheduler    = SIMP(statut = "f", typ = "TXM"),
885             Info         = SIMP(statut = "o", typ = "TXM", defaut = "GradientOfCostFunctionJo"),
886             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
887             PythonScript = BLOC (condition = " NodeType == 'String' ",
888                 Value = SIMP(statut = "o", typ = "TXM")
889                 ),
890             UserFile = BLOC (condition = " NodeType == 'Script' ",
891                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
892                 ),
893             ObserverTemplate = F_ObserverTemplate(),
894             ),
895         ),
896     SigmaObs2 = BLOC (condition=" 'SigmaObs2' in set(SELECTION) ",
897         SigmaObs2_data = FACT(statut = "o",
898             Scheduler    = SIMP(statut = "f", typ = "TXM"),
899             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SigmaObs2"),
900             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
901             PythonScript = BLOC (condition = " NodeType == 'String' ",
902                 Value = SIMP(statut = "o", typ = "TXM")
903                 ),
904             UserFile = BLOC (condition = " NodeType == 'Script' ",
905                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
906                 ),
907             ObserverTemplate = F_ObserverTemplate(),
908             ),
909         ),
910     SigmaBck2 = BLOC (condition=" 'SigmaBck2' in set(SELECTION) ",
911         SigmaBck2_data = FACT(statut = "o",
912             Scheduler    = SIMP(statut = "f", typ = "TXM"),
913             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SigmaBck2"),
914             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
915             PythonScript = BLOC (condition = " NodeType == 'String' ",
916                 Value = SIMP(statut = "o", typ = "TXM")
917                 ),
918             UserFile = BLOC (condition = " NodeType == 'Script' ",
919                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
920                 ),
921             ObserverTemplate = F_ObserverTemplate(),
922             ),
923         ),
924     APosterioriCorrelations = BLOC (condition=" 'APosterioriCorrelations' in set(SELECTION) ",
925         APosterioriCorrelations_data = FACT(statut = "o",
926             Scheduler    = SIMP(statut = "f", typ = "TXM"),
927             Info         = SIMP(statut = "o", typ = "TXM", defaut = "APosterioriCorrelations"),
928             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
929             PythonScript = BLOC (condition = " NodeType == 'String' ",
930                 Value = SIMP(statut = "o", typ = "TXM")
931                 ),
932             UserFile = BLOC (condition = " NodeType == 'Script' ",
933                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
934                 ),
935             ObserverTemplate = F_ObserverTemplate(),
936             ),
937         ),
938     APosterioriCovariance = BLOC (condition=" 'APosterioriCovariance' in set(SELECTION) ",
939         APosterioriCovariance_data = FACT(statut = "o",
940             Scheduler    = SIMP(statut = "f", typ = "TXM"),
941             Info         = SIMP(statut = "o", typ = "TXM", defaut = "APosterioriCovariance"),
942             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
943             PythonScript = BLOC (condition = " NodeType == 'String' ",
944                 Value = SIMP(statut = "o", typ = "TXM")
945                 ),
946             UserFile = BLOC (condition = " NodeType == 'Script' ",
947                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
948                 ),
949             ObserverTemplate = F_ObserverTemplate(),
950             ),
951         ),
952     APosterioriStandardDeviations = BLOC (condition=" 'APosterioriStandardDeviations' in set(SELECTION) ",
953         APosterioriStandardDeviations_data = FACT(statut = "o",
954             Scheduler    = SIMP(statut = "f", typ = "TXM"),
955             Info         = SIMP(statut = "o", typ = "TXM", defaut = "APosterioriStandardDeviations"),
956             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
957             PythonScript = BLOC (condition = " NodeType == 'String' ",
958                 Value = SIMP(statut = "o", typ = "TXM")
959                 ),
960             UserFile = BLOC (condition = " NodeType == 'Script' ",
961                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
962                 ),
963             ObserverTemplate = F_ObserverTemplate(),
964             ),
965         ),
966     APosterioriVariances = BLOC (condition=" 'APosterioriVariances' in set(SELECTION) ",
967         APosterioriVariances_data = FACT(statut = "o",
968             Scheduler    = SIMP(statut = "f", typ = "TXM"),
969             Info         = SIMP(statut = "o", typ = "TXM", defaut = "APosterioriVariances"),
970             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
971             PythonScript = BLOC (condition = " NodeType == 'String' ",
972                 Value = SIMP(statut = "o", typ = "TXM")
973                 ),
974             UserFile = BLOC (condition = " NodeType == 'Script' ",
975                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
976                 ),
977             ObserverTemplate = F_ObserverTemplate(),
978             ),
979         ),
980     )
981
982 def AlgorithmParametersInNS(filename):
983     if os.path.exists(filename):
984         fc = open(filename, 'r').readlines()
985         cr = re.compile("^AlgorithmParameters[\s]*=")
986         for ln in fc:
987             if cr.match(ln): return 1
988     return 0
989 AlgorithmParametersInNS.info = u"The Python file has to contain explicitly an \"AlgorithmParameters\" variable."
990 def F_AlgorithmParameters(statut, algos_names, fv=NoCheckInNS) : return FACT(
991     statut = statut,
992     Algorithm = SIMP(statut="o", typ = "TXM", into = algos_names ),
993     Parameters = SIMP(statut="f", typ = "TXM", into=("Defaults", "Dict") ),
994     Dict = BLOC ( condition = " Parameters == 'Dict' ",
995         statut="f",
996         data = F_Dict("o", fv),
997         ),
998     Parameters3DVAR = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == '3DVAR') ",
999         statut="f",
1000         Bounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes"),
1001         CostDecrementTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-07, fr="Diminution relative minimale du cout lors de l'arrêt"),
1002         GradientNormTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-05, fr="Maximum des composantes du gradient lors de l'arrêt"),
1003         MaximumNumberOfSteps = SIMP(statut="f", typ="I", val_min=-1, min=1, max=1, defaut=15000, fr="Nombre maximal de pas d'optimisation"),
1004         Minimizer = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="LBFGSB", into=['LBFGSB', 'TNC', 'CG', 'NCG', 'BFGS'], fr="Minimiseur utilisé"),
1005         NumberOfSamplesForQuantiles = SIMP(statut="f", typ="I", val_min=1, min=1, max=1, defaut=100, fr="Nombre d'échantillons simulés pour le calcul des quantiles"),
1006         ProjectedGradientTolerance = SIMP(statut="f", typ="R", val_min=-1, min=1, max=1, defaut=-1.0, fr="Maximum des composantes du gradient projeté lors de l'arrêt"),
1007         Quantiles = SIMP(statut="f", typ="TXM", max="**", into=None, fr="Liste des valeurs de quantiles"),
1008         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1009         SimulationForQuantiles = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="Linear", into=['Linear', 'NonLinear'], fr="Type de simulation pour l'estimation des quantiles"),
1010         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['APosterioriCorrelations', 'APosterioriCovariance', 'APosterioriStandardDeviations', 'APosterioriVariances', 'BMA', 'OMA', 'OMB', 'CurrentState', 'CostFunctionJ', 'CurrentOptimum', 'IndexOfOptimum', 'Innovation', 'SigmaObs2', 'MahalanobisConsistency', 'SimulationQuantiles', 'SimulatedObservationAtBackground', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum', 'SimulatedObservationAtCurrentOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1011         ),
1012     ParametersBlue = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'Blue') ",
1013         statut="f",
1014         NumberOfSamplesForQuantiles = SIMP(statut="f", typ="I", val_min=1, min=1, max=1, defaut=100, fr="Nombre d'échantillons simulés pour le calcul des quantiles"),
1015         Quantiles = SIMP(statut="f", typ="TXM", max="**", into=None, fr="Liste des valeurs de quantiles"),
1016         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1017         SimulationForQuantiles = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="Linear", into=['Linear', 'NonLinear'], fr="Type de simulation pour l'estimation des quantiles"),
1018         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['APosterioriCorrelations', 'APosterioriCovariance', 'APosterioriStandardDeviations', 'APosterioriVariances', 'BMA', 'OMA', 'OMB', 'CurrentState', 'CostFunctionJ', 'Innovation', 'SigmaBck2', 'SigmaObs2', 'MahalanobisConsistency', 'SimulationQuantiles', 'SimulatedObservationAtBackground', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1019         ),
1020     ParametersEnsembleBlue = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'EnsembleBlue') ",
1021         statut="f",
1022         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1023         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['CurrentState', 'Innovation', 'SimulatedObservationAtBackground', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1024         ),
1025     ParametersExtendedBlue = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'ExtendedBlue') ",
1026         statut="f",
1027         NumberOfSamplesForQuantiles = SIMP(statut="f", typ="I", val_min=1, min=1, max=1, defaut=100, fr="Nombre d'échantillons simulés pour le calcul des quantiles"),
1028         Quantiles = SIMP(statut="f", typ="TXM", max="**", into=None, fr="Liste des valeurs de quantiles"),
1029         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1030         SimulationForQuantiles = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="Linear", into=['Linear', 'NonLinear'], fr="Type de simulation pour l'estimation des quantiles"),
1031         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['APosterioriCorrelations', 'APosterioriCovariance', 'APosterioriStandardDeviations', 'APosterioriVariances', 'BMA', 'OMA', 'OMB', 'CurrentState', 'CostFunctionJ', 'Innovation', 'SigmaBck2', 'SigmaObs2', 'MahalanobisConsistency', 'SimulationQuantiles', 'SimulatedObservationAtBackground', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1032         ),
1033     ParametersExtendedKalmanFilter = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'ExtendedKalmanFilter') ",
1034         statut="f",
1035         Bounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes"),
1036         ConstrainedBy = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="EstimateProjection", into=['EstimateProjection'], fr="Prise en compte des contraintes"),
1037         EstimationOf = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="State", into=['State', 'Parameters'], fr="Estimation d'etat ou de parametres"),
1038         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['APosterioriCorrelations', 'APosterioriCovariance', 'APosterioriStandardDeviations', 'APosterioriVariances', 'BMA', 'CurrentState', 'CostFunctionJ', 'Innovation'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1039         ),
1040     ParametersKalmanFilter = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'KalmanFilter') ",
1041         statut="f",
1042         EstimationOf = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="State", into=['State', 'Parameters'], fr="Estimation d'etat ou de parametres"),
1043         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['APosterioriCorrelations', 'APosterioriCovariance', 'APosterioriStandardDeviations', 'APosterioriVariances', 'BMA', 'CurrentState', 'CostFunctionJ', 'Innovation'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1044         ),
1045     ParametersLinearLeastSquares = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'LinearLeastSquares') ",
1046         statut="f",
1047         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['OMA', 'CurrentState', 'CostFunctionJ', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1048         ),
1049     ParametersNonLinearLeastSquares = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'NonLinearLeastSquares') ",
1050         statut="f",
1051         Bounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes"),
1052         CostDecrementTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-07, fr="Diminution relative minimale du cout lors de l'arrêt"),
1053         GradientNormTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-05, fr="Maximum des composantes du gradient lors de l'arrêt"),
1054         MaximumNumberOfSteps = SIMP(statut="f", typ="I", val_min=-1, min=1, max=1, defaut=15000, fr="Nombre maximal de pas d'optimisation"),
1055         Minimizer = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="LBFGSB", into=['LBFGSB', 'TNC', 'CG', 'NCG', 'BFGS', 'LM'], fr="Minimiseur utilisé"),
1056         ProjectedGradientTolerance = SIMP(statut="f", typ="R", val_min=-1, min=1, max=1, defaut=-1.0, fr="Maximum des composantes du gradient projeté lors de l'arrêt"),
1057         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['BMA', 'OMA', 'OMB', 'CurrentState', 'CostFunctionJ', 'Innovation', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1058         ),
1059     ParametersParticleSwarmOptimization = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'ParticleSwarmOptimization') ",
1060         statut="f",
1061         BoxBounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes d'incréments de paramètres"),
1062         GroupRecallRate = SIMP(statut="f", typ="R", val_min=0.0, val_max=1.0, min=1, max=1, defaut=0.5, fr="Taux de rappel au meilleur insecte du groupe (entre 0 et 1)"),
1063         MaximumNumberOfSteps = SIMP(statut="f", typ="I", val_min=1, min=1, max=1, defaut=50, fr="Nombre maximal de pas d'optimisation"),
1064         NumberOfInsects = SIMP(statut="f", typ="I", val_min=-1, min=1, max=1, defaut=100, fr="Nombre d'insectes dans l'essaim"),
1065         QualityCriterion = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="AugmentedWeightedLeastSquares", into=['AugmentedWeightedLeastSquares', 'AWLS', 'AugmentedPonderatedLeastSquares', 'APLS', 'DA', 'WeightedLeastSquares', 'WLS', 'PonderatedLeastSquares', 'PLS', 'LeastSquares', 'LS', 'L2', 'AbsoluteValue', 'L1', 'MaximumError', 'ME'], fr="Critère de qualité utilisé"),
1066         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1067         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['BMA', 'OMA', 'OMB', 'CurrentState', 'CostFunctionJ', 'Innovation', 'SimulatedObservationAtBackground', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1068         SwarmVelocity = SIMP(statut="f", typ="R", val_min=0.0, min=1, max=1, defaut=1.0, fr="Vitesse de groupe imposée par l'essaim"),
1069         ),
1070     ParametersQuantileRegression = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'QuantileRegression') ",
1071         statut="f",
1072         Bounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes"),
1073         CostDecrementTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-06, fr="Maximum de variation de la fonction d'estimation lors de l'arrêt"),
1074         MaximumNumberOfSteps = SIMP(statut="f", typ="I", val_min=1, min=1, max=1, defaut=15000, fr="Nombre maximal de pas d'optimisation"),
1075         Minimizer = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="MMQR", into=['MMQR'], fr="Minimiseur utilisé"),
1076         Quantile = SIMP(statut="f", typ="R", val_min=0.0, val_max=1.0, min=1, max=1, defaut=0.5, fr="Quantile pour la regression de quantile"),
1077         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['BMA', 'OMA', 'OMB', 'CurrentState', 'CostFunctionJ', 'Innovation', 'SimulatedObservationAtBackground', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1078         ),
1079     ParametersUnscentedKalmanFilter = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'UnscentedKalmanFilter') ",
1080         statut="f",
1081         Alpha = SIMP(statut="f", typ="R", val_min=0.0001, val_max=1.0, min=1, max=1, defaut=1.0, fr=""),
1082         Beta = SIMP(statut="f", typ="R", min=1, max=1, defaut=2.0, fr=""),
1083         Bounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes"),
1084         ConstrainedBy = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="EstimateProjection", into=['EstimateProjection'], fr="Prise en compte des contraintes"),
1085         EstimationOf = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="State", into=['State', 'Parameters'], fr="Estimation d'etat ou de parametres"),
1086         Kappa = SIMP(statut="f", typ="I", val_max=2, min=1, max=1, defaut=0, fr=""),
1087         Reconditioner = SIMP(statut="f", typ="R", val_min=0.001, val_max=10.0, min=1, max=1, defaut=1.0, fr=""),
1088         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['APosterioriCorrelations', 'APosterioriCovariance', 'APosterioriStandardDeviations', 'APosterioriVariances', 'BMA', 'CurrentState', 'CostFunctionJ', 'Innovation'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1089         ),
1090     ParametersAdjointTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'AdjointTest') ",
1091         statut="f",
1092         AmplitudeOfInitialDirection = SIMP(statut="f", typ="R", min=1, max=1, defaut=1.0, fr="Amplitude de la direction initiale de la dérivée directionnelle autour du point nominal"),
1093         EpsilonMinimumExponent = SIMP(statut="f", typ="I", val_min=-20, val_max=0, min=1, max=1, defaut=-8, fr="Exposant minimal en puissance de 10 pour le multiplicateur d'incrément"),
1094         InitialDirection = SIMP(statut="f", typ="TXM", fr="Direction initiale de la dérivée directionnelle autour du point nominal"),
1095         ResiduFormula = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="ScalarProduct", into=['ScalarProduct'], fr="Formule de résidu utilisée"),
1096         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1097         ),
1098     ParametersFunctionTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'FunctionTest') ",
1099         statut="f",
1100         NumberOfPrintedDigits = SIMP(statut="f", typ="I", val_min=0, min=1, max=1, defaut=5, fr="Nombre de chiffres affichés pour les impressions de réels"),
1101         NumberOfRepetition = SIMP(statut="f", typ="I", val_min=1, min=1, max=1, defaut=1, fr="Nombre de fois où l'exécution de la fonction est répétée"),
1102         SetDebug = SIMP(statut="f", typ="I", min=1, max=1, defaut=0, fr="Activation du mode debug lors de l'exécution"),
1103         ),
1104     ParametersGradientTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'GradientTest') ",
1105         statut="f",
1106         AmplitudeOfInitialDirection = SIMP(statut="f", typ="R", min=1, max=1, defaut=1.0, fr="Amplitude de la direction initiale de la dérivée directionnelle autour du point nominal"),
1107         AmplitudeOfTangentPerturbation = SIMP(statut="f", typ="R", val_min=1e-10, val_max=1.0, min=1, max=1, defaut=0.01, fr="Amplitude de la perturbation pour le calcul de la forme tangente"),
1108         EpsilonMinimumExponent = SIMP(statut="f", typ="I", val_min=-20, val_max=0, min=1, max=1, defaut=-8, fr="Exposant minimal en puissance de 10 pour le multiplicateur d'incrément"),
1109         InitialDirection = SIMP(statut="f", typ="TXM", fr="Direction initiale de la dérivée directionnelle autour du point nominal"),
1110         ResiduFormula = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="Taylor", into=['Norm', 'TaylorOnNorm', 'Taylor'], fr="Formule de résidu utilisée"),
1111         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1112         ),
1113     ParametersLinearityTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'LinearityTest') ",
1114         statut="f",
1115         AmplitudeOfInitialDirection = SIMP(statut="f", typ="R", min=1, max=1, defaut=1.0, fr="Amplitude de la direction initiale de la dérivée directionnelle autour du point nominal"),
1116         AmplitudeOfTangentPerturbation = SIMP(statut="f", typ="R", val_min=1e-10, val_max=1.0, min=1, max=1, defaut=0.01, fr="Amplitude de la perturbation pour le calcul de la forme tangente"),
1117         EpsilonMinimumExponent = SIMP(statut="f", typ="I", val_min=-20, val_max=0, min=1, max=1, defaut=-8, fr="Exposant minimal en puissance de 10 pour le multiplicateur d'incrément"),
1118         InitialDirection = SIMP(statut="f", typ="TXM", fr="Direction initiale de la dérivée directionnelle autour du point nominal"),
1119         ResiduFormula = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="CenteredDL", into=['CenteredDL', 'Taylor', 'NominalTaylor', 'NominalTaylorRMS'], fr="Formule de résidu utilisée"),
1120         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1121         ),
1122     ParametersSamplingTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'SamplingTest') ",
1123         statut="f",
1124         QualityCriterion = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="AugmentedWeightedLeastSquares", into=['AugmentedWeightedLeastSquares', 'AWLS', 'AugmentedPonderatedLeastSquares', 'APLS', 'DA', 'WeightedLeastSquares', 'WLS', 'PonderatedLeastSquares', 'PLS', 'LeastSquares', 'LS', 'L2', 'AbsoluteValue', 'L1', 'MaximumError', 'ME'], fr="Critère de qualité utilisé"),
1125         SampleAsExplicitHyperCube = SIMP(statut="f", typ="TXM", max="**", into=None, fr="Points de calcul définis par un hyper-cube dont on donne la liste des échantillonages de chaque variable comme une liste"),
1126         SampleAsIndependantRandomVariables = SIMP(statut="f", typ="TXM", max="**", into=None, fr="Points de calcul définis par un hyper-cube dont les points sur chaque axe proviennent de l'échantillonage indépendant de la variable selon la spécification ['distribution',[parametres],nombre]"),
1127         SampleAsMinMaxStepHyperCube = SIMP(statut="f", typ="TXM", max="**", into=None, fr="Points de calcul définis par un hyper-cube dont on donne la liste des échantillonages de chaque variable par un triplet [min,max,step]"),
1128         SampleAsnUplet = SIMP(statut="f", typ="TXM", max="**", into=None, fr="Points de calcul définis par une liste de n-uplet"),
1129         SetDebug = SIMP(statut="f", typ="I", min=1, max=1, defaut=0, fr="Activation du mode debug lors de l'exécution"),
1130         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1131         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['CostFunctionJ', 'CurrentState', 'Innovation', 'SimulatedObservationAtCurrentState'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1132         ),
1133     ParametersTangentTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'TangentTest') ",
1134         statut="f",
1135         AmplitudeOfInitialDirection = SIMP(statut="f", typ="R", min=1, max=1, defaut=1.0, fr="Amplitude de la direction initiale de la dérivée directionnelle autour du point nominal"),
1136         AmplitudeOfTangentPerturbation = SIMP(statut="f", typ="R", val_min=1e-10, val_max=1.0, min=1, max=1, defaut=0.01, fr="Amplitude de la perturbation pour le calcul de la forme tangente"),
1137         EpsilonMinimumExponent = SIMP(statut="f", typ="I", val_min=-20, val_max=0, min=1, max=1, defaut=-8, fr="Exposant minimal en puissance de 10 pour le multiplicateur d'incrément"),
1138         InitialDirection = SIMP(statut="f", typ="TXM", fr="Direction initiale de la dérivée directionnelle autour du point nominal"),
1139         ResiduFormula = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="Taylor", into=['Taylor'], fr="Formule de résidu utilisée"),
1140         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1141         ),
1142     )
1143
1144 def F_variables(statut) : return FACT(
1145     statut=statut,
1146     regles = ( MEME_NOMBRE ('NAMES', 'SIZES')),
1147     NAMES = SIMP(statut="o", typ="TXM", max="**", validators=NoRepeat()),
1148     SIZES = SIMP(statut="o", typ="I", val_min=1, max="**")
1149     )
1150 def ChDir(dirname):
1151     os.chdir(os.path.abspath(dirname))
1152     return 1
1153 ChDir.info = u"This has to be a regular directory path."
1154
1155 ASSIMILATION_STUDY = PROC(nom="ASSIMILATION_STUDY",
1156     op=None,
1157     repetable           = "n",
1158     StudyName           = SIMP(statut="o", typ = "TXM", defaut="ADAO Calculation Case"),
1159     StudyRepertory      = SIMP(statut="f", typ = "Repertoire", validators=FunctionVal(ChDir), min=1, max=1),
1160     Debug               = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0),
1161     AlgorithmParameters = F_AlgorithmParameters("o",("3DVAR", "Blue", "EnsembleBlue", "ExtendedBlue", "ExtendedKalmanFilter", "KalmanFilter", "LinearLeastSquares", "NonLinearLeastSquares", "ParticleSwarmOptimization", "QuantileRegression", "UnscentedKalmanFilter", ), AlgorithmParametersInNS),
1162     Background          = F_Background("o", BackgroundInNS),
1163     BackgroundError     = F_BackgroundError("o", BackgroundErrorInNS),
1164     Observation         = F_Observation("o", ObservationInNS),
1165     ObservationError    = F_ObservationError("o", ObservationErrorInNS),
1166     ObservationOperator = F_ObservationOperator("o"),
1167     EvolutionModel      = F_EvolutionModel("f"),
1168     EvolutionError      = F_EvolutionError("f", EvolutionErrorInNS),
1169     ControlInput        = F_ControlInput("f"),
1170     UserDataInit        = F_Init("f"),
1171     UserPostAnalysis    = F_UserPostAnalysis("o"),
1172     InputVariables      = F_variables("f"),
1173     OutputVariables     = F_variables("f"),
1174     Observers           = F_Observers("f")
1175     )
1176
1177 CHECKING_STUDY = PROC(nom="CHECKING_STUDY",
1178     op=None,
1179     repetable           = "n",
1180     StudyName           = SIMP(statut="o", typ = "TXM", defaut="ADAO Checking Case"),
1181     StudyRepertory      = SIMP(statut="f", typ = "Repertoire", validators=FunctionVal(ChDir), min=1, max=1),
1182     Debug               = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0),
1183     AlgorithmParameters = F_AlgorithmParameters("o", ("AdjointTest", "FunctionTest", "GradientTest", "LinearityTest", "ObserverTest", "SamplingTest", "TangentTest", ), AlgorithmParametersInNS),
1184     CheckingPoint       = F_CheckingPoint("o", CheckingPointInNS),
1185     BackgroundError     = F_BackgroundError("f", BackgroundErrorInNS),
1186     Observation         = F_Observation("f", ObservationInNS),
1187     ObservationError    = F_ObservationError("f", ObservationErrorInNS),
1188     ObservationOperator = F_ObservationOperator("o"),
1189     UserDataInit        = F_Init("f"),
1190     Observers           = F_Observers("f")
1191     )