Salome HOME
Adding examples for *FunctionTest (FR)
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Sat, 18 Jun 2022 06:31:16 +0000 (08:31 +0200)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Sat, 18 Jun 2022 06:31:34 +0000 (08:31 +0200)
doc/fr/ref_algorithm_FunctionTest.rst
doc/fr/ref_algorithm_ParallelFunctionTest.rst
doc/fr/scripts/simple_FunctionTest.py [new file with mode: 0644]
doc/fr/scripts/simple_FunctionTest.res [new file with mode: 0644]
doc/fr/scripts/simple_FunctionTest.rst [new file with mode: 0644]
doc/fr/scripts/simple_ParallelFunctionTest.py [new file with mode: 0644]
doc/fr/scripts/simple_ParallelFunctionTest.res [new file with mode: 0644]
doc/fr/scripts/simple_ParallelFunctionTest.rst [new file with mode: 0644]

index e458809d8549a3de88102d3e0285acb856a546b3..fe7436d4fb1437a0769660c84beadc714f5f5e23 100644 (file)
@@ -30,11 +30,11 @@ Algorithme de vérification "*FunctionTest*"
 .. ------------------------------------ ..
 .. include:: snippets/Header2Algo01.rst
 
-Cet algorithme permet de vérifier que l'opérateur d'observation fonctionne
-correctement et que son appel se déroule de manière compatible avec son usage
-dans les algorithmes d'ADAO. De manière pratique, il permet d'appeler une ou
-plusieurs fois l'opérateur, en activant ou non le mode "debug" lors de
-l'exécution.
+Cet algorithme permet de vérifier qu'un opérateur, dont en particulier celui
+d'observation, fonctionne correctement et que son appel se déroule de manière
+compatible avec son usage dans les algorithmes d'ADAO. De manière pratique, il
+permet d'appeler une ou plusieurs fois l'opérateur, en activant ou non le mode
+"debug" lors de l'exécution.
 
 Une statistique sur les vecteurs en entrée et en sortie de chaque exécution de
 l'opérateur est indiquée, et une autre globale est fournie de manière
@@ -91,6 +91,17 @@ StoreSupplementaryCalculations
 
 .. include:: snippets/SimulatedObservationAtCurrentState.rst
 
+.. ------------------------------------ ..
+.. include:: snippets/Header2Algo09.rst
+
+.. include:: scripts/simple_FunctionTest.rst
+
+.. literalinclude:: scripts/simple_FunctionTest.py
+
+.. include:: snippets/Header2Algo10.rst
+
+.. literalinclude:: scripts/simple_FunctionTest.res
+
 .. ------------------------------------ ..
 .. include:: snippets/Header2Algo06.rst
 
index 0d176c573fdc919adb82df343d26b809b419314c..b2932df80a0b1f175de58e494627e535c6260c9d 100644 (file)
@@ -30,7 +30,8 @@ Algorithme de vérification "*ParallelFunctionTest*"
 .. ------------------------------------ ..
 .. include:: snippets/Header2Algo01.rst
 
-Cet algorithme permet de vérifier que l'opérateur d'observation fonctionne
+Cet algorithme permet de vérifier qu'un opérateur, dont en particulier celui
+d'observation, fonctionne
 correctement en parallèle et que son appel se déroule de manière compatible
 avec son usage dans les algorithmes d'ADAO. De manière pratique, il permet
 d'appeler une ou plusieurs fois l'opérateur en parallèle, en activant ou non le
@@ -91,6 +92,17 @@ StoreSupplementaryCalculations
 
 .. include:: snippets/SimulatedObservationAtCurrentState.rst
 
+.. ------------------------------------ ..
+.. include:: snippets/Header2Algo09.rst
+
+.. include:: scripts/simple_ParallelFunctionTest.rst
+
+.. literalinclude:: scripts/simple_ParallelFunctionTest.py
+
+.. include:: snippets/Header2Algo10.rst
+
+.. literalinclude:: scripts/simple_ParallelFunctionTest.res
+
 .. ------------------------------------ ..
 .. include:: snippets/Header2Algo06.rst
 
diff --git a/doc/fr/scripts/simple_FunctionTest.py b/doc/fr/scripts/simple_FunctionTest.py
new file mode 100644 (file)
index 0000000..638d6dd
--- /dev/null
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+#
+from numpy import array, eye
+from adao import adaoBuilder
+case = adaoBuilder.New('')
+case.setCheckingPoint( Vector = array([0., 1., 2.]), Stored=True )
+case.setObservationOperator( Matrix = eye(3), )
+case.setAlgorithmParameters(
+    Algorithm='FunctionTest',
+    Parameters={
+        'NumberOfRepetition' : 5,
+        'NumberOfPrintedDigits' : 2,
+        "ShowElementarySummary":False,
+        },
+    )
+case.execute()
diff --git a/doc/fr/scripts/simple_FunctionTest.res b/doc/fr/scripts/simple_FunctionTest.res
new file mode 100644 (file)
index 0000000..8f57585
--- /dev/null
@@ -0,0 +1,52 @@
+===> Information before launching:
+     -----------------------------
+     Characteristics of input vector X, internally converted:
+       Type...............: <class 'numpy.ndarray'>
+       Lenght of vector...: 3
+       Minimum value......: 0.00e+00
+       Maximum value......: 2.00e+00
+       Mean of vector.....: 1.00e+00
+       Standard error.....: 8.16e-01
+       L2 norm of vector..: 2.24e+00
+
+     ---------------------------------------------------------------------------
+
+===> Beginning of repeated evaluation, without activating debug
+
+     ---------------------------------------------------------------------------
+
+===> End of repeated evaluation, without deactivating debug
+
+     ---------------------------------------------------------------------------
+
+===> Launching statistical summary calculation for 5 states
+
+     ---------------------------------------------------------------------------
+
+===> Statistical analysis of the outputs obtained through sequential repeated evaluations
+
+     (Remark: numbers that are (about) under 2e-16 represent 0 to machine precision)
+
+     Characteristics of the whole set of outputs Y:
+       Number of evaluations.........................: 5
+       Minimum value of the whole set of outputs.....: 0.00e+00
+       Maximum value of the whole set of outputs.....: 2.00e+00
+       Mean of vector of the whole set of outputs....: 1.00e+00
+       Standard error of the whole set of outputs....: 8.16e-01
+
+     Characteristics of the vector Ym, mean of the outputs Y:
+       Size of the mean of the outputs...............: 3
+       Minimum value of the mean of the outputs......: 0.00e+00
+       Maximum value of the mean of the outputs......: 2.00e+00
+       Mean of the mean of the outputs...............: 1.00e+00
+       Standard error of the mean of the outputs.....: 8.16e-01
+
+     Characteristics of the mean of the differences between the outputs Y and their mean Ym:
+       Size of the mean of the differences...........: 3
+       Minimum value of the mean of the differences..: 0.00e+00
+       Maximum value of the mean of the differences..: 0.00e+00
+       Mean of the mean of the differences...........: 0.00e+00
+       Standard error of the mean of the differences.: 0.00e+00
+
+     ---------------------------------------------------------------------------
+
diff --git a/doc/fr/scripts/simple_FunctionTest.rst b/doc/fr/scripts/simple_FunctionTest.rst
new file mode 100644 (file)
index 0000000..74a376b
--- /dev/null
@@ -0,0 +1,16 @@
+.. index:: single: FunctionTest (exemple)
+
+Cet exemple décrit le test du bon fonctionnement d'un opérateur et que son
+appel se déroule de manière compatible avec son usage dans les algorithmes
+d'ADAO. Les information nécessaires sont minimales, à savoir ici un opérateur
+de type observation :math:`H` et un état :math:`\mathbf{x}^b` sur lequel le
+tester (nommé "*CheckingPoint*" pour le test).
+
+Le test est répété un nombre paramétrable de fois, et une statistique finale
+permet de vérifier rapidement le bon comportement de l'opérateur. Le diagnostic
+le plus simple consiste à vérifier, à la fin, l'ordre de grandeur des valeurs
+indiquées comme la moyenne des différences entre les sorties répétées et leur
+moyenne ("*mean of the differences between the outputs Y and their mean Ym*").
+Pour un opérateur normal, ces valeurs doivent être proches du zéro numérique.
+
+
diff --git a/doc/fr/scripts/simple_ParallelFunctionTest.py b/doc/fr/scripts/simple_ParallelFunctionTest.py
new file mode 100644 (file)
index 0000000..dde6bc1
--- /dev/null
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+#
+import numpy
+from adao import adaoBuilder
+#
+def SomeOperator( x ):
+    return numpy.dot(numpy.eye(x.size), numpy.ravel(x))
+#
+case = adaoBuilder.New('')
+case.setAlgorithmParameters(
+    Algorithm='ParallelFunctionTest',
+    Parameters={
+        'NumberOfRepetition' : 50,
+        'NumberOfPrintedDigits' : 2,
+        "ShowElementarySummary":False,
+        },
+    )
+case.setCheckingPoint( Vector = range(30) )
+case.setObservationOperator(
+    OneFunction = SomeOperator,
+    Parameters  = {
+        "EnableMultiProcessingInEvaluation":True,
+        "NumberOfProcesses":5,
+        },
+    )
+case.execute()
diff --git a/doc/fr/scripts/simple_ParallelFunctionTest.res b/doc/fr/scripts/simple_ParallelFunctionTest.res
new file mode 100644 (file)
index 0000000..829da09
--- /dev/null
@@ -0,0 +1,59 @@
+===> Information before launching:
+     -----------------------------
+     Characteristics of input vector X, internally converted:
+       Type...............: <class 'numpy.ndarray'>
+       Lenght of vector...: 30
+       Minimum value......: 0.00e+00
+       Maximum value......: 2.90e+01
+       Mean of vector.....: 1.45e+01
+       Standard error.....: 8.66e+00
+       L2 norm of vector..: 9.25e+01
+
+     ---------------------------------------------------------------------------
+
+===> Beginning of repeated evaluation, without activating debug
+
+     ---------------------------------------------------------------------------
+
+===> Launching operator parallel evaluation for 50 states
+
+
+===> End of operator parallel evaluation for 50 states
+
+     ---------------------------------------------------------------------------
+
+===> End of repeated evaluation, without deactivating debug
+
+     ---------------------------------------------------------------------------
+
+===> Launching statistical summary calculation for 50 states
+
+     ---------------------------------------------------------------------------
+
+===> Statistical analysis of the outputs obtained through parallel repeated evaluations
+
+     (Remark: numbers that are (about) under 2e-16 represent 0 to machine precision)
+
+     Characteristics of the whole set of outputs Y:
+       Number of evaluations.........................: 50
+       Minimum value of the whole set of outputs.....: 0.00e+00
+       Maximum value of the whole set of outputs.....: 2.90e+01
+       Mean of vector of the whole set of outputs....: 1.45e+01
+       Standard error of the whole set of outputs....: 8.66e+00
+
+     Characteristics of the vector Ym, mean of the outputs Y:
+       Size of the mean of the outputs...............: 30
+       Minimum value of the mean of the outputs......: 0.00e+00
+       Maximum value of the mean of the outputs......: 2.90e+01
+       Mean of the mean of the outputs...............: 1.45e+01
+       Standard error of the mean of the outputs.....: 8.66e+00
+
+     Characteristics of the mean of the differences between the outputs Y and their mean Ym:
+       Size of the mean of the differences...........: 30
+       Minimum value of the mean of the differences..: 0.00e+00
+       Maximum value of the mean of the differences..: 0.00e+00
+       Mean of the mean of the differences...........: 0.00e+00
+       Standard error of the mean of the differences.: 0.00e+00
+
+     ---------------------------------------------------------------------------
+
diff --git a/doc/fr/scripts/simple_ParallelFunctionTest.rst b/doc/fr/scripts/simple_ParallelFunctionTest.rst
new file mode 100644 (file)
index 0000000..74a376b
--- /dev/null
@@ -0,0 +1,16 @@
+.. index:: single: FunctionTest (exemple)
+
+Cet exemple décrit le test du bon fonctionnement d'un opérateur et que son
+appel se déroule de manière compatible avec son usage dans les algorithmes
+d'ADAO. Les information nécessaires sont minimales, à savoir ici un opérateur
+de type observation :math:`H` et un état :math:`\mathbf{x}^b` sur lequel le
+tester (nommé "*CheckingPoint*" pour le test).
+
+Le test est répété un nombre paramétrable de fois, et une statistique finale
+permet de vérifier rapidement le bon comportement de l'opérateur. Le diagnostic
+le plus simple consiste à vérifier, à la fin, l'ordre de grandeur des valeurs
+indiquées comme la moyenne des différences entre les sorties répétées et leur
+moyenne ("*mean of the differences between the outputs Y and their mean Ym*").
+Pour un opérateur normal, ces valeurs doivent être proches du zéro numérique.
+
+