--- /dev/null
+# -*- coding: utf-8 -*-
+#
+from numpy import array
+from adao import adaoBuilder
+case = adaoBuilder.New()
+case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
+case.set( 'Background', Vector=[0, 1, 2] )
+case.set( 'BackgroundError', ScalarSparseMatrix=1.0 )
+case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) )
+case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' )
+case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' )
+case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" )
+case.execute()
--- /dev/null
+Analysis [0.25000264 0.79999797 0.94999939]
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+from numpy import array
+from adao import adaoBuilder
+case = adaoBuilder.New()
+case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
+case.set( 'Background', Vector=[0, 1, 2] )
+#
+print(case)
--- /dev/null
+================================================================================
+ADAO Study report
+================================================================================
+
+ - AlgorithmParameters command has been set with values:
+ Algorithm = '3DVAR'
+
+ - Background command has been set with values:
+ Vector = [0, 1, 2]
+
+
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+import numpy
+from adao import adaoBuilder
+#
+# =============================================================
+# PROBLEM SETTINGS
+#
+# Artificial building of an example of user data
+# ----------------------------------------------
+alpha = 5.
+beta = 7
+gamma = 9.0
+#
+alphamin, alphamax = 0., 10.
+betamin, betamax = 3, 13
+gammamin, gammamax = 1.5, 15.5
+#
+def simulation(x):
+ "Simulation function H to perform Y=H(X)"
+ __x = numpy.ravel(x)
+ __H = numpy.array([[1,0,0],[0,2,0],[0,0,3],[1,2,3]])
+ return numpy.dot(__H, __x)
+#
+# Observations obtained by simulation
+# -----------------------------------
+Xtrue = (2, 3, 4)
+observations = simulation(Xtrue)
+#
+# =============================================================
+# SOLVING THE PROBLEM
+#
+# Formatting entries
+# ------------------
+Xb = (alpha, beta, gamma)
+Bounds = (
+ (alphamin, alphamax),
+ (betamin, betamax ),
+ (gammamin, gammamax))
+#
+# ADAO TUI
+# --------
+case = adaoBuilder.New()
+case.set(
+ 'AlgorithmParameters',
+ Algorithm = '3DVAR',
+ Parameters = {
+ "Bounds":Bounds,
+ "MaximumNumberOfSteps":100,
+ "StoreSupplementaryCalculations":[
+ "CostFunctionJ",
+ "CurrentState",
+ "SimulatedObservationAtOptimum",
+ ],
+ }
+ )
+case.set( 'Background', Vector = numpy.array(Xb), Stored = True )
+case.set( 'Observation', Vector = numpy.array(observations) )
+case.set( 'BackgroundError', ScalarSparseMatrix = 1.0e10 )
+case.set( 'ObservationError', ScalarSparseMatrix = 1.0 )
+case.set(
+ 'ObservationOperator',
+ OneFunction = simulation,
+ Parameters = {"DifferentialIncrement":0.0001},
+ )
+case.set( 'Observer', Variable="CurrentState", Template="ValuePrinter" )
+case.execute()
+#
+# Getting variables of interest
+# -----------------------------
+Xbackground = case.get("Background")
+Xoptimum = case.get("Analysis")[-1]
+FX_at_optimum = case.get("SimulatedObservationAtOptimum")[-1]
+J_values = case.get("CostFunctionJ")[:]
+#
+# =============================================================
+# INDEPENDENT HOLDING OF RESULTS
+#
+print("")
+print("Number of internal iterations...: %i"%len(J_values))
+print("Initial state...................: %s"%(numpy.ravel(Xbackground),))
+print("Idealized state.................: %s"%(numpy.ravel(Xtrue)*1.,))
+print("Optimal state...................: %s"%(numpy.ravel(Xoptimum),))
+print("Simulation at optimal state.....: %s"%(numpy.ravel(FX_at_optimum),))
+print("")
--- /dev/null
+CurrentState [5. 7. 9.]
+CurrentState [0. 3. 1.5]
+CurrentState [1.40006418 3.86705307 3.7061137 ]
+CurrentState [1.42580231 3.68474804 3.81008738]
+CurrentState [1.60220353 3.0677108 4.06146069]
+CurrentState [1.72517855 3.03296953 4.04915706]
+CurrentState [2.00010755 3. 4.00055409]
+CurrentState [1.99995528 3. 3.99996367]
+CurrentState [2.00000007 3. 4.00000011]
+CurrentState [2. 3. 4.]
+
+Number of internal iterations...: 10
+Initial state...................: [5. 7. 9.]
+Idealized state.................: [2. 3. 4.]
+Optimal state...................: [2. 3. 4.]
+Simulation at optimal state.....: [ 2. 6. 12. 20.]
+
To introduce the TUI interface, lets begin by a simple but complete example of
ADAO calculation case. All the data are explicitly defined inside the script in
order to make the reading easier. The whole set of commands is the following
-one::
+one:
- from numpy import array
- from adao import adaoBuilder
- case = adaoBuilder.New()
- case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
- case.set( 'Background', Vector=[0, 1, 2] )
- case.set( 'BackgroundError', ScalarSparseMatrix=1.0 )
- case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) )
- case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' )
- case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' )
- case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" )
- case.execute()
+.. literalinclude:: scripts/tui_example_01.py
+ :language: python
The result of running these commands in SALOME (either as a SALOME "*shell*"
-command, in the Python command window of the interface, or by the script
-execution entry of the menu) is the following::
+command, in the SALOME Python command window of the interface, or by the script
+execution entry of the menu) is the following:
- Analysis [ 0.25000264 0.79999797 0.94999939]
+.. literalinclude:: scripts/tui_example_01.res
Detailed setup of an ADAO TUI calculation case
+++++++++++++++++++++++++++++++++++++++++++++++
import numpy
__x = numpy.ravel(x)
__H = numpy.diag([1.,2.,3.])
- return __H @ __x
+ return numpy.dot(__H, __x)
#
case.set( 'ObservationOperator',
OneFunction = simulation,
In addition, simple information about the case study as defined by the user can
be obtained by using the Python "*print*" command directly on the case, at any
-stage during its design. For example::
+stage during its design. For example:
- from numpy import array
- from adao import adaoBuilder
- case = adaoBuilder.New()
- case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
- case.set( 'Background', Vector=[0, 1, 2] )
- print(case)
-
-which result is here::
+.. literalinclude:: scripts/tui_example_07.py
+ :language: python
- ================================================================================
- ADAO Study report
- ================================================================================
+which result is here:
- - AlgorithmParameters command has been set with values:
- Algorithm='3DVAR'
-
- - Background command has been set with values:
- Vector=[0, 1, 2]
+.. literalinclude:: scripts/tui_example_07.res
.. _subsection_tui_advanced:
#. that the user have a Python function of physical simulation named ``simulation``, previously (well) tested, which transforms the 3 parameters in results similar to the observations,
#. that the independent holding, that the user want to elaborate, is represented here by the simple printing of the initial state, of the optimal state, of the simulation in that point, of the intermediate state and of the number of optimization iteration.
-In order to try in a simple way this example of TUI calculation case, we choose
-for example the following entries, perfectly arbitrary, by building the
-observations by simulation in order to set a twin experiments case (for
-information, see the approach :ref:`section_methodology_twin`)::
-
- #
- # Artificial building of an example of user data
- # ----------------------------------------------
- alpha = 5.
- beta = 7
- gamma = 9.0
- #
- alphamin, alphamax = 0., 10.
- betamin, betamax = 3, 13
- gammamin, gammamax = 1.5, 15.5
- #
- def simulation(x):
- "Simulation function H to perform Y=H(X)"
- import numpy
- __x = numpy.ravel(x)
- __H = numpy.diag([1.,2.,3.])
- return __H @ __x
- #
- # Observations obtained by simulation
- # -----------------------------------
- observations = simulation((2, 3, 4))
+In order to try in a simple way this example of TUI calculation case, we set
+ourselves in a twin experiments case (for information, see the approach
+:ref:`section_methodology_twin`). For that, we choose for example the following
+entries, perfectly arbitrary, by building the observations by simulation. Then
+we solve the adjustment problem through the command set execution that follows.
+Finally, the whole problem is set and solved by the following script:
-The set of commands that can be used is the following::
+.. literalinclude:: scripts/tui_example_11.py
+ :language: python
- import numpy
- from adao import adaoBuilder
- #
- # Formatting entries
- # ------------------
- Xb = (alpha, beta, gamma)
- Bounds = (
- (alphamin, alphamax),
- (betamin, betamax ),
- (gammamin, gammamax))
- #
- # TUI ADAO
- # --------
- case = adaoBuilder.New()
- case.set(
- 'AlgorithmParameters',
- Algorithm = '3DVAR',
- Parameters = {
- "Bounds":Bounds,
- "MaximumNumberOfSteps":100,
- "StoreSupplementaryCalculations":[
- "CostFunctionJ",
- "CurrentState",
- "SimulatedObservationAtOptimum",
- ],
- }
- )
- case.set( 'Background', Vector = numpy.array(Xb), Stored = True )
- case.set( 'Observation', Vector = numpy.array(observations) )
- case.set( 'BackgroundError', ScalarSparseMatrix = 1.0e10 )
- case.set( 'ObservationError', ScalarSparseMatrix = 1.0 )
- case.set(
- 'ObservationOperator',
- OneFunction = simulation,
- Parameters = {"DifferentialIncrement":0.0001},
- )
- case.set( 'Observer', Variable="CurrentState", Template="ValuePrinter" )
- case.execute()
- #
- # Independent holding
- # -------------------
- Xbackground = case.get("Background")
- Xoptimum = case.get("Analysis")[-1]
- FX_at_optimum = case.get("SimulatedObservationAtOptimum")[-1]
- J_values = case.get("CostFunctionJ")[:]
- print("")
- print("Number of internal iterations...: %i"%len(J_values))
- print("Initial state...................: %s"%(numpy.ravel(Xbackground),))
- print("Optimal state...................: %s"%(numpy.ravel(Xoptimum),))
- print("Simulation at optimal state.....: %s"%(numpy.ravel(FX_at_optimum),))
- print("")
+The command set execution gives the following results:
-The command set execution gives the following result::
-
- CurrentState [ 5. 7. 9.]
- CurrentState [ 0. 3. 1.5]
- CurrentState [ 1.40006418 3.86705307 3.7061137 ]
- CurrentState [ 1.42580231 3.68474804 3.81008738]
- CurrentState [ 1.60220353 3.0677108 4.06146069]
- CurrentState [ 1.72517855 3.03296953 4.04915706]
- CurrentState [ 2.00010755 3. 4.00055409]
- CurrentState [ 1.99995528 3. 3.99996367]
- CurrentState [ 2.00000007 3. 4.00000011]
- CurrentState [ 2. 3. 4.]
-
- Number of internal iterations...: 10
- Initial state...................: [ 5. 7. 9.]
- Optimal state...................: [ 2. 3. 4.]
- Simulation at optimal state.....: [ 2. 6. 12. 20.]
+.. literalinclude:: scripts/tui_example_11.res
As it should be in twin experiments, when we trust mainly in observations, it
is found that we get correctly the parameters that were used to artificially
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+from numpy import array
+from adao import adaoBuilder
+case = adaoBuilder.New()
+case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
+case.set( 'Background', Vector=[0, 1, 2] )
+case.set( 'BackgroundError', ScalarSparseMatrix=1.0 )
+case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) )
+case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' )
+case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' )
+case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" )
+case.execute()
--- /dev/null
+Analysis [0.25000264 0.79999797 0.94999939]
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+from numpy import array
+from adao import adaoBuilder
+case = adaoBuilder.New()
+case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
+case.set( 'Background', Vector=[0, 1, 2] )
+#
+print(case)
--- /dev/null
+================================================================================
+ADAO Study report
+================================================================================
+
+ - AlgorithmParameters command has been set with values:
+ Algorithm = '3DVAR'
+
+ - Background command has been set with values:
+ Vector = [0, 1, 2]
+
+
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+import numpy
+from adao import adaoBuilder
+#
+# =============================================================
+# POSITION DU PROBLÈME
+#
+# Construction artificielle d'un exemple de données utilisateur
+# -------------------------------------------------------------
+alpha = 5.
+beta = 7
+gamma = 9.0
+#
+alphamin, alphamax = 0., 10.
+betamin, betamax = 3, 13
+gammamin, gammamax = 1.5, 15.5
+#
+def simulation(x):
+ "Fonction de simulation H pour effectuer Y=H(X)"
+ __x = numpy.ravel(x)
+ __H = numpy.array([[1,0,0],[0,2,0],[0,0,3],[1,2,3]])
+ return numpy.dot(__H, __x)
+#
+# Observations obtenues par simulation
+# ------------------------------------
+Xtrue = (2, 3, 4)
+observations = simulation(Xtrue)
+#
+# =============================================================
+# RÉSOLUTION DU PROBLÈME
+#
+# Mise en forme des entrées
+# -------------------------
+Xb = (alpha, beta, gamma)
+Bounds = (
+ (alphamin, alphamax),
+ (betamin, betamax ),
+ (gammamin, gammamax))
+#
+# ADAO TUI
+# --------
+case = adaoBuilder.New()
+case.set(
+ 'AlgorithmParameters',
+ Algorithm = '3DVAR',
+ Parameters = {
+ "Bounds":Bounds,
+ "MaximumNumberOfSteps":100,
+ "StoreSupplementaryCalculations":[
+ "CostFunctionJ",
+ "CurrentState",
+ "SimulatedObservationAtOptimum",
+ ],
+ }
+ )
+case.set( 'Background', Vector = numpy.array(Xb), Stored = True )
+case.set( 'Observation', Vector = numpy.array(observations) )
+case.set( 'BackgroundError', ScalarSparseMatrix = 1.0e10 )
+case.set( 'ObservationError', ScalarSparseMatrix = 1.0 )
+case.set(
+ 'ObservationOperator',
+ OneFunction = simulation,
+ Parameters = {"DifferentialIncrement":0.0001},
+ )
+case.set( 'Observer', Variable="CurrentState", Template="ValuePrinter" )
+case.execute()
+#
+# Récupération des variables d'intérêt
+# ------------------------------------
+Xbackground = case.get("Background")
+Xoptimum = case.get("Analysis")[-1]
+FX_at_optimum = case.get("SimulatedObservationAtOptimum")[-1]
+J_values = case.get("CostFunctionJ")[:]
+#
+# =============================================================
+# EXPLOITATION DES RÉSULTATS INDÉPENDANTE
+#
+print("")
+print("Nombre d'itérations internes...: %i"%len(J_values))
+print("État initial...................: %s"%(numpy.ravel(Xbackground),))
+print("État idéalisé..................: %s"%(numpy.ravel(Xtrue)*1.,))
+print("État optimal...................: %s"%(numpy.ravel(Xoptimum),))
+print("Simulation à l'état optimal....: %s"%(numpy.ravel(FX_at_optimum),))
+print("")
--- /dev/null
+CurrentState [5. 7. 9.]
+CurrentState [0. 3. 1.5]
+CurrentState [1.40006418 3.86705307 3.7061137 ]
+CurrentState [1.42580231 3.68474804 3.81008738]
+CurrentState [1.60220353 3.0677108 4.06146069]
+CurrentState [1.72517855 3.03296953 4.04915706]
+CurrentState [2.00010755 3. 4.00055409]
+CurrentState [1.99995528 3. 3.99996367]
+CurrentState [2.00000007 3. 4.00000011]
+CurrentState [2. 3. 4.]
+
+Nombre d'itérations internes...: 10
+État initial...................: [5. 7. 9.]
+État idéalisé..................: [2. 3. 4.]
+État optimal...................: [2. 3. 4.]
+Simulation à l'état optimal....: [ 2. 6. 12. 20.]
+
Pour introduire l'interface TUI, on commence par un exemple simple mais complet
de cas de calcul ADAO. Toutes les données sont explicitement définies dans le
corps du script pour faciliter la lecture. L'ensemble des commandes est le
-suivant::
+suivant :
- from numpy import array
- from adao import adaoBuilder
- case = adaoBuilder.New()
- case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
- case.set( 'Background', Vector=[0, 1, 2] )
- case.set( 'BackgroundError', ScalarSparseMatrix=1.0 )
- case.set( 'Observation', Vector=array([0.5, 1.5, 2.5]) )
- case.set( 'ObservationError', DiagonalSparseMatrix='1 1 1' )
- case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' )
- case.set( 'Observer', Variable="Analysis", Template="ValuePrinter" )
- case.execute()
+.. literalinclude:: scripts/tui_example_01.py
+ :language: python
Le résultat de l'exécution de ces commandes dans SALOME (que ce soit par la
-commande "*shell*" de SALOME, dans la console Python de l'interface, ou par le
-menu d'exécution d'un script) est le suivant::
+commande "*shell*" de SALOME, dans une console Python SALOME de l'interface, ou
+par le menu d'exécution d'un script) est le suivant :
- Analysis [ 0.25000264 0.79999797 0.94999939]
+.. literalinclude:: scripts/tui_example_01.res
Création détaillée d'un cas de calcul TUI ADAO
++++++++++++++++++++++++++++++++++++++++++++++
import numpy
__x = numpy.ravel(x)
__H = numpy.diag([1.,2.,3.])
- return __H @ __x
+ return numpy.dot(__H, __x)
#
case.set( 'ObservationOperator',
OneFunction = simulation,
De plus, on peut obtenir une information simple sur le cas d'étude tel que
défini par l'utilisateur en utilisant directement la commande "*print*" de Python
-sur le cas, à toute étape lors de sa construction. Par exemple::
+sur le cas, à toute étape lors de sa construction. Par exemple :
- from numpy import array
- from adao import adaoBuilder
- case = adaoBuilder.New()
- case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
- case.set( 'Background', Vector=[0, 1, 2] )
- print(case)
-
-dont le résultat est ici::
+.. literalinclude:: scripts/tui_example_07.py
+ :language: python
- ================================================================================
- ADAO Study report
- ================================================================================
+dont le résultat est ici :
- - AlgorithmParameters command has been set with values:
- Algorithm='3DVAR'
-
- - Background command has been set with values:
- Vector=[0, 1, 2]
+.. literalinclude:: scripts/tui_example_07.res
.. _subsection_tui_advanced:
#. que l'utilisateur dispose en Python d'une fonction de simulation physique appelée ``simulation``, préalablement (bien) testée, qui transforme les 3 paramètres en résultats similaires aux observations,
#. que l'exploitation indépendante, que l'utilisateur veut faire, est représentée ici par l'affichage simple de l'état initial, de l'état optimal, de la simulation en ce point, des états intermédiaires et du nombre d'itérations d'optimisation.
-Pour effectuer de manière simple cet essai de cas de calcul TUI, on se donne
-par exemple les entrées suivantes, parfaitement arbitraires, en construisant
-les observations par simulation pour se placer dans un cas d'expériences
-jumelles (pour mémoire, voir la démarche :ref:`section_methodology_twin`)::
-
- #
- # Construction artificielle d'un exemple de données utilisateur
- # -------------------------------------------------------------
- alpha = 5.
- beta = 7
- gamma = 9.0
- #
- alphamin, alphamax = 0., 10.
- betamin, betamax = 3, 13
- gammamin, gammamax = 1.5, 15.5
- #
- def simulation(x):
- "Fonction de simulation H pour effectuer Y=H(X)"
- import numpy
- __x = numpy.ravel(x)
- __H = numpy.diag([1.,2.,3.])
- return __H @ __x
- #
- # Observations obtenues par simulation
- # ------------------------------------
- observations = simulation((2, 3, 4))
+Pour effectuer de manière simple cet essai de cas de calcul TUI, on se place
+dans un cas d'expériences jumelles (pour mémoire, voir la démarche
+:ref:`section_methodology_twin`). Pour cela, on se donne par exemple les
+entrées suivantes, parfaitement arbitraires, en construisant les observations
+par simulation. Puis on résout le problème de recalage par le jeu de commandes
+qui vient ensuite. Au final, l'ensemble du problème est posé et résolu par le
+script suivant :
-Le jeu de commandes que l'on peut utiliser est le suivant::
+.. literalinclude:: scripts/tui_example_11.py
+ :language: python
- import numpy
- from adao import adaoBuilder
- #
- # Mise en forme des entrées
- # -------------------------
- Xb = (alpha, beta, gamma)
- Bounds = (
- (alphamin, alphamax),
- (betamin, betamax ),
- (gammamin, gammamax))
- #
- # TUI ADAO
- # --------
- case = adaoBuilder.New()
- case.set(
- 'AlgorithmParameters',
- Algorithm = '3DVAR',
- Parameters = {
- "Bounds":Bounds,
- "MaximumNumberOfSteps":100,
- "StoreSupplementaryCalculations":[
- "CostFunctionJ",
- "CurrentState",
- "SimulatedObservationAtOptimum",
- ],
- }
- )
- case.set( 'Background', Vector = numpy.array(Xb), Stored = True )
- case.set( 'Observation', Vector = numpy.array(observations) )
- case.set( 'BackgroundError', ScalarSparseMatrix = 1.0e10 )
- case.set( 'ObservationError', ScalarSparseMatrix = 1.0 )
- case.set(
- 'ObservationOperator',
- OneFunction = simulation,
- Parameters = {"DifferentialIncrement":0.0001},
- )
- case.set( 'Observer', Variable="CurrentState", Template="ValuePrinter" )
- case.execute()
- #
- # Exploitation indépendante
- # -------------------------
- Xbackground = case.get("Background")
- Xoptimum = case.get("Analysis")[-1]
- FX_at_optimum = case.get("SimulatedObservationAtOptimum")[-1]
- J_values = case.get("CostFunctionJ")[:]
- print("")
- print("Nombre d'itérations internes...: %i"%len(J_values))
- print("Etat initial...................: %s"%(numpy.ravel(Xbackground),))
- print("Etat optimal...................: %s"%(numpy.ravel(Xoptimum),))
- print("Simulation à l'état optimal....: %s"%(numpy.ravel(FX_at_optimum),))
- print("")
+L'exécution de jeu de commandes donne les résultats suivants :
-L'exécution de jeu de commandes donne le résultat suivant::
-
- CurrentState [ 5. 7. 9.]
- CurrentState [ 0. 3. 1.5]
- CurrentState [ 1.40006418 3.86705307 3.7061137 ]
- CurrentState [ 1.42580231 3.68474804 3.81008738]
- CurrentState [ 1.60220353 3.0677108 4.06146069]
- CurrentState [ 1.72517855 3.03296953 4.04915706]
- CurrentState [ 2.00010755 3. 4.00055409]
- CurrentState [ 1.99995528 3. 3.99996367]
- CurrentState [ 2.00000007 3. 4.00000011]
- CurrentState [ 2. 3. 4.]
-
- Nombre d'itérations internes...: 10
- Etat initial...................: [ 5. 7. 9.]
- Etat optimal...................: [ 2. 3. 4.]
- Simulation à l'état optimal....: [ 2. 6. 12. 20.]
+.. literalinclude:: scripts/tui_example_11.res
Comme il se doit en expériences jumelles, avec une confiance majoritairement
placée dans les observations, on constate que l'on retrouve bien les paramètres
"Fonction de simulation H pour effectuer Y=H(X)"
import numpy
__x = numpy.ravel(x)
- __H = numpy.diag([1.,2.,3.])
+ __H = numpy.array([[1,0,0],[0,2,0],[0,0,3],[1,2,3]])
return __H @ __x
#
# Observations obtenues par simulation
"Fonction de simulation H pour effectuer Y=H(X)"
import numpy
__x = numpy.ravel(x)
- __H = numpy.diag([1.,2.,3.])
+ __H = numpy.array([[1,0,0],[0,2,0],[0,0,3],[1,2,3]])
return __H @ __x
#
def multisimulation( xserie ):