Salome HOME
Adding elementary TUI examples to algorithms doc
[modules/adao.git] / doc / fr / scripts / simple_Blue.py
1 # -*- coding: utf-8 -*-
2 #
3 from numpy import array, ravel
4 from adao import adaoBuilder
5 case = adaoBuilder.New('')
6 case.setBackground( Vector = array([0., 1., 2.]), Stored=True )
7 case.setBackgroundError( ScalarSparseMatrix = 1. )
8 case.setObservation( Vector=array([10., 11., 12.]), Stored=True )
9 case.setObservationError( ScalarSparseMatrix = 1. )
10 case.setObservationOperator( Matrix=array([[1., 0., 0.],
11                                            [0., 1., 0.],
12                                            [0., 0., 1.]]), )
13 case.setAlgorithmParameters(
14     Algorithm='Blue',
15     Parameters={
16         'StoreSupplementaryCalculations': [
17             'APosterioriCovariance',
18             ],
19         },
20     )
21 case.execute()
22 #
23 #-------------------------------------------------------------------------------
24 #
25 print("Interpolation entre deux états vectoriels, observation et ébauche")
26 print("-----------------------------------------------------------------")
27 print("")
28 print("Vecteur observation...........:", ravel(case.get('Observation')))
29 print("Vecteur ébauche a priori......:", ravel(case.get('Background')))
30 print("")
31 print("État théorique attendu........:", ravel([5., 6., 7.]))
32 print("")
33 print("Résultat par interpolation....:", ravel(case.get('Analysis')[-1]))
34 print("Covariance a posteriori.......:\n", case.get('APosterioriCovariance')[-1])