From: Jean-Philippe ARGAUD Date: Thu, 18 Nov 2021 09:36:15 +0000 (+0100) Subject: Minor documentation and code review corrections (6) X-Git-Tag: V9_8_0rc1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bd2a02ea5e6757a488421568e5220a480af724a0;p=modules%2Fadao.git Minor documentation and code review corrections (6) --- diff --git a/bin/AdaoCatalogGenerator.py b/bin/AdaoCatalogGenerator.py index a1641f1..f8ee7ce 100644 --- a/bin/AdaoCatalogGenerator.py +++ b/bin/AdaoCatalogGenerator.py @@ -166,15 +166,24 @@ def F_{data_name}(statut, fv=NoCheckInNS) : return FACT( 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"), ), TEMPLATE_DATA = BLOC (condition = " FROM in ( 'Template', ) ", - Template = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "AnalysisPrinter", into=("AnalysisPrinter", "AnalysisSaver", "AnalysisPrinterAndSaver")), + Template = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "AnalysisPrinter", into=("AnalysisPrinter", "AnalysisSaver", "AnalysisPrinterAndSaver", "AnalysisSeriePrinter", "AnalysisSerieSaver", "AnalysisSeriePrinterAndSaver")), AnalysisPrinter = BLOC (condition = " Template == 'AnalysisPrinter' ", - ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "import numpy\\nxa=numpy.ravel(ADD.get('Analysis')[-1])\\nprint('Analysis:',xa)" ), + ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')[-1]\\nprint('Analysis:',xa)" ), ), AnalysisSaver = BLOC (condition = " Template == 'AnalysisSaver' ", - 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)" ), + ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')[-1]\\nf='/tmp/analysis.txt'\\nprint('Analysis saved in \\"%s\\"'%f)\\nnumpy.savetxt(f,xa)" ), ), AnalysisPrinterAndSaver = BLOC (condition = " Template == 'AnalysisPrinterAndSaver' ", - 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)" ), + ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')[-1]\\nprint 'Analysis:',xa\\nf='/tmp/analysis.txt'\\nprint('Analysis saved in \\"%s\\"'%f)\\nnumpy.savetxt(f,xa)" ), + ), + AnalysisSeriePrinter = BLOC (condition = " Template == 'AnalysisSeriePrinter' ", + ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')\\nprint('Analysis:',xa)" ), + ), + AnalysisSerieSaver = BLOC (condition = " Template == 'AnalysisSerieSaver' ", + ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')\\nf='/tmp/analysis.txt'\\nprint('Analysis saved in \\"%s\\"'%f)\\nnumpy.savetxt(f,xa)" ), + ), + AnalysisSeriePrinterAndSaver = BLOC (condition = " Template == 'AnalysisSeriePrinterAndSaver' ", + ValueTemplate = SIMP(statut = "o", typ = "TXM", min=1, max=1, defaut = "print('# Post-analysis')\\nimport numpy\\nxa=ADD.get('Analysis')\\nprint 'Analysis:',xa\\nf='/tmp/analysis.txt'\\nprint('Analysis saved in \\"%s\\"'%f)\\nnumpy.savetxt(f,xa)" ), ), ), ) diff --git a/doc/en/images/eficas_userpostanalysis_nodetype.png b/doc/en/images/eficas_userpostanalysis_nodetype.png index ec34297..f7aef60 100644 Binary files a/doc/en/images/eficas_userpostanalysis_nodetype.png and b/doc/en/images/eficas_userpostanalysis_nodetype.png differ diff --git a/doc/en/ref_algorithm_EnsembleBlue.rst b/doc/en/ref_algorithm_EnsembleBlue.rst index f2e373e..175d34b 100644 --- a/doc/en/ref_algorithm_EnsembleBlue.rst +++ b/doc/en/ref_algorithm_EnsembleBlue.rst @@ -72,6 +72,7 @@ StoreSupplementaryCalculations sub-section "*Information and variables available at the end of the algorithm*"): [ "Analysis", + "CurrentOptimum", "CurrentState", "Innovation", "SimulatedObservationAtBackground", @@ -96,6 +97,8 @@ StoreSupplementaryCalculations .. include:: snippets/Analysis.rst +.. include:: snippets/CurrentOptimum.rst + .. include:: snippets/CurrentState.rst .. include:: snippets/Innovation.rst diff --git a/doc/en/ref_userpostanalysis_requirements.rst b/doc/en/ref_userpostanalysis_requirements.rst index 30f473c..bc515cd 100644 --- a/doc/en/ref_userpostanalysis_requirements.rst +++ b/doc/en/ref_userpostanalysis_requirements.rst @@ -89,21 +89,20 @@ General form of a script to define a dedicated post-processing A set of post-processing commands is a special Python script, which is automatically activated at the end of the estimation calculations in ADAO. Any -Python commands, which a user can add after a TUI calculation in ADAO, can be +Python commands, which a user can add after a GUI calculation in ADAO, can be part of this post-processing. Several command set templates are available by default,essentially to give the simplest possible example of recording these series. To be usable in an automatic way, it is required that any call of the ADAO calculation case, to recover a variable, is done only with the reserved name -"*ADD*". As an example, here is a very simple script (similar to the +"*ADD*". As an example, here is a very simple script (very similar to the "*ValuePrinter*" template), usable to display the value of the optimal estimate:: - print('# Post-analysis') import numpy xa = numpy.ravel(ADD.get('Analysis')[-1]) - print('Analysis',xa) + print(' === Analysis =',xa) If the command "*ADD.get(...)*", used to obtain a result variable, does not use the reserved name "*ADD*" for the calculation case, then the call will lead to @@ -140,7 +139,7 @@ Print on standard output the optimal value. print('# Post-analysis') import numpy - xa=numpy.ravel(ADD.get('Analysis')[-1]) + xa=ADD.get('Analysis')[-1] print('Analysis',xa) .. index:: single: AnalysisSaver (Observer) @@ -154,7 +153,7 @@ Save the optimal value in a file of the '/tmp' directory named 'analysis.txt'. print('# Post-analysis') import numpy - xa=numpy.ravel(ADD.get('Analysis')[-1]) + xa=ADD.get('Analysis')[-1] f='/tmp/analysis.txt' print('Analysis saved in "%s"'%f) numpy.savetxt(f,xa) @@ -170,7 +169,54 @@ Print on standard output and, in the same time save in a file of the '/tmp' dire print('# Post-analysis') import numpy - xa=numpy.ravel(ADD.get('Analysis')[-1]) + xa=ADD.get('Analysis')[-1] + print 'Analysis',xa + f='/tmp/analysis.txt' + print('Analysis saved in "%s"'%f) + numpy.savetxt(f,xa) + +.. index:: single: AnalysisSeriePrinter (Observer) + +Modèle **AnalysisSeriePrinter** +............................... + +Print on standard output the optimal value series. + +:: + + print('# Post-analysis') + import numpy + xa=ADD.get('Analysis') + print('Analysis',xa) + +.. index:: single: AnalysisSerieSaver (Observer) + +Modèle **AnalysisSerieSaver** +............................. + +Save the optimal value series in a file of the '/tmp' directory named 'analysis.txt'. + +:: + + print('# Post-analysis') + import numpy + xa=ADD.get('Analysis') + f='/tmp/analysis.txt' + print('Analysis saved in "%s"'%f) + numpy.savetxt(f,xa) + +.. index:: single: AnalysisSeriePrinterAndSaver (Observer) + +Modèle **AnalysisSeriePrinterAndSaver** +....................................... + +Print on standard output and, in the same time save in a file of the '/tmp' directory, the optimal value series. + +:: + + print('# Post-analysis') + import numpy + xa=ADD.get('Analysis') print 'Analysis',xa f='/tmp/analysis.txt' print('Analysis saved in "%s"'%f) diff --git a/doc/fr/images/eficas_userpostanalysis_nodetype.png b/doc/fr/images/eficas_userpostanalysis_nodetype.png index ec34297..f845a31 100644 Binary files a/doc/fr/images/eficas_userpostanalysis_nodetype.png and b/doc/fr/images/eficas_userpostanalysis_nodetype.png differ diff --git a/doc/fr/ref_algorithm_EnsembleBlue.rst b/doc/fr/ref_algorithm_EnsembleBlue.rst index 71e1f64..60c3412 100644 --- a/doc/fr/ref_algorithm_EnsembleBlue.rst +++ b/doc/fr/ref_algorithm_EnsembleBlue.rst @@ -72,6 +72,7 @@ StoreSupplementaryCalculations de cette documentation par algorithme spécifique, dans la sous-partie "*Informations et variables disponibles à la fin de l'algorithme*") : [ "Analysis", + "CurrentOptimum", "CurrentState", "Innovation", "SimulatedObservationAtBackground", @@ -96,6 +97,8 @@ StoreSupplementaryCalculations .. include:: snippets/Analysis.rst +.. include:: snippets/CurrentOptimum.rst + .. include:: snippets/CurrentState.rst .. include:: snippets/Innovation.rst diff --git a/doc/fr/ref_userpostanalysis_requirements.rst b/doc/fr/ref_userpostanalysis_requirements.rst index 932b897..ee0659f 100644 --- a/doc/fr/ref_userpostanalysis_requirements.rst +++ b/doc/fr/ref_userpostanalysis_requirements.rst @@ -91,21 +91,20 @@ Forme générale d'un script permettant de définir un post-traitement dédié Une série de commandes de post-traitement est un script Python spécial, qui est automatiquement activée à la fin des calculs d'estimation dans ADAO. Toutes les commandes Python, qu'un utilisateur peut ajouter après un calcul ADAO en -interface graphique TUI, peuvent faire partie de ce post-traitement. Plusieurs +interface graphique GUI, peuvent faire partie de ce post-traitement. Plusieurs modèles de série de commandes sont disponibles par défaut, essentiellement pour donner un exemple le plus simple possible d'enregistrement de ces séries. Pour être utilisable de manière automatique, il est requis tout appel du cas de calcul ADAO, pour récupérer une variable, se fasse uniquement avec le nom -réservé "*ADD*". A titre d'exemple, voici un script très simple (similaire au -modèle "*ValuePrinter*"), utilisable pour afficher la valeur de l'estimation +réservé "*ADD*". A titre d'exemple, voici un script très simple (très similaire +au modèle "*ValuePrinter*"), utilisable pour afficher la valeur de l'estimation optimale : :: - print('# Post-analysis') import numpy xa = numpy.ravel(ADD.get('Analysis')[-1]) - print('Analysis',xa) + print(' === Analysis =',xa) Si la commande "*ADD.get(...)*", utilisée pour l'obtention d'une variable résultat, n'utilise pas le nom réservé "*ADD*" pour le cas de calcul, alors @@ -144,7 +143,7 @@ Imprime sur la sortie standard la valeur optimale. print('# Post-analysis') import numpy - xa=numpy.ravel(ADD.get('Analysis')[-1]) + xa=ADD.get('Analysis')[-1] print('Analysis',xa) .. index:: single: AnalysisSaver (Observer) @@ -158,7 +157,7 @@ Enregistre la valeur optimale dans un fichier du répertoire '/tmp' nommé 'anal print('# Post-analysis') import numpy - xa=numpy.ravel(ADD.get('Analysis')[-1]) + xa=ADD.get('Analysis')[-1] f='/tmp/analysis.txt' print('Analysis saved in "%s"'%f) numpy.savetxt(f,xa) @@ -174,7 +173,54 @@ Imprime sur la sortie standard et, en même temps enregistre dans un fichier du print('# Post-analysis') import numpy - xa=numpy.ravel(ADD.get('Analysis')[-1]) + xa=ADD.get('Analysis')[-1] + print 'Analysis',xa + f='/tmp/analysis.txt' + print('Analysis saved in "%s"'%f) + numpy.savetxt(f,xa) + +.. index:: single: AnalysisSeriePrinter (Observer) + +Modèle **AnalysisSeriePrinter** +............................... + +Imprime sur la sortie standard la série des valeurs optimales. + +:: + + print('# Post-analysis') + import numpy + xa=ADD.get('Analysis') + print('Analysis',xa) + +.. index:: single: AnalysisSerieSaver (Observer) + +Modèle **AnalysisSerieSaver** +............................. + +Enregistre la série des valeurs optimales dans un fichier du répertoire '/tmp' nommé 'analysis.txt'. + +:: + + print('# Post-analysis') + import numpy + xa=ADD.get('Analysis') + f='/tmp/analysis.txt' + print('Analysis saved in "%s"'%f) + numpy.savetxt(f,xa) + +.. index:: single: AnalysisSeriePrinterAndSaver (Observer) + +Modèle **AnalysisSeriePrinterAndSaver** +....................................... + +Imprime sur la sortie standard et, en même temps enregistre dans un fichier du répertoire '/tmp', la série des valeurs optimales. + +:: + + print('# Post-analysis') + import numpy + xa=ADD.get('Analysis') print 'Analysis',xa f='/tmp/analysis.txt' print('Analysis saved in "%s"'%f) diff --git a/src/daComposant/daCore/Persistence.py b/src/daComposant/daCore/Persistence.py index 08a3a63..e77dd45 100644 --- a/src/daComposant/daCore/Persistence.py +++ b/src/daComposant/daCore/Persistence.py @@ -711,7 +711,7 @@ class OneVector(Persistence): class OneMatrix(Persistence): """ - Classe de stockage d'une matrice de valeurs (numpy.matrix) par pas. + Classe de stockage d'une matrice de valeurs homogènes par pas. """ def __init__(self, name="", unit="", basetype = numpy.matrix): Persistence.__init__(self, name, unit, basetype)