Salome HOME
Correction de collision
[modules/adao.git] / examples / daSalome / test006_Observers_init.py
1 #-*-coding:iso-8859-1-*-
2 # Copyright (C) 2008-2015 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: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
21
22 import numpy
23 numpy.random.seed(1000)
24
25 def FunctionH( X ):
26   return H * X
27
28 dimension = 3
29 xt = numpy.matrix(numpy.arange(dimension)).T
30 Eo = numpy.matrix(numpy.random.normal(0.,1.,size=(dimension,))).T
31 Eb = numpy.matrix(numpy.random.normal(0.,1.,size=(dimension,))).T
32 H  = numpy.matrix(numpy.random.normal(0.,1.,size=(dimension,dimension)))
33 xb = xt + Eb
34 yo = FunctionH( xt ) + Eo
35 xb = xb.A1
36 yo = yo.A1
37 R  = numpy.matrix(numpy.core.identity(dimension)).T
38 B  = numpy.matrix(numpy.core.identity(dimension)).T
39
40 #
41 # Definition of the Background as a vector
42 # ----------------------------------------
43 Background = xb
44 #
45 # Definition of the Observation as a vector
46 # -----------------------------------------
47 Observation = yo
48 #
49 # Definition of the Background Error covariance as a matrix
50 # ---------------------------------------------------------
51 BackgroundError = B
52 #
53 # Definition of the Observation Error covariance as a matrix
54 # ----------------------------------------------------------
55 ObservationError = R
56
57 print xb
58 print B
59 print yo
60 print R
61
62 #
63 # Definition of the init_data dictionnary
64 # ---------------------------------------
65 init_data = {}
66 init_data["Background"]          = Background
67 init_data["Observation"]         = Observation
68 init_data["BackgroundError"]     = BackgroundError
69 init_data["ObservationError"]    = ObservationError
70
71 # Algorithm Parameters
72 init_data["AlgorithmParameters"] = {"Minimizer":"LBFGSB","MaximumNumberOfSteps":5}