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