Salome HOME
Adding multi-functions input capabilities (2)
[modules/adao.git] / src / daSalome / __init__.py
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) 2008-2018 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/
20 #
21 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
22 __doc__ = """
23 =====================================================
24 ADAO: A module for Data Assimilation and Optimization
25 =====================================================
26
27 About
28 -----
29
30 **The ADAO module provides data assimilation and optimization**
31 features in Python or SALOME context (see
32 http://www.salome-platform.org/). Briefly stated, Data Assimilation is
33 a methodological framework to compute the optimal estimate of the
34 inaccessible true value of a system state, eventually over time. It
35 uses information coming from experimental measurements or observations,
36 and from numerical *a priori* models, including information about their
37 errors. Parts of the framework are also known under the names of
38 *parameter estimation*, *inverse problems*, *Bayesian estimation*,
39 *optimal interpolation*, etc. More details can be found in the full
40 ADAO documentation (see http://www.salome-platform.org/).
41
42 Only the use of ADAO text programming interface (API/TUI) is introduced
43 here. This interface gives ability to create a calculation object in a
44 similar way than the case building obtained through the graphical
45 interface (GUI). When one wants to elaborate "by hand" the TUI
46 calculation case, it is recommended to extensively use all the ADAO
47 module documentation, and to go back if necessary to the graphical
48 interface (GUI), to get all the elements allowing to correctly set the
49 commands.
50
51 A simple setup example of an ADAO TUI calculation case
52 ------------------------------------------------------
53
54 To introduce the TUI interface, lets begin by a simple but complete
55 example of ADAO calculation case. All the data are explicitly defined
56 inside the script in order to make the reading easier. The whole set of
57 commands is the following one::
58
59     from numpy import array, matrix
60     from adao import adaoBuilder
61     case = adaoBuilder.New()
62     case.set( 'AlgorithmParameters', Algorithm='3DVAR' )
63     case.set( 'Background',          Vector=[0, 1, 2] )
64     case.set( 'BackgroundError',     ScalarSparseMatrix=1.0 )
65     case.set( 'Observation',         Vector=array([0.5, 1.5, 2.5]) )
66     case.set( 'ObservationError',    DiagonalSparseMatrix='1 1 1' )
67     case.set( 'ObservationOperator', Matrix='1 0 0;0 2 0;0 0 3' )
68     case.set( 'Observer',            Variable="Analysis", Template="ValuePrinter" )
69     case.execute()
70
71 The result of running these commands in SALOME (either as a SALOME
72 "*shell*" command, in the Python command window of the interface, or by
73 the script execution entry of the menu) is the following::
74
75     Analysis [ 0.25000264  0.79999797  0.94999939]
76
77 More advanced examples of ADAO TUI calculation case
78 ---------------------------------------------------
79
80 Real cases involves observations loaded from files, operators
81 explicitly defined as generic functions including physical simulators,
82 time dependant information in order to deal with forecast analysis in
83 addition to calibration or re-analysis. More details can be found in
84 the full ADAO documentation (see http://www.salome-platform.org/).
85
86 License and requirements
87 ------------------------
88
89 The license for this module is the GNU Lesser General Public License
90 (Lesser GPL), as stated here and in the source files::
91
92     <ADAO, a module for Data Assimilation and Optimization>
93
94     Copyright (C) 2008-2018 EDF R&D
95
96     This library is free software; you can redistribute it and/or
97     modify it under the terms of the GNU Lesser General Public
98     License as published by the Free Software Foundation; either
99     version 2.1 of the License, or (at your option) any later version.
100
101     This library is distributed in the hope that it will be useful,
102     but WITHOUT ANY WARRANTY; without even the implied warranty of
103     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
104     Lesser General Public License for more details.
105
106     You should have received a copy of the GNU Lesser General Public
107     License along with this library; if not, write to the Free Software
108     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
109
110     See http://www.salome-platform.org/
111
112 In addition, we require that all publication or presentation describing
113 work using this software, or all commercial or not products using it,
114 quote at least one of the references given below:
115
116     * ADAO, a module for Data Assimilation and Optimization,
117       http://www.salome-platform.org/
118
119     * SALOME The Open Source Integration Platform for Numerical Simulation,
120       http://www.salome-platform.org/
121
122 The documentation of the module is also covered by the license and the
123 requirement of quoting.
124 """
125
126 import os, sys, logging
127 sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
128
129 from daCore.version import name, version, year, date
130 try:
131     from daYacsIntegration.daOptimizerLoop import *
132 except:
133     logging.debug("INIT Pas de chargement initial de daOptimizerLoop")