.. literalinclude:: scripts/simple_3DVAR.res
+.. include:: snippets/Header2Algo11.rst
+
+.. _simple_3DVAR:
+.. image:: scripts/simple_3DVAR.png
+ :align: center
+ :width: 90%
+
.. ------------------------------------ ..
.. include:: snippets/Header2Algo06.rst
.. literalinclude:: scripts/simple_NonLinearLeastSquares.res
+.. include:: snippets/Header2Algo11.rst
+
+.. _simple_NonLinearLeastSquares:
+.. image:: scripts/simple_NonLinearLeastSquares.png
+ :align: center
+ :width: 90%
+
.. ------------------------------------ ..
.. include:: snippets/Header2Algo06.rst
+- :ref:`section_ref_algorithm_LinearLeastSquares`
- :ref:`section_ref_algorithm_3DVAR`
+- :ref:`section_ref_algorithm_LinearityTest`
.. ------------------------------------ ..
.. include:: snippets/Header2Algo07.rst
from numpy import array, ravel
def QuadFunction( coefficients ):
"""
- Simulation : y = a x^2 + b x + c
+ Quadratic simulation in x: y = a x^2 + b x + c
"""
a, b, c = list(ravel(coefficients))
x_points = (-5, 0, 1, 3, 10)
Xb = array([1., 1., 1.])
Yobs = array([57, 2, 3, 17, 192])
#
-print("Variational resolution of the calibration problem")
-print("-------------------------------------------------")
+print("Resolution of the calibration problem")
+print("-------------------------------------")
print("")
from adao import adaoBuilder
case = adaoBuilder.New('')
print("Expected theoretical coefficients..:", ravel((2,-1,2)))
print("")
print("Calibration resulting coefficients.:", ravel(case.get('Analysis')[-1]))
+#
+Xa = case.get('Analysis')[-1]
+import matplotlib.pyplot as plt
+plt.rcParams['figure.figsize'] = (10, 4)
+#
+plt.figure()
+plt.plot((-5,0,1,3,10),QuadFunction(Xb),'b-',label="Simulation at background")
+plt.plot((-5,0,1,3,10),Yobs, 'kX',label='Observation',markersize=10)
+plt.plot((-5,0,1,3,10),QuadFunction(Xa),'r-',label="Simulation at optimum")
+plt.legend()
+plt.title('Coefficients calibration', fontweight='bold')
+plt.xlabel('Arbitrary coordinate')
+plt.ylabel('Observation Yobs')
+plt.savefig("simple_3DVAR.png")
-Variational resolution of the calibration problem
--------------------------------------------------
+Resolution of the calibration problem
+-------------------------------------
Intermediate state at the current iteration: [1. 1. 1.]
Intermediate state at the current iteration: [1.99739508 1.07086406 1.01346638]
points. The calibration is done using an initial coefficient set (background
state specified by ``Xb`` in the code), and with the information
:math:`\mathbf{y}^o` (specified by ``Yobs`` in the code) of 5 measures obtained
-in these same internal control points. We choose to emphasize the observations
-versus the background by setting a great variance for the background error,
-here of :math:`10^{6}`.
+in these same internal control points. We set twin experiments (see
+:ref:`section_methodology_twin`) and the measurements are supposed to be
+perfect. We choose to emphasize the observations versus the background by
+setting a great variance for the background error, here of :math:`10^{6}`.
The adjustment is carried out by displaying intermediate results during
iterative optimization.
from numpy import array, ravel
def QuadFunction( coefficients ):
"""
- Simulation : y = a x^2 + b x + c
+ Quadratic simulation in x: y = a x^2 + b x + c
"""
a, b, c = list(ravel(coefficients))
x_points = (-5, 0, 1, 3, 10)
Xb = array([1., 1., 1.])
Yobs = array([57, 2, 3, 17, 192])
#
-print("Iterative resolution of the calibration problem")
-print("-----------------------------------------------")
+print("Resolution of the calibration problem")
+print("-------------------------------------")
print("")
from adao import adaoBuilder
case = adaoBuilder.New('')
print("Expected theoretical coefficients..:", ravel((2,-1,2)))
print("")
print("Calibration resulting coefficients.:", ravel(case.get('Analysis')[-1]))
+#
+Xa = case.get('Analysis')[-1]
+import matplotlib.pyplot as plt
+plt.rcParams['figure.figsize'] = (10, 4)
+#
+plt.figure()
+plt.plot((-5,0,1,3,10),QuadFunction(Xb),'b-',label="Simulation at background")
+plt.plot((-5,0,1,3,10),Yobs, 'kX',label='Observation',markersize=10)
+plt.plot((-5,0,1,3,10),QuadFunction(Xa),'r-',label="Simulation at optimum")
+plt.legend()
+plt.title('Coefficients calibration', fontweight='bold')
+plt.xlabel('Arbitrary coordinate')
+plt.ylabel('Observation Yobs')
+plt.savefig("simple_NonLinearLeastSquares.png")
-Iterative resolution of the calibration problem
------------------------------------------------
+Resolution of the calibration problem
+-------------------------------------
Intermediate state at the current iteration: [1. 1. 1.]
Intermediate state at the current iteration: [1.99739508 1.07086406 1.01346638]
points. The calibration is done using an initial coefficient set (background
state specified by ``Xb`` in the code), and with the information
:math:`\mathbf{y}^o` (specified by ``Yobs`` in the code) of 5 measures obtained
-in these same internal control points.
+in these same internal control points. We set twin experiments (see
+:ref:`section_methodology_twin`) and the measurements are supposed to be
+perfect.
The adjustment is carried out by displaying intermediate results during
iterative optimization.
.. literalinclude:: scripts/simple_3DVAR.res
+.. include:: snippets/Header2Algo11.rst
+
+.. _simple_3DVAR:
+.. image:: scripts/simple_3DVAR.png
+ :align: center
+ :width: 90%
+
.. ------------------------------------ ..
.. include:: snippets/Header2Algo06.rst
.. literalinclude:: scripts/simple_NonLinearLeastSquares.res
+.. include:: snippets/Header2Algo11.rst
+
+.. _simple_NonLinearLeastSquares:
+.. image:: scripts/simple_NonLinearLeastSquares.png
+ :align: center
+ :width: 90%
+
.. ------------------------------------ ..
.. include:: snippets/Header2Algo06.rst
+- :ref:`section_ref_algorithm_LinearLeastSquares`
- :ref:`section_ref_algorithm_3DVAR`
+- :ref:`section_ref_algorithm_LinearityTest`
.. ------------------------------------ ..
.. include:: snippets/Header2Algo07.rst
from numpy import array, ravel
def QuadFunction( coefficients ):
"""
- Simulation : y = a x^2 + b x + c
+ Simulation quadratique aux points x : y = a x^2 + b x + c
"""
a, b, c = list(ravel(coefficients))
x_points = (-5, 0, 1, 3, 10)
Xb = array([1., 1., 1.])
Yobs = array([57, 2, 3, 17, 192])
#
-print("Résolution variationnelle du problème de calage")
-print("-----------------------------------------------")
+print("Résolution du problème de calage")
+print("--------------------------------")
print("")
from adao import adaoBuilder
case = adaoBuilder.New('')
print("Coefficients théoriques attendus..:", ravel((2,-1,2)))
print("")
print("Coefficients résultants du calage.:", ravel(case.get('Analysis')[-1]))
+#
+Xa = case.get('Analysis')[-1]
+import matplotlib.pyplot as plt
+plt.rcParams['figure.figsize'] = (10, 4)
+#
+plt.figure()
+plt.plot((-5,0,1,3,10),QuadFunction(Xb),'b-',label="Simulation à l'ébauche")
+plt.plot((-5,0,1,3,10),Yobs, 'kX',label='Observation',markersize=10)
+plt.plot((-5,0,1,3,10),QuadFunction(Xa),'r-',label="Simulation à l'optimum")
+plt.legend()
+plt.title('Calage de coefficients', fontweight='bold')
+plt.xlabel('Coordonnée arbitraire')
+plt.ylabel('Observation Yobs')
+plt.savefig("simple_3DVAR.png")
-Résolution variationnelle du problème de calage
------------------------------------------------
+Résolution du problème de calage
+--------------------------------
État intermédiaire en itération courante : [1. 1. 1.]
État intermédiaire en itération courante : [1.99739508 1.07086406 1.01346638]
internes prédéfinis dans le modèle. Le calage s'effectue sur la base d'un jeu
initial de coefficients (état d'ébauche désigné par ``Xb`` dans l'exemple), et
avec l'information :math:`\mathbf{y}^o` (désignée par ``Yobs`` dans l'exemple)
-de 5 mesures obtenues à ces mêmes points de contrôle internes. On privilégie
-les observations au détriment de l'ébauche par l'indication d'une très
-importante variance d'erreur d'ébauche, ici de :math:`10^{6}`.
+de 5 mesures obtenues à ces mêmes points de contrôle internes. On se place en
+expériences jumelles (voir :ref:`section_methodology_twin`) et les mesures sont
+parfaites. On privilégie les observations au détriment de l'ébauche par
+l'indication d'une très importante variance d'erreur d'ébauche, ici de
+:math:`10^{6}`.
L'ajustement s'effectue en affichant des résultats intermédiaires lors de
l'optimisation itérative.
from numpy import array, ravel
def QuadFunction( coefficients ):
"""
- Simulation : y = a x^2 + b x + c
+ Simulation quadratique aux points x : y = a x^2 + b x + c
"""
a, b, c = list(ravel(coefficients))
x_points = (-5, 0, 1, 3, 10)
Xb = array([1., 1., 1.])
Yobs = array([57, 2, 3, 17, 192])
#
-print("Résolution itérative du problème de calage")
-print("------------------------------------------")
+print("Résolution du problème de calage")
+print("--------------------------------")
print("")
from adao import adaoBuilder
case = adaoBuilder.New('')
print("Coefficients théoriques attendus..:", ravel((2,-1,2)))
print("")
print("Coefficients résultants du calage.:", ravel(case.get('Analysis')[-1]))
+#
+Xa = case.get('Analysis')[-1]
+import matplotlib.pyplot as plt
+plt.rcParams['figure.figsize'] = (10, 4)
+#
+plt.figure()
+plt.plot((-5,0,1,3,10),QuadFunction(Xb),'b-',label="Simulation à l'ébauche")
+plt.plot((-5,0,1,3,10),Yobs, 'kX',label='Observation',markersize=10)
+plt.plot((-5,0,1,3,10),QuadFunction(Xa),'r-',label="Simulation à l'optimum")
+plt.legend()
+plt.title('Calage de coefficients', fontweight='bold')
+plt.xlabel('Coordonnée arbitraire')
+plt.ylabel('Observation Yobs')
+plt.savefig("simple_NonLinearLeastSquares.png")
-Résolution itérative du problème de calage
-------------------------------------------
+Résolution du problème de calage
+--------------------------------
État intermédiaire en itération courante : [1. 1. 1.]
État intermédiaire en itération courante : [1.99739508 1.07086406 1.01346638]
internes prédéfinis dans le modèle. Le calage s'effectue sur la base d'un jeu
initial de coefficients (état d'ébauche désigné par ``Xb`` dans l'exemple), et
avec l'information :math:`\mathbf{y}^o` (désignée par ``Yobs`` dans l'exemple)
-de 5 mesures obtenues à ces mêmes points de contrôle internes.
+de 5 mesures obtenues à ces mêmes points de contrôle internes. On se place en
+expériences jumelles (voir :ref:`section_methodology_twin`) et les mesures sont
+parfaites.
L'ajustement s'effectue en affichant des résultats intermédiaires lors de
l'optimisation itérative.