Salome HOME
Observers ok add new examples test006
[modules/adao.git] / examples / daSalome / test006_Observers_init.py
1 #-*-coding:iso-8859-1-*-
2 # Copyright (C) 2010-2011 EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 # Author: AndrĂ© Ribes, andre.ribes@edf.fr, EDF R&D
21
22 import numpy
23
24 def FunctionH( X ):
25   return H * X
26
27 dimension = 3
28 xt = numpy.matrix(numpy.arange(dimension)).T
29 Eo = numpy.matrix(numpy.random.normal(0.,1.,size=(dimension,))).T
30 Eb = numpy.matrix(numpy.random.normal(0.,1.,size=(dimension,))).T
31 H  = numpy.matrix(numpy.random.normal(0.,1.,size=(dimension,dimension)))
32 xb = xt + Eb
33 yo = FunctionH( xt ) + Eo
34 xb = xb.A1
35 yo = yo.A1
36 R  = numpy.matrix(numpy.core.identity(dimension)).T
37 B  = numpy.matrix(numpy.core.identity(dimension)).T
38
39 #
40 # Definition of the Background as a vector
41 # ----------------------------------------
42 Background = xb
43 #
44 # Definition of the Observation as a vector
45 # -----------------------------------------
46 Observation = yo
47 #
48 # Definition of the Background Error covariance as a matrix
49 # ---------------------------------------------------------
50 BackgroundError = B
51 #
52 # Definition of the Observation Error covariance as a matrix
53 # ----------------------------------------------------------
54 ObservationError = R
55
56 print xb
57 print B
58 print yo
59 print R
60
61 #
62 # Definition of the init_data dictionnary
63 # ---------------------------------------
64 init_data = {}
65 init_data["Background"]          = Background
66 init_data["Observation"]         = Observation
67 init_data["BackgroundError"]     = BackgroundError
68 init_data["ObservationError"]    = ObservationError
69
70 # Algorithm Parameters
71 init_data["AlgorithmParameters"] = {"Minimizer":"LBFGSB","MaximumNumberOfSteps":5}