]> SALOME platform Git repositories - modules/adao.git/blob - test/test6901/Verification_des_Assimilation_Algorithms.py
Salome HOME
Add or correct tests for salome test
[modules/adao.git] / test / test6901 / Verification_des_Assimilation_Algorithms.py
1 #-*-coding:iso-8859-1-*-
2 #
3 # Copyright (C) 2008-2016 EDF R&D
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 #
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #
21 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
22 "Verification de la disponibilite de l'ensemble des algorithmes"
23
24 # ==============================================================================
25 import adaoBuilder, numpy
26 def test1():
27     """Verification de la disponibilite de l'ensemble des algorithmes"""
28     for algo in ("3DVAR", "Blue", "ExtendedBlue", "LinearLeastSquares", "NonLinearLeastSquares", ):
29         print
30         msg = "Algorithme en test : %s"%algo
31         print msg+"\n"+"="*len(msg)
32         #
33         adaopy = adaoBuilder.New()
34         adaopy.setAlgorithmParameters(Algorithm=algo, Parameters={"EpsilonMinimumExponent":-10, })
35         adaopy.setBackground         (Vector = [0,1,2])
36         adaopy.setBackgroundError    (ScalarSparseMatrix = 1.)
37         adaopy.setObservation        (Vector = [0.5,1.5,2.5])
38         adaopy.setObservationError   (DiagonalSparseMatrix = "1 1 1")
39         adaopy.setObservationOperator(Matrix = "1 0 0;0 2 0;0 0 3")
40         adaopy.setObserver("Analysis",Template="ValuePrinter")
41         adaopy.execute()
42         del adaopy
43     #
44     for algo in ("ExtendedKalmanFilter", "KalmanFilter", "UnscentedKalmanFilter", "4DVAR"):
45         print
46         msg = "Algorithme en test : %s"%algo
47         print msg+"\n"+"="*len(msg)
48         #
49         adaopy = adaoBuilder.New()
50         adaopy.setAlgorithmParameters(Algorithm=algo, Parameters={"EpsilonMinimumExponent":-10, })
51         adaopy.setBackground         (Vector = [0,1,2])
52         adaopy.setBackgroundError    (ScalarSparseMatrix = 1.)
53         adaopy.setObservation        (Vector = [0.5,1.5,2.5])
54         adaopy.setObservationError   (DiagonalSparseMatrix = "1 1 1")
55         adaopy.setObservationOperator(Matrix = "1 0 0;0 1 0;0 0 1")
56         adaopy.setEvolutionModel     (Matrix = "1 0 0;0 1 0;0 0 1")
57         adaopy.setEvolutionError     (ScalarSparseMatrix = 1.)
58         adaopy.setObserver("Analysis",Template="ValuePrinter")
59         adaopy.execute()
60         del adaopy
61     #
62     for algo in ("ParticleSwarmOptimization", "QuantileRegression", ):
63         print
64         msg = "Algorithme en test : %s"%algo
65         print msg+"\n"+"="*len(msg)
66         #
67         adaopy = adaoBuilder.New()
68         adaopy.setAlgorithmParameters(Algorithm=algo, Parameters={"BoxBounds":3*[[-1,3]], "SetSeed":1000, })
69         adaopy.setBackground         (Vector = [0,1,2])
70         adaopy.setBackgroundError    (ScalarSparseMatrix = 1.)
71         adaopy.setObservation        (Vector = [0.5,1.5,2.5])
72         adaopy.setObservationError   (DiagonalSparseMatrix = "1 1 1")
73         adaopy.setObservationOperator(Matrix = "1 0 0;0 1 0;0 0 1")
74         adaopy.setEvolutionModel     (Matrix = "1 0 0;0 1 0;0 0 1")
75         adaopy.setEvolutionError     (ScalarSparseMatrix = 1.)
76         adaopy.setObserver("Analysis",Template="ValuePrinter")
77         adaopy.execute()
78         del adaopy
79     #
80     for algo in ("EnsembleBlue", ):
81         print
82         msg = "Algorithme en test : %s"%algo
83         print msg+"\n"+"="*len(msg)
84         #
85         adaopy = adaoBuilder.New()
86         adaopy.setAlgorithmParameters(Algorithm=algo, Parameters={"SetSeed":1000, })
87         adaopy.setBackground         (VectorSerie = 100*[[0,1,2]])
88         adaopy.setBackgroundError    (ScalarSparseMatrix = 1.)
89         adaopy.setObservation        (Vector = [0.5,1.5,2.5])
90         adaopy.setObservationError   (DiagonalSparseMatrix = "1 1 1")
91         adaopy.setObservationOperator(Matrix = "1 0 0;0 1 0;0 0 1")
92         adaopy.setEvolutionModel     (Matrix = "1 0 0;0 1 0;0 0 1")
93         adaopy.setEvolutionError     (ScalarSparseMatrix = 1.)
94         adaopy.setObserver("Analysis",Template="ValuePrinter")
95         adaopy.execute()
96         del adaopy
97     #
98     return 0
99
100 #===============================================================================
101 if __name__ == "__main__":
102     print '\n AUTODIAGNOSTIC \n'
103     test1()