From 9ba8bf34bba48c735acb3f393a47b246b44715df Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Sat, 18 Jun 2022 08:31:16 +0200 Subject: [PATCH] Adding examples for *FunctionTest (FR) --- doc/fr/ref_algorithm_FunctionTest.rst | 21 +++++-- doc/fr/ref_algorithm_ParallelFunctionTest.rst | 14 ++++- doc/fr/scripts/simple_FunctionTest.py | 16 +++++ doc/fr/scripts/simple_FunctionTest.res | 52 ++++++++++++++++ doc/fr/scripts/simple_FunctionTest.rst | 16 +++++ doc/fr/scripts/simple_ParallelFunctionTest.py | 26 ++++++++ .../scripts/simple_ParallelFunctionTest.res | 59 +++++++++++++++++++ .../scripts/simple_ParallelFunctionTest.rst | 16 +++++ 8 files changed, 214 insertions(+), 6 deletions(-) create mode 100644 doc/fr/scripts/simple_FunctionTest.py create mode 100644 doc/fr/scripts/simple_FunctionTest.res create mode 100644 doc/fr/scripts/simple_FunctionTest.rst create mode 100644 doc/fr/scripts/simple_ParallelFunctionTest.py create mode 100644 doc/fr/scripts/simple_ParallelFunctionTest.res create mode 100644 doc/fr/scripts/simple_ParallelFunctionTest.rst diff --git a/doc/fr/ref_algorithm_FunctionTest.rst b/doc/fr/ref_algorithm_FunctionTest.rst index e458809..fe7436d 100644 --- a/doc/fr/ref_algorithm_FunctionTest.rst +++ b/doc/fr/ref_algorithm_FunctionTest.rst @@ -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 diff --git a/doc/fr/ref_algorithm_ParallelFunctionTest.rst b/doc/fr/ref_algorithm_ParallelFunctionTest.rst index 0d176c5..b2932df 100644 --- a/doc/fr/ref_algorithm_ParallelFunctionTest.rst +++ b/doc/fr/ref_algorithm_ParallelFunctionTest.rst @@ -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 index 0000000..638d6dd --- /dev/null +++ b/doc/fr/scripts/simple_FunctionTest.py @@ -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 index 0000000..8f57585 --- /dev/null +++ b/doc/fr/scripts/simple_FunctionTest.res @@ -0,0 +1,52 @@ +===> Information before launching: + ----------------------------- + Characteristics of input vector X, internally converted: + Type...............: + 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 index 0000000..74a376b --- /dev/null +++ b/doc/fr/scripts/simple_FunctionTest.rst @@ -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 index 0000000..dde6bc1 --- /dev/null +++ b/doc/fr/scripts/simple_ParallelFunctionTest.py @@ -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 index 0000000..829da09 --- /dev/null +++ b/doc/fr/scripts/simple_ParallelFunctionTest.res @@ -0,0 +1,59 @@ +===> Information before launching: + ----------------------------- + Characteristics of input vector X, internally converted: + Type...............: + 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 index 0000000..74a376b --- /dev/null +++ b/doc/fr/scripts/simple_ParallelFunctionTest.rst @@ -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. + + -- 2.39.2