.. include:: scripts/simple_KalmanFilter1.rst
+.. literalinclude:: scripts/simple_KalmanFilter1.py
+
+.. include:: snippets/Header2Algo10.rst
+
+.. literalinclude:: scripts/simple_KalmanFilter1.res
+
.. ------------------------------------ ..
.. include:: snippets/Header2Algo06.rst
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+from numpy import array, random
+random.seed(1234567)
+Xtrue = -0.37727
+Yobs = []
+for i in range(51):
+ Yobs.append([random.normal(Xtrue, 0.1, size=(1,)),])
+#
+print("Estimation of a constant variable by filtering")
+print("----------------------------------------------")
+print(" Noisy measurements acquired on %i time steps"%(len(Yobs)-1,))
+print("")
+from adao import adaoBuilder
+case = adaoBuilder.New('')
+#
+case.setBackground (Vector = [0.])
+case.setBackgroundError (ScalarSparseMatrix = 1.)
+#
+case.setObservationOperator(Matrix = [1.])
+case.setObservation (VectorSerie = Yobs)
+case.setObservationError (ScalarSparseMatrix = 0.1**2)
+#
+case.setEvolutionModel (Matrix = [1.])
+case.setEvolutionError (ScalarSparseMatrix = 1e-5)
+#
+case.setAlgorithmParameters(
+ Algorithm="KalmanFilter",
+ Parameters={
+ "StoreSupplementaryCalculations":[
+ "Analysis",
+ "APosterioriCovariance",
+ ],
+ },
+ )
+case.setObserver(
+ Info=" Analyzed state at current observation:",
+ Template='ValuePrinter',
+ Variable='Analysis',
+ )
+case.execute()
+Xa = case.get("Analysis")
+Pa = case.get("APosterioriCovariance")
+#
+print("")
+print(" Final a posteriori variance:",Pa[-1])
+print("")
--- /dev/null
+Estimation of a constant variable by filtering
+----------------------------------------------
+ Noisy measurements acquired on 50 time steps
+
+ Analyzed state at current observation: [0.]
+ Analyzed state at current observation: [-0.41804504]
+ Analyzed state at current observation: [-0.3114053]
+ Analyzed state at current observation: [-0.31191336]
+ Analyzed state at current observation: [-0.32761493]
+ Analyzed state at current observation: [-0.33597167]
+ Analyzed state at current observation: [-0.35629573]
+ Analyzed state at current observation: [-0.36840289]
+ Analyzed state at current observation: [-0.37392713]
+ Analyzed state at current observation: [-0.36331937]
+ Analyzed state at current observation: [-0.35750362]
+ Analyzed state at current observation: [-0.37963052]
+ Analyzed state at current observation: [-0.37117993]
+ Analyzed state at current observation: [-0.36732985]
+ Analyzed state at current observation: [-0.37148382]
+ Analyzed state at current observation: [-0.36798059]
+ Analyzed state at current observation: [-0.37371077]
+ Analyzed state at current observation: [-0.3661228]
+ Analyzed state at current observation: [-0.36777529]
+ Analyzed state at current observation: [-0.37681677]
+ Analyzed state at current observation: [-0.37007654]
+ Analyzed state at current observation: [-0.37974517]
+ Analyzed state at current observation: [-0.37964703]
+ Analyzed state at current observation: [-0.37514278]
+ Analyzed state at current observation: [-0.38143128]
+ Analyzed state at current observation: [-0.38790654]
+ Analyzed state at current observation: [-0.38880008]
+ Analyzed state at current observation: [-0.38393577]
+ Analyzed state at current observation: [-0.3831028]
+ Analyzed state at current observation: [-0.37680097]
+ Analyzed state at current observation: [-0.37891813]
+ Analyzed state at current observation: [-0.38147782]
+ Analyzed state at current observation: [-0.37981569]
+ Analyzed state at current observation: [-0.38274266]
+ Analyzed state at current observation: [-0.38418507]
+ Analyzed state at current observation: [-0.38923054]
+ Analyzed state at current observation: [-0.38400006]
+ Analyzed state at current observation: [-0.38562502]
+ Analyzed state at current observation: [-0.3840503]
+ Analyzed state at current observation: [-0.38775222]
+ Analyzed state at current observation: [-0.37700787]
+ Analyzed state at current observation: [-0.37328191]
+ Analyzed state at current observation: [-0.38024181]
+ Analyzed state at current observation: [-0.3815806]
+ Analyzed state at current observation: [-0.38392063]
+ Analyzed state at current observation: [-0.38539266]
+ Analyzed state at current observation: [-0.37856929]
+ Analyzed state at current observation: [-0.37744505]
+ Analyzed state at current observation: [-0.37154554]
+ Analyzed state at current observation: [-0.37405773]
+ Analyzed state at current observation: [-0.37725236]
+
+ Final a posteriori variance: [[0.00033921]]
+
.. include:: scripts/simple_KalmanFilter1.rst
+.. literalinclude:: scripts/simple_KalmanFilter1.py
+
+.. include:: snippets/Header2Algo10.rst
+
+.. literalinclude:: scripts/simple_KalmanFilter1.res
+
.. ------------------------------------ ..
.. include:: snippets/Header2Algo06.rst
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+from numpy import array, random
+random.seed(1234567)
+Xtrue = -0.37727
+Yobs = []
+for i in range(51):
+ Yobs.append([random.normal(Xtrue, 0.1, size=(1,)),])
+#
+print("Estimation par filtrage d'une variable constante")
+print("------------------------------------------------")
+print(" Observations bruitées acquises sur %i pas de temps"%(len(Yobs)-1,))
+print("")
+from adao import adaoBuilder
+case = adaoBuilder.New('')
+#
+case.setBackground (Vector = [0.])
+case.setBackgroundError (ScalarSparseMatrix = 1.)
+#
+case.setObservationOperator(Matrix = [1.])
+case.setObservation (VectorSerie = Yobs)
+case.setObservationError (ScalarSparseMatrix = 0.1**2)
+#
+case.setEvolutionModel (Matrix = [1.])
+case.setEvolutionError (ScalarSparseMatrix = 1e-5)
+#
+case.setAlgorithmParameters(
+ Algorithm="KalmanFilter",
+ Parameters={
+ "StoreSupplementaryCalculations":[
+ "Analysis",
+ "APosterioriCovariance",
+ ],
+ },
+ )
+case.setObserver(
+ Info=" État analysé à l'observation courante :",
+ Template='ValuePrinter',
+ Variable='Analysis',
+ )
+case.execute()
+Xa = case.get("Analysis")
+Pa = case.get("APosterioriCovariance")
+#
+print("")
+print(" Variance a posteriori finale :",Pa[-1])
+print("")
--- /dev/null
+Estimation par filtrage d'une variable constante
+------------------------------------------------
+ Observations bruitées acquises sur 50 pas de temps
+
+ État analysé à l'observation courante : [0.]
+ État analysé à l'observation courante : [-0.41804504]
+ État analysé à l'observation courante : [-0.3114053]
+ État analysé à l'observation courante : [-0.31191336]
+ État analysé à l'observation courante : [-0.32761493]
+ État analysé à l'observation courante : [-0.33597167]
+ État analysé à l'observation courante : [-0.35629573]
+ État analysé à l'observation courante : [-0.36840289]
+ État analysé à l'observation courante : [-0.37392713]
+ État analysé à l'observation courante : [-0.36331937]
+ État analysé à l'observation courante : [-0.35750362]
+ État analysé à l'observation courante : [-0.37963052]
+ État analysé à l'observation courante : [-0.37117993]
+ État analysé à l'observation courante : [-0.36732985]
+ État analysé à l'observation courante : [-0.37148382]
+ État analysé à l'observation courante : [-0.36798059]
+ État analysé à l'observation courante : [-0.37371077]
+ État analysé à l'observation courante : [-0.3661228]
+ État analysé à l'observation courante : [-0.36777529]
+ État analysé à l'observation courante : [-0.37681677]
+ État analysé à l'observation courante : [-0.37007654]
+ État analysé à l'observation courante : [-0.37974517]
+ État analysé à l'observation courante : [-0.37964703]
+ État analysé à l'observation courante : [-0.37514278]
+ État analysé à l'observation courante : [-0.38143128]
+ État analysé à l'observation courante : [-0.38790654]
+ État analysé à l'observation courante : [-0.38880008]
+ État analysé à l'observation courante : [-0.38393577]
+ État analysé à l'observation courante : [-0.3831028]
+ État analysé à l'observation courante : [-0.37680097]
+ État analysé à l'observation courante : [-0.37891813]
+ État analysé à l'observation courante : [-0.38147782]
+ État analysé à l'observation courante : [-0.37981569]
+ État analysé à l'observation courante : [-0.38274266]
+ État analysé à l'observation courante : [-0.38418507]
+ État analysé à l'observation courante : [-0.38923054]
+ État analysé à l'observation courante : [-0.38400006]
+ État analysé à l'observation courante : [-0.38562502]
+ État analysé à l'observation courante : [-0.3840503]
+ État analysé à l'observation courante : [-0.38775222]
+ État analysé à l'observation courante : [-0.37700787]
+ État analysé à l'observation courante : [-0.37328191]
+ État analysé à l'observation courante : [-0.38024181]
+ État analysé à l'observation courante : [-0.3815806]
+ État analysé à l'observation courante : [-0.38392063]
+ État analysé à l'observation courante : [-0.38539266]
+ État analysé à l'observation courante : [-0.37856929]
+ État analysé à l'observation courante : [-0.37744505]
+ État analysé à l'observation courante : [-0.37154554]
+ État analysé à l'observation courante : [-0.37405773]
+ État analysé à l'observation courante : [-0.37725236]
+
+ Variance a posteriori finale : [[0.00033921]]
+