Salome HOME
sauve0206
[tools/eficas.git] / Adao / ADAO_Cata_V0_V7_7_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-10-08 07:57:55
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_7_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", "ValueMean", "ValueStandardError", "ValueVariance", "ValueL2Norm", "ValueRMS")),
603                 ValuePrinter = BLOC (condition = " Template == 'ValuePrinter' ",
604                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print info, var[-1]", fr="Imprime sur la sortie standard la valeur courante de la variable", ang="Print on standard output the current value of the variable" ),
605                     ),
606                 ValueSeriePrinter = BLOC (condition = " Template == 'ValueSeriePrinter' ",
607                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print info, var[:]", fr="Imprime sur la sortie standard la série des valeurs de la variable", ang="Print on standard output the value serie of the variable" ),
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)", fr="Enregistre la valeur courante de la variable dans un fichier du répertoire '/tmp' nommé 'value...txt' selon le nom de la variable et l'étape d'enregistrement", ang="Save the current value of the variable in a file of the '/tmp' directory named 'value...txt' from the variable name and the saving step" ),
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)", fr="Enregistre la série des valeurs de la variable dans un fichier du répertoire '/tmp' nommé 'value...txt' selon le nom de la variable et l'étape", ang="Save the value serie of the variable in a file of the '/tmp' directory named 'value...txt' from the variable name and the saving step" ),
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)", fr="Imprime sur la sortie standard et, en même temps, enregistre dans un fichier la valeur courante de la variable", ang="Print on standard output and, in the same time, save in a file the current value of the variable" ),
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)", fr="Imprime sur la sortie standard et, en même temps, enregistre dans un fichier la série des valeurs de la variable", ang="Print on standard output and, in the same time, save in a file the value serie of the variable" ),
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' ) )", fr="Affiche graphiquement avec Gnuplot la valeur courante de la variable", ang="Graphically plot with Gnuplot the current value of the variable" ),
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' ) )", fr="Affiche graphiquement avec Gnuplot la série des valeurs de la variable", ang="Graphically plot with Gnuplot the value serie of the variable" ),
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' ) )", fr="Imprime sur la sortie standard et, en même temps, affiche graphiquement avec Gnuplot la valeur courante de la variable", ang="Print on standard output and, in the same time, graphically plot with Gnuplot the current value of the variable" ),
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' ) )", fr="Imprime sur la sortie standard et, en même temps, affiche graphiquement avec Gnuplot la série des valeurs de la variable", ang="Print on standard output and, in the same time, graphically plot with Gnuplot the value serie of the variable" ),
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' ) )", fr="Imprime sur la sortie standard et, en même temps, enregistre dans un fichier et affiche graphiquement la valeur courante de la variable ", ang="Print on standard output and, in the same, time save in a file and graphically plot the current value of the variable" ),
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' ) )", fr="Imprime sur la sortie standard et, en même temps, enregistre dans un fichier et affiche graphiquement la série des valeurs de la variable", ang="Print on standard output and, in the same, time save in a file and graphically plot the value serie of the variable" ),
638                     ),
639                 ValueMean = BLOC (condition = " Template == 'ValueMean' ",
640                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nprint info, numpy.nanmean(var[-1])", fr="Imprime sur la sortie standard la moyenne de la valeur courante de la variable", ang="Print on standard output the mean of the current value of the variable" ),
641                     ),
642                 ValueStandardError = BLOC (condition = " Template == 'ValueStandardError' ",
643                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nprint info, numpy.nanstd(var[-1])", fr="Imprime sur la sortie standard l'écart-type de la valeur courante de la variable", ang="Print on standard output the standard error of the current value of the variable" ),
644                     ),
645                 ValueVariance = BLOC (condition = " Template == 'ValueVariance' ",
646                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nprint info, numpy.nanvar(var[-1])", fr="Imprime sur la sortie standard la variance de la valeur courante de la variable", ang="Print on standard output the variance of the current value of the variable" ),
647                     ),
648                 ValueL2Norm = BLOC (condition = " Template == 'ValueL2Norm' ",
649                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nv = numpy.matrix( numpy.ravel( var[-1] ) )\nprint info, float( numpy.linalg.norm(v) )", fr="Imprime sur la sortie standard la norme L2 de la valeur courante de la variable", ang="Print on standard output the L2 norm of the current value of the variable" ),
650                     ),
651                 ValueRMS = BLOC (condition = " Template == 'ValueRMS' ",
652                     ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\nv = numpy.matrix( numpy.ravel( var[-1] ) )\nprint info, float( numpy.sqrt((1./v.size)*(v*v.T)) )", fr="Imprime sur la sortie standard la racine de la moyenne des carrés (RMS), ou moyenne quadratique, de la valeur courante de la variable", ang="Print on standard output the root mean square (RMS), or quadratic mean, of the current value of the variable" ),
653                     ),
654                 )
655
656 def F_Observers(statut) : return FACT(
657     statut=statut,
658     SELECTION = SIMP(statut="o", defaut=[], typ="TXM", min=0, max="**", validators=NoRepeat(), into=(['Analysis', 'Innovation', 'InnovationAtCurrentState', 'CurrentState', 'CurrentOptimum', 'IndexOfOptimum', 'SimulatedObservationAtBackground', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum', 'SimulatedObservationAtCurrentOptimum', 'BMA', 'OMA', 'OMB', 'CostFunctionJ', 'CostFunctionJb', 'CostFunctionJo', 'GradientOfCostFunctionJ', 'GradientOfCostFunctionJb', 'GradientOfCostFunctionJo', 'SigmaObs2', 'SigmaBck2', 'APosterioriCorrelations', 'APosterioriCovariance', 'APosterioriStandardDeviations', 'APosterioriVariances', 'Residu'])),
659     Analysis = BLOC (condition=" 'Analysis' in set(SELECTION) ",
660         Analysis_data = FACT(statut = "o",
661             Scheduler    = SIMP(statut = "f", typ = "TXM"),
662             Info         = SIMP(statut = "o", typ = "TXM", defaut = "Analysis"),
663             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
664             PythonScript = BLOC (condition = " NodeType == 'String' ",
665                 Value = SIMP(statut = "o", typ = "TXM")
666                 ),
667             UserFile = BLOC (condition = " NodeType == 'Script' ",
668                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
669                 ),
670             ObserverTemplate = F_ObserverTemplate(),
671             ),
672         ),
673     Innovation = BLOC (condition=" 'Innovation' in set(SELECTION) ",
674         Innovation_data = FACT(statut = "o",
675             Scheduler    = SIMP(statut = "f", typ = "TXM"),
676             Info         = SIMP(statut = "o", typ = "TXM", defaut = "Innovation"),
677             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
678             PythonScript = BLOC (condition = " NodeType == 'String' ",
679                 Value = SIMP(statut = "o", typ = "TXM")
680                 ),
681             UserFile = BLOC (condition = " NodeType == 'Script' ",
682                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
683                 ),
684             ObserverTemplate = F_ObserverTemplate(),
685             ),
686         ),
687     InnovationAtCurrentState = BLOC (condition=" 'InnovationAtCurrentState' in set(SELECTION) ",
688         InnovationAtCurrentState_data = FACT(statut = "o",
689             Scheduler    = SIMP(statut = "f", typ = "TXM"),
690             Info         = SIMP(statut = "o", typ = "TXM", defaut = "InnovationAtCurrentState"),
691             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
692             PythonScript = BLOC (condition = " NodeType == 'String' ",
693                 Value = SIMP(statut = "o", typ = "TXM")
694                 ),
695             UserFile = BLOC (condition = " NodeType == 'Script' ",
696                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
697                 ),
698             ObserverTemplate = F_ObserverTemplate(),
699             ),
700         ),
701     CurrentState = BLOC (condition=" 'CurrentState' in set(SELECTION) ",
702         CurrentState_data = FACT(statut = "o",
703             Scheduler    = SIMP(statut = "f", typ = "TXM"),
704             Info         = SIMP(statut = "o", typ = "TXM", defaut = "CurrentState"),
705             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
706             PythonScript = BLOC (condition = " NodeType == 'String' ",
707                 Value = SIMP(statut = "o", typ = "TXM")
708                 ),
709             UserFile = BLOC (condition = " NodeType == 'Script' ",
710                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
711                 ),
712             ObserverTemplate = F_ObserverTemplate(),
713             ),
714         ),
715     CurrentOptimum = BLOC (condition=" 'CurrentOptimum' in set(SELECTION) ",
716         CurrentOptimum_data = FACT(statut = "o",
717             Scheduler    = SIMP(statut = "f", typ = "TXM"),
718             Info         = SIMP(statut = "o", typ = "TXM", defaut = "CurrentOptimum"),
719             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
720             PythonScript = BLOC (condition = " NodeType == 'String' ",
721                 Value = SIMP(statut = "o", typ = "TXM")
722                 ),
723             UserFile = BLOC (condition = " NodeType == 'Script' ",
724                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
725                 ),
726             ObserverTemplate = F_ObserverTemplate(),
727             ),
728         ),
729     IndexOfOptimum = BLOC (condition=" 'IndexOfOptimum' in set(SELECTION) ",
730         IndexOfOptimum_data = FACT(statut = "o",
731             Scheduler    = SIMP(statut = "f", typ = "TXM"),
732             Info         = SIMP(statut = "o", typ = "TXM", defaut = "IndexOfOptimum"),
733             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
734             PythonScript = BLOC (condition = " NodeType == 'String' ",
735                 Value = SIMP(statut = "o", typ = "TXM")
736                 ),
737             UserFile = BLOC (condition = " NodeType == 'Script' ",
738                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
739                 ),
740             ObserverTemplate = F_ObserverTemplate(),
741             ),
742         ),
743     SimulatedObservationAtBackground = BLOC (condition=" 'SimulatedObservationAtBackground' in set(SELECTION) ",
744         SimulatedObservationAtBackground_data = FACT(statut = "o",
745             Scheduler    = SIMP(statut = "f", typ = "TXM"),
746             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SimulatedObservationAtBackground"),
747             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
748             PythonScript = BLOC (condition = " NodeType == 'String' ",
749                 Value = SIMP(statut = "o", typ = "TXM")
750                 ),
751             UserFile = BLOC (condition = " NodeType == 'Script' ",
752                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
753                 ),
754             ObserverTemplate = F_ObserverTemplate(),
755             ),
756         ),
757     SimulatedObservationAtCurrentState = BLOC (condition=" 'SimulatedObservationAtCurrentState' in set(SELECTION) ",
758         SimulatedObservationAtCurrentState_data = FACT(statut = "o",
759             Scheduler    = SIMP(statut = "f", typ = "TXM"),
760             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SimulatedObservationAtCurrentState"),
761             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
762             PythonScript = BLOC (condition = " NodeType == 'String' ",
763                 Value = SIMP(statut = "o", typ = "TXM")
764                 ),
765             UserFile = BLOC (condition = " NodeType == 'Script' ",
766                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
767                 ),
768             ObserverTemplate = F_ObserverTemplate(),
769             ),
770         ),
771     SimulatedObservationAtOptimum = BLOC (condition=" 'SimulatedObservationAtOptimum' in set(SELECTION) ",
772         SimulatedObservationAtOptimum_data = FACT(statut = "o",
773             Scheduler    = SIMP(statut = "f", typ = "TXM"),
774             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SimulatedObservationAtOptimum"),
775             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
776             PythonScript = BLOC (condition = " NodeType == 'String' ",
777                 Value = SIMP(statut = "o", typ = "TXM")
778                 ),
779             UserFile = BLOC (condition = " NodeType == 'Script' ",
780                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
781                 ),
782             ObserverTemplate = F_ObserverTemplate(),
783             ),
784         ),
785     SimulatedObservationAtCurrentOptimum = BLOC (condition=" 'SimulatedObservationAtCurrentOptimum' in set(SELECTION) ",
786         SimulatedObservationAtCurrentOptimum_data = FACT(statut = "o",
787             Scheduler    = SIMP(statut = "f", typ = "TXM"),
788             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SimulatedObservationAtCurrentOptimum"),
789             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
790             PythonScript = BLOC (condition = " NodeType == 'String' ",
791                 Value = SIMP(statut = "o", typ = "TXM")
792                 ),
793             UserFile = BLOC (condition = " NodeType == 'Script' ",
794                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
795                 ),
796             ObserverTemplate = F_ObserverTemplate(),
797             ),
798         ),
799     BMA = BLOC (condition=" 'BMA' in set(SELECTION) ",
800         BMA_data = FACT(statut = "o",
801             Scheduler    = SIMP(statut = "f", typ = "TXM"),
802             Info         = SIMP(statut = "o", typ = "TXM", defaut = "BMA"),
803             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
804             PythonScript = BLOC (condition = " NodeType == 'String' ",
805                 Value = SIMP(statut = "o", typ = "TXM")
806                 ),
807             UserFile = BLOC (condition = " NodeType == 'Script' ",
808                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
809                 ),
810             ObserverTemplate = F_ObserverTemplate(),
811             ),
812         ),
813     OMA = BLOC (condition=" 'OMA' in set(SELECTION) ",
814         OMA_data = FACT(statut = "o",
815             Scheduler    = SIMP(statut = "f", typ = "TXM"),
816             Info         = SIMP(statut = "o", typ = "TXM", defaut = "OMA"),
817             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
818             PythonScript = BLOC (condition = " NodeType == 'String' ",
819                 Value = SIMP(statut = "o", typ = "TXM")
820                 ),
821             UserFile = BLOC (condition = " NodeType == 'Script' ",
822                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
823                 ),
824             ObserverTemplate = F_ObserverTemplate(),
825             ),
826         ),
827     OMB = BLOC (condition=" 'OMB' in set(SELECTION) ",
828         OMB_data = FACT(statut = "o",
829             Scheduler    = SIMP(statut = "f", typ = "TXM"),
830             Info         = SIMP(statut = "o", typ = "TXM", defaut = "OMB"),
831             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
832             PythonScript = BLOC (condition = " NodeType == 'String' ",
833                 Value = SIMP(statut = "o", typ = "TXM")
834                 ),
835             UserFile = BLOC (condition = " NodeType == 'Script' ",
836                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
837                 ),
838             ObserverTemplate = F_ObserverTemplate(),
839             ),
840         ),
841     CostFunctionJ = BLOC (condition=" 'CostFunctionJ' in set(SELECTION) ",
842         CostFunctionJ_data = FACT(statut = "o",
843             Scheduler    = SIMP(statut = "f", typ = "TXM"),
844             Info         = SIMP(statut = "o", typ = "TXM", defaut = "CostFunctionJ"),
845             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
846             PythonScript = BLOC (condition = " NodeType == 'String' ",
847                 Value = SIMP(statut = "o", typ = "TXM")
848                 ),
849             UserFile = BLOC (condition = " NodeType == 'Script' ",
850                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
851                 ),
852             ObserverTemplate = F_ObserverTemplate(),
853             ),
854         ),
855     CostFunctionJb = BLOC (condition=" 'CostFunctionJb' in set(SELECTION) ",
856         CostFunctionJb_data = FACT(statut = "o",
857             Scheduler    = SIMP(statut = "f", typ = "TXM"),
858             Info         = SIMP(statut = "o", typ = "TXM", defaut = "CostFunctionJb"),
859             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
860             PythonScript = BLOC (condition = " NodeType == 'String' ",
861                 Value = SIMP(statut = "o", typ = "TXM")
862                 ),
863             UserFile = BLOC (condition = " NodeType == 'Script' ",
864                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
865                 ),
866             ObserverTemplate = F_ObserverTemplate(),
867             ),
868         ),
869     CostFunctionJo = BLOC (condition=" 'CostFunctionJo' in set(SELECTION) ",
870         CostFunctionJo_data = FACT(statut = "o",
871             Scheduler    = SIMP(statut = "f", typ = "TXM"),
872             Info         = SIMP(statut = "o", typ = "TXM", defaut = "CostFunctionJo"),
873             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
874             PythonScript = BLOC (condition = " NodeType == 'String' ",
875                 Value = SIMP(statut = "o", typ = "TXM")
876                 ),
877             UserFile = BLOC (condition = " NodeType == 'Script' ",
878                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
879                 ),
880             ObserverTemplate = F_ObserverTemplate(),
881             ),
882         ),
883     GradientOfCostFunctionJ = BLOC (condition=" 'GradientOfCostFunctionJ' in set(SELECTION) ",
884         GradientOfCostFunctionJ_data = FACT(statut = "o",
885             Scheduler    = SIMP(statut = "f", typ = "TXM"),
886             Info         = SIMP(statut = "o", typ = "TXM", defaut = "GradientOfCostFunctionJ"),
887             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
888             PythonScript = BLOC (condition = " NodeType == 'String' ",
889                 Value = SIMP(statut = "o", typ = "TXM")
890                 ),
891             UserFile = BLOC (condition = " NodeType == 'Script' ",
892                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
893                 ),
894             ObserverTemplate = F_ObserverTemplate(),
895             ),
896         ),
897     GradientOfCostFunctionJb = BLOC (condition=" 'GradientOfCostFunctionJb' in set(SELECTION) ",
898         GradientOfCostFunctionJb_data = FACT(statut = "o",
899             Scheduler    = SIMP(statut = "f", typ = "TXM"),
900             Info         = SIMP(statut = "o", typ = "TXM", defaut = "GradientOfCostFunctionJb"),
901             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
902             PythonScript = BLOC (condition = " NodeType == 'String' ",
903                 Value = SIMP(statut = "o", typ = "TXM")
904                 ),
905             UserFile = BLOC (condition = " NodeType == 'Script' ",
906                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
907                 ),
908             ObserverTemplate = F_ObserverTemplate(),
909             ),
910         ),
911     GradientOfCostFunctionJo = BLOC (condition=" 'GradientOfCostFunctionJo' in set(SELECTION) ",
912         GradientOfCostFunctionJo_data = FACT(statut = "o",
913             Scheduler    = SIMP(statut = "f", typ = "TXM"),
914             Info         = SIMP(statut = "o", typ = "TXM", defaut = "GradientOfCostFunctionJo"),
915             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
916             PythonScript = BLOC (condition = " NodeType == 'String' ",
917                 Value = SIMP(statut = "o", typ = "TXM")
918                 ),
919             UserFile = BLOC (condition = " NodeType == 'Script' ",
920                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
921                 ),
922             ObserverTemplate = F_ObserverTemplate(),
923             ),
924         ),
925     SigmaObs2 = BLOC (condition=" 'SigmaObs2' in set(SELECTION) ",
926         SigmaObs2_data = FACT(statut = "o",
927             Scheduler    = SIMP(statut = "f", typ = "TXM"),
928             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SigmaObs2"),
929             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
930             PythonScript = BLOC (condition = " NodeType == 'String' ",
931                 Value = SIMP(statut = "o", typ = "TXM")
932                 ),
933             UserFile = BLOC (condition = " NodeType == 'Script' ",
934                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
935                 ),
936             ObserverTemplate = F_ObserverTemplate(),
937             ),
938         ),
939     SigmaBck2 = BLOC (condition=" 'SigmaBck2' in set(SELECTION) ",
940         SigmaBck2_data = FACT(statut = "o",
941             Scheduler    = SIMP(statut = "f", typ = "TXM"),
942             Info         = SIMP(statut = "o", typ = "TXM", defaut = "SigmaBck2"),
943             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
944             PythonScript = BLOC (condition = " NodeType == 'String' ",
945                 Value = SIMP(statut = "o", typ = "TXM")
946                 ),
947             UserFile = BLOC (condition = " NodeType == 'Script' ",
948                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
949                 ),
950             ObserverTemplate = F_ObserverTemplate(),
951             ),
952         ),
953     APosterioriCorrelations = BLOC (condition=" 'APosterioriCorrelations' in set(SELECTION) ",
954         APosterioriCorrelations_data = FACT(statut = "o",
955             Scheduler    = SIMP(statut = "f", typ = "TXM"),
956             Info         = SIMP(statut = "o", typ = "TXM", defaut = "APosterioriCorrelations"),
957             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
958             PythonScript = BLOC (condition = " NodeType == 'String' ",
959                 Value = SIMP(statut = "o", typ = "TXM")
960                 ),
961             UserFile = BLOC (condition = " NodeType == 'Script' ",
962                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
963                 ),
964             ObserverTemplate = F_ObserverTemplate(),
965             ),
966         ),
967     APosterioriCovariance = BLOC (condition=" 'APosterioriCovariance' in set(SELECTION) ",
968         APosterioriCovariance_data = FACT(statut = "o",
969             Scheduler    = SIMP(statut = "f", typ = "TXM"),
970             Info         = SIMP(statut = "o", typ = "TXM", defaut = "APosterioriCovariance"),
971             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
972             PythonScript = BLOC (condition = " NodeType == 'String' ",
973                 Value = SIMP(statut = "o", typ = "TXM")
974                 ),
975             UserFile = BLOC (condition = " NodeType == 'Script' ",
976                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
977                 ),
978             ObserverTemplate = F_ObserverTemplate(),
979             ),
980         ),
981     APosterioriStandardDeviations = BLOC (condition=" 'APosterioriStandardDeviations' in set(SELECTION) ",
982         APosterioriStandardDeviations_data = FACT(statut = "o",
983             Scheduler    = SIMP(statut = "f", typ = "TXM"),
984             Info         = SIMP(statut = "o", typ = "TXM", defaut = "APosterioriStandardDeviations"),
985             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
986             PythonScript = BLOC (condition = " NodeType == 'String' ",
987                 Value = SIMP(statut = "o", typ = "TXM")
988                 ),
989             UserFile = BLOC (condition = " NodeType == 'Script' ",
990                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
991                 ),
992             ObserverTemplate = F_ObserverTemplate(),
993             ),
994         ),
995     APosterioriVariances = BLOC (condition=" 'APosterioriVariances' in set(SELECTION) ",
996         APosterioriVariances_data = FACT(statut = "o",
997             Scheduler    = SIMP(statut = "f", typ = "TXM"),
998             Info         = SIMP(statut = "o", typ = "TXM", defaut = "APosterioriVariances"),
999             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
1000             PythonScript = BLOC (condition = " NodeType == 'String' ",
1001                 Value = SIMP(statut = "o", typ = "TXM")
1002                 ),
1003             UserFile = BLOC (condition = " NodeType == 'Script' ",
1004                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
1005                 ),
1006             ObserverTemplate = F_ObserverTemplate(),
1007             ),
1008         ),
1009     Residu = BLOC (condition=" 'Residu' in set(SELECTION) ",
1010         Residu_data = FACT(statut = "o",
1011             Scheduler    = SIMP(statut = "f", typ = "TXM"),
1012             Info         = SIMP(statut = "o", typ = "TXM", defaut = "Residu"),
1013             NodeType     = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "Template", into=("String", "Script", "Template")),
1014             PythonScript = BLOC (condition = " NodeType == 'String' ",
1015                 Value = SIMP(statut = "o", typ = "TXM")
1016                 ),
1017             UserFile = BLOC (condition = " NodeType == 'Script' ",
1018                 Value = SIMP(statut = "o", typ = "FichierNoAbs", validators=[OnlyStr(), FileExtVal('py')])
1019                 ),
1020             ObserverTemplate = F_ObserverTemplate(),
1021             ),
1022         ),
1023     )
1024
1025 def AlgorithmParametersInNS(filename):
1026     if os.path.exists(filename):
1027         fc = open(filename, 'r').readlines()
1028         cr = re.compile("^AlgorithmParameters[\s]*=")
1029         for ln in fc:
1030             if cr.match(ln): return 1
1031     return 0
1032 AlgorithmParametersInNS.info = u"The Python file has to contain explicitly an \"AlgorithmParameters\" variable."
1033 def F_AlgorithmParameters(statut, algos_names, fv=NoCheckInNS) : return FACT(
1034     statut = statut,
1035     Algorithm = SIMP(statut="o", typ = "TXM", into = algos_names ),
1036     Parameters = SIMP(statut="f", typ = "TXM", into=("Defaults", "Dict") ),
1037     Dict = BLOC ( condition = " Parameters == 'Dict' ",
1038         statut="f",
1039         data = F_Dict("o", fv),
1040         ),
1041     Parameters3DVAR = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == '3DVAR') ",
1042         statut="f",
1043         Bounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes"),
1044         CostDecrementTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-07, fr="Diminution relative minimale du cout lors de l'arrêt"),
1045         GradientNormTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-05, fr="Maximum des composantes du gradient lors de l'arrêt"),
1046         MaximumNumberOfSteps = SIMP(statut="f", typ="I", val_min=-1, min=1, max=1, defaut=15000, fr="Nombre maximal de pas d'optimisation"),
1047         Minimizer = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="LBFGSB", into=['LBFGSB', 'TNC', 'CG', 'NCG', 'BFGS'], fr="Minimiseur utilisé"),
1048         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"),
1049         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"),
1050         Quantiles = SIMP(statut="f", typ="TXM", max="**", into=None, fr="Liste des valeurs de quantiles"),
1051         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1052         SimulationForQuantiles = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="Linear", into=['Linear', 'NonLinear'], fr="Type de simulation pour l'estimation des quantiles"),
1053         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['APosterioriCorrelations', 'APosterioriCovariance', 'APosterioriStandardDeviations', 'APosterioriVariances', 'BMA', 'OMA', 'OMB', 'CostFunctionJ', 'CurrentState', 'CurrentOptimum', 'IndexOfOptimum', 'Innovation', 'InnovationAtCurrentState', 'CostFunctionJAtCurrentOptimum', 'SigmaObs2', 'MahalanobisConsistency', 'SimulationQuantiles', 'SimulatedObservationAtBackground', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum', 'SimulatedObservationAtCurrentOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1054         ),
1055     Parameters4DVAR = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == '4DVAR') ",
1056         statut="f",
1057         Bounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes"),
1058         ConstrainedBy = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="EstimateProjection", into=['EstimateProjection'], fr="Prise en compte des contraintes"),
1059         CostDecrementTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-07, fr="Diminution relative minimale du cout lors de l'arrêt"),
1060         EstimationOf = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="State", into=['State', 'Parameters'], fr="Estimation d'etat ou de parametres"),
1061         GradientNormTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-05, fr="Maximum des composantes du gradient lors de l'arrêt"),
1062         MaximumNumberOfSteps = SIMP(statut="f", typ="I", val_min=-1, min=1, max=1, defaut=15000, fr="Nombre maximal de pas d'optimisation"),
1063         Minimizer = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="LBFGSB", into=['LBFGSB', 'TNC', 'CG', 'NCG', 'BFGS'], fr="Minimiseur utilisé"),
1064         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"),
1065         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['BMA', 'CurrentState', 'CostFunctionJ', 'IndexOfOptimum', 'CurrentOptimum', 'CostFunctionJAtCurrentOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1066         ),
1067     ParametersBlue = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'Blue') ",
1068         statut="f",
1069         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"),
1070         Quantiles = SIMP(statut="f", typ="TXM", max="**", into=None, fr="Liste des valeurs de quantiles"),
1071         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1072         SimulationForQuantiles = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="Linear", into=['Linear', 'NonLinear'], fr="Type de simulation pour l'estimation des quantiles"),
1073         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"),
1074         ),
1075     ParametersDerivativeFreeOptimization = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'DerivativeFreeOptimization') ",
1076         statut="f",
1077         CostDecrementTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-07, fr="Diminution relative minimale du cout lors de l'arrêt"),
1078         MaximumNumberOfFunctionEvaluations = SIMP(statut="f", typ="I", val_min=-1, min=1, max=1, defaut=15000, fr="Nombre maximal de d'évaluations de la function"),
1079         MaximumNumberOfSteps = SIMP(statut="f", typ="I", val_min=-1, min=1, max=1, defaut=15000, fr="Nombre maximal de pas d'optimisation"),
1080         Minimizer = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="POWELL", into=['POWELL', 'SIMPLEX'], fr="Minimiseur utilisé"),
1081         QualityCriterion = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="AugmentedWeightedLeastSquares", into=['AugmentedWeightedLeastSquares', 'AWLS', 'DA', 'WeightedLeastSquares', 'WLS', 'LeastSquares', 'LS', 'L2', 'AbsoluteValue', 'L1', 'MaximumError', 'ME'], fr="Critère de qualité utilisé"),
1082         StateVariationTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=0.0001, fr="Variation relative maximale de l'état lors de l'arrêt"),
1083         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['CurrentState', 'CostFunctionJ', 'SimulatedObservationAtBackground', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1084         ),
1085     ParametersEnsembleBlue = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'EnsembleBlue') ",
1086         statut="f",
1087         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1088         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['CurrentState', 'Innovation', 'SimulatedObservationAtBackground', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1089         ),
1090     ParametersExtendedBlue = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'ExtendedBlue') ",
1091         statut="f",
1092         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"),
1093         Quantiles = SIMP(statut="f", typ="TXM", max="**", into=None, fr="Liste des valeurs de quantiles"),
1094         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1095         SimulationForQuantiles = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="Linear", into=['Linear', 'NonLinear'], fr="Type de simulation pour l'estimation des quantiles"),
1096         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"),
1097         ),
1098     ParametersExtendedKalmanFilter = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'ExtendedKalmanFilter') ",
1099         statut="f",
1100         Bounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes"),
1101         ConstrainedBy = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="EstimateProjection", into=['EstimateProjection'], fr="Prise en compte des contraintes"),
1102         EstimationOf = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="State", into=['State', 'Parameters'], fr="Estimation d'etat ou de parametres"),
1103         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"),
1104         ),
1105     ParametersKalmanFilter = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'KalmanFilter') ",
1106         statut="f",
1107         EstimationOf = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="State", into=['State', 'Parameters'], fr="Estimation d'etat ou de parametres"),
1108         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"),
1109         ),
1110     ParametersLinearLeastSquares = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'LinearLeastSquares') ",
1111         statut="f",
1112         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['OMA', 'CurrentState', 'CostFunctionJ', 'SimulatedObservationAtCurrentState', 'SimulatedObservationAtOptimum'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1113         ),
1114     ParametersNonLinearLeastSquares = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'NonLinearLeastSquares') ",
1115         statut="f",
1116         Bounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes"),
1117         CostDecrementTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-07, fr="Diminution relative minimale du cout lors de l'arrêt"),
1118         GradientNormTolerance = SIMP(statut="f", typ="R", min=1, max=1, defaut=1e-05, fr="Maximum des composantes du gradient lors de l'arrêt"),
1119         MaximumNumberOfSteps = SIMP(statut="f", typ="I", val_min=-1, min=1, max=1, defaut=15000, fr="Nombre maximal de pas d'optimisation"),
1120         Minimizer = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="LBFGSB", into=['LBFGSB', 'TNC', 'CG', 'NCG', 'BFGS', 'LM'], fr="Minimiseur utilisé"),
1121         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"),
1122         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"),
1123         ),
1124     ParametersParticleSwarmOptimization = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'ParticleSwarmOptimization') ",
1125         statut="f",
1126         BoxBounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes d'incréments de paramètres"),
1127         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)"),
1128         MaximumNumberOfSteps = SIMP(statut="f", typ="I", val_min=1, min=1, max=1, defaut=50, fr="Nombre maximal de pas d'optimisation"),
1129         NumberOfInsects = SIMP(statut="f", typ="I", val_min=-1, min=1, max=1, defaut=100, fr="Nombre d'insectes dans l'essaim"),
1130         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é"),
1131         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1132         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"),
1133         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"),
1134         ),
1135     ParametersQuantileRegression = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'QuantileRegression') ",
1136         statut="f",
1137         Bounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes"),
1138         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"),
1139         MaximumNumberOfSteps = SIMP(statut="f", typ="I", val_min=1, min=1, max=1, defaut=15000, fr="Nombre maximal de pas d'optimisation"),
1140         Minimizer = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="MMQR", into=['MMQR'], fr="Minimiseur utilisé"),
1141         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"),
1142         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"),
1143         ),
1144     ParametersUnscentedKalmanFilter = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'UnscentedKalmanFilter') ",
1145         statut="f",
1146         Alpha = SIMP(statut="f", typ="R", val_min=0.0001, val_max=1.0, min=1, max=1, defaut=1.0, fr=""),
1147         Beta = SIMP(statut="f", typ="R", min=1, max=1, defaut=2.0, fr=""),
1148         Bounds = SIMP(statut="f", typ="TXM", fr="Liste des valeurs de bornes"),
1149         ConstrainedBy = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="EstimateProjection", into=['EstimateProjection'], fr="Prise en compte des contraintes"),
1150         EstimationOf = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="State", into=['State', 'Parameters'], fr="Estimation d'etat ou de parametres"),
1151         Kappa = SIMP(statut="f", typ="I", val_max=2, min=1, max=1, defaut=0, fr=""),
1152         Reconditioner = SIMP(statut="f", typ="R", val_min=0.001, val_max=10.0, min=1, max=1, defaut=1.0, fr=""),
1153         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"),
1154         ),
1155     ParametersAdjointTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'AdjointTest') ",
1156         statut="f",
1157         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"),
1158         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"),
1159         InitialDirection = SIMP(statut="f", typ="TXM", fr="Direction initiale de la dérivée directionnelle autour du point nominal"),
1160         ResiduFormula = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="ScalarProduct", into=['ScalarProduct'], fr="Formule de résidu utilisée"),
1161         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1162         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['CurrentState', 'Residu', 'SimulatedObservationAtCurrentState'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1163         ),
1164     ParametersFunctionTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'FunctionTest') ",
1165         statut="f",
1166         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"),
1167         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"),
1168         SetDebug = SIMP(statut="f", typ="I", min=1, max=1, defaut=0, fr="Activation du mode debug lors de l'exécution"),
1169         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['CurrentState', 'SimulatedObservationAtCurrentState'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1170         ),
1171     ParametersGradientTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'GradientTest') ",
1172         statut="f",
1173         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"),
1174         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"),
1175         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"),
1176         InitialDirection = SIMP(statut="f", typ="TXM", fr="Direction initiale de la dérivée directionnelle autour du point nominal"),
1177         ResiduFormula = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="Taylor", into=['Norm', 'TaylorOnNorm', 'Taylor'], fr="Formule de résidu utilisée"),
1178         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1179         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['CurrentState', 'Residu', 'SimulatedObservationAtCurrentState'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1180         ),
1181     ParametersLinearityTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'LinearityTest') ",
1182         statut="f",
1183         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"),
1184         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"),
1185         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"),
1186         InitialDirection = SIMP(statut="f", typ="TXM", fr="Direction initiale de la dérivée directionnelle autour du point nominal"),
1187         ResiduFormula = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="CenteredDL", into=['CenteredDL', 'Taylor', 'NominalTaylor', 'NominalTaylorRMS'], fr="Formule de résidu utilisée"),
1188         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1189         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['CurrentState', 'Residu', 'SimulatedObservationAtCurrentState'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1190         ),
1191     ParametersSamplingTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'SamplingTest') ",
1192         statut="f",
1193         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é"),
1194         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"),
1195         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]"),
1196         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]"),
1197         SampleAsnUplet = SIMP(statut="f", typ="TXM", max="**", into=None, fr="Points de calcul définis par une liste de n-uplet"),
1198         SetDebug = SIMP(statut="f", typ="I", min=1, max=1, defaut=0, fr="Activation du mode debug lors de l'exécution"),
1199         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1200         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['CostFunctionJ', 'CurrentState', 'InnovationAtCurrentState', 'SimulatedObservationAtCurrentState'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1201         ),
1202     ParametersTangentTest = BLOC (condition = " (Parameters == 'Defaults') and (Algorithm == 'TangentTest') ",
1203         statut="f",
1204         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"),
1205         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"),
1206         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"),
1207         InitialDirection = SIMP(statut="f", typ="TXM", fr="Direction initiale de la dérivée directionnelle autour du point nominal"),
1208         ResiduFormula = SIMP(statut="f", typ="TXM", min=1, max=1, defaut="Taylor", into=['Taylor'], fr="Formule de résidu utilisée"),
1209         SetSeed = SIMP(statut="f", typ="TXM", fr="Graine fixée pour le générateur aléatoire"),
1210         StoreSupplementaryCalculations = SIMP(statut="f", typ="TXM", max="**", into=['CurrentState', 'Residu', 'SimulatedObservationAtCurrentState'], fr="Liste de calculs supplémentaires à stocker et/ou effectuer"),
1211         ),
1212     )
1213
1214 def F_variables(statut) : return FACT(
1215     statut=statut,
1216     regles = ( MEME_NOMBRE ('NAMES', 'SIZES')),
1217     NAMES = SIMP(statut="o", typ="TXM", max="**", validators=NoRepeat()),
1218     SIZES = SIMP(statut="o", typ="I", val_min=1, max="**")
1219     )
1220 def ChDir(dirname):
1221     os.chdir(os.path.abspath(dirname))
1222     return 1
1223 ChDir.info = u"This has to be a regular directory path."
1224
1225 ASSIMILATION_STUDY = PROC(nom="ASSIMILATION_STUDY",
1226     op=None,
1227     repetable           = "n",
1228     StudyName           = SIMP(statut="o", typ = "TXM", defaut="ADAO Calculation Case"),
1229     StudyRepertory      = SIMP(statut="f", typ = "Repertoire", validators=FunctionVal(ChDir), min=1, max=1),
1230     Debug               = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0),
1231     AlgorithmParameters = F_AlgorithmParameters("o",("3DVAR", "4DVAR", "Blue", "DerivativeFreeOptimization", "EnsembleBlue", "ExtendedBlue", "ExtendedKalmanFilter", "KalmanFilter", "LinearLeastSquares", "NonLinearLeastSquares", "ParticleSwarmOptimization", "QuantileRegression", "UnscentedKalmanFilter", ), AlgorithmParametersInNS),
1232     Background          = F_Background("o", BackgroundInNS),
1233     BackgroundError     = F_BackgroundError("o", BackgroundErrorInNS),
1234     Observation         = F_Observation("o", ObservationInNS),
1235     ObservationError    = F_ObservationError("o", ObservationErrorInNS),
1236     ObservationOperator = F_ObservationOperator("o"),
1237     EvolutionModel      = F_EvolutionModel("f"),
1238     EvolutionError      = F_EvolutionError("f", EvolutionErrorInNS),
1239     ControlInput        = F_ControlInput("f"),
1240     UserDataInit        = F_Init("f"),
1241     UserPostAnalysis    = F_UserPostAnalysis("o"),
1242     InputVariables      = F_variables("f"),
1243     OutputVariables     = F_variables("f"),
1244     Observers           = F_Observers("f")
1245     )
1246
1247 CHECKING_STUDY = PROC(nom="CHECKING_STUDY",
1248     op=None,
1249     repetable           = "n",
1250     StudyName           = SIMP(statut="o", typ = "TXM", defaut="ADAO Checking Case"),
1251     StudyRepertory      = SIMP(statut="f", typ = "Repertoire", validators=FunctionVal(ChDir), min=1, max=1),
1252     Debug               = SIMP(statut="f", typ = "I", into=(0, 1), defaut=0),
1253     AlgorithmParameters = F_AlgorithmParameters("o", ("AdjointTest", "FunctionTest", "GradientTest", "LinearityTest", "ObserverTest", "SamplingTest", "TangentTest", ), AlgorithmParametersInNS),
1254     CheckingPoint       = F_CheckingPoint("o", CheckingPointInNS),
1255     BackgroundError     = F_BackgroundError("f", BackgroundErrorInNS),
1256     Observation         = F_Observation("f", ObservationInNS),
1257     ObservationError    = F_ObservationError("f", ObservationErrorInNS),
1258     ObservationOperator = F_ObservationOperator("o"),
1259     UserDataInit        = F_Init("f"),
1260     Observers           = F_Observers("f")
1261     )