]> SALOME platform Git repositories - modules/adao.git/blob - doc/en/ref_output_variables.rst
Salome HOME
Documentation minor correction
[modules/adao.git] / doc / en / ref_output_variables.rst
1 ..
2    Copyright (C) 2008-2018 EDF R&D
3
4    This file is part of SALOME ADAO module.
5
6    This library is free software; you can redistribute it and/or
7    modify it under the terms of the GNU Lesser General Public
8    License as published by the Free Software Foundation; either
9    version 2.1 of the License, or (at your option) any later version.
10
11    This library is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    Lesser General Public License for more details.
15
16    You should have received a copy of the GNU Lesser General Public
17    License along with this library; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19
20    See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21
22    Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
23
24 .. _section_ref_output_variables:
25
26 Variables and informations available at the output
27 --------------------------------------------------
28
29 How to obtain the information available at the output
30 +++++++++++++++++++++++++++++++++++++++++++++++++++++
31
32 .. index:: single: UserPostAnalysis
33 .. index:: single: algoResults
34 .. index:: single: getResults
35 .. index:: single: get
36 .. index:: single: ADD
37
38 At the output, after executing data assimilation, optimization or checking
39 study, there are variables and information originating from the calculation. The
40 obtaining of this information is then carried out in a standardized way using
41 the post-processing step of calculation.
42
43 The step is easily identified by the user into its ADAO definition case (by the
44 keyword "*UserPostAnalysis*") or in its YACS execution scheme (by nodes or
45 blocks located after the calculation block, and graphically connected to the
46 output port "*algoResults*" of the calculation block):
47
48 #. In the case where the user defines the post-processing in his ADAO case, it uses an external script file or commands in the field type "*String*" or "*Template*". The script it provides has a fixed variable "*ADD*" in the namespace.
49 #. In the case where the user defines the post-processing in its YACS scheme by a Python node located after the block of calculation, it should add a input port of type "*pyobj*" named for example "*Study*", graphically connected to the output port "*algoResults*" of the calculation block. The Python post-processing node must then start with ``ADD = Study.getResults()``.
50
51 Templates are given hereafter as :ref:`subsection_r_o_v_Template`. In all cases,
52 the post-processing of the user has in the namespace a variable whose name is
53 "*ADD*", and whose only available method is named ``get``. The arguments of this
54 method are an output information name, as described in the
55 :ref:`subsection_r_o_v_Inventaire`.
56
57 For example, to have the optimal state after a data assimilation or optimization
58 calculation, one use the following call::
59
60     ADD.get("Analysis")
61
62 This call returns a list of values of the requested notion (or, in the case of
63 input variables that are by nature only a unique specimen, the value itself).
64 One can then request a particular item in the list by the standard list commands
65 (especially ``[-1]`` for the last, and ``[:]`` for all items).
66
67 .. _subsection_r_o_v_Template:
68
69 Examples of Python scripts to obtain or treat the outputs
70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
71
72 .. index:: single: Template
73 .. index:: single: AnalysisPrinter
74 .. index:: single: AnalysisSaver
75 .. index:: single: AnalysisPrinterAndSaver
76
77 These examples present Python commands or scripts which allow to obtain or to
78 treat the output of an algorithm run. To help the user, they are directly
79 available in the user interface, when building the ADAO case in the embedded
80 case editor, in the "*Template*" type fields. In an equivalent way, these
81 commands can be integrated in an external user script (and inserted in the ADAO
82 case by a "*Script*" type input) or can exist as a string, including line feeds
83 (and inserted in the ADAO case by a "*String*" type input). Lot of variants can
84 be build from these simple examples, the main objective being to help the user
85 to elaborate the exact procedure he needs in output.
86
87 The first example (named "*AnalysisPrinter*" in the inputs of type
88 "*Template*") consists in printing, in the standard log output, the value of the
89 analysis or the optimal state, noted as :math:`\mathbf{x}^a` in the section
90 :ref:`section_theory`. It is realized by the commands::
91
92     import numpy
93     xa=numpy.ravel(ADD.get('Analysis')[-1])
94     print 'Analysis:',xa"
95
96 The ``numpy.ravel`` function is here to be sure that the ``xa`` variable will
97 contain a real unidimensional vector, whatever the previous computing choices
98 are.
99
100 A second example (named "*AnalysisSaver*" in the inputs of type  "*Template*")
101 consists in saving on file the value of the analysis or the optimal state
102 :math:`\mathbf{x}^a`. It is realized by the commands::
103
104     import numpy
105     xa=numpy.ravel(ADD.get('Analysis')[-1])
106     f='/tmp/analysis.txt'
107     print 'Analysis saved in "%s"'%f
108     numpy.savetxt(f,xa)"
109
110 The chosen recording file is a text one named ``/tmp/analysis.txt``.
111
112 It is easy to combine these two examples by building a third one (named
113 "*AnalysisPrinterAndSaver*" in the inputs of type  "*Template*"). It consists in
114 simultaneously printing in the standard log output and in saving on file the
115 value of :math:`\mathbf{x}^a`. It is realized by the commands::
116
117     import numpy
118     xa=numpy.ravel(ADD.get('Analysis')[-1])
119     print 'Analysis:',xa
120     f='/tmp/analysis.txt'
121     print 'Analysis saved in "%s"'%f
122     numpy.savetxt(f,xa)
123
124 To facilitate these examples extension for user needs, we recall that all the
125 SALOME functions are available at the same level than these commands. The user
126 can for example request for graphical representation with the PARAVIS [#]_ or
127 other modules, for computing operations driven by YACS [#]_ or an another
128 module, etc.
129
130 Other usage examples are also given for :ref:`section_u_step4` of the
131 :ref:`section_using` section, or in part :ref:`section_examples`.
132
133 Cross compliance of the information available at the output
134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
135
136 .. index:: single: AlgorithmParameters
137 .. index:: single: Stored
138
139 The availability of information after the calculation is conditioned by the fact
140 that they have been calculated or requested.
141
142 Each algorithm does not necessarily provide the same information, and not
143 necessarily for example uses the same intermediate quantities. Thus, there is
144 information that are always present such as the optimal state resulting from the
145 calculation. The other information are only present for certain algorithms
146 and/or if they have been requested before the execution of the calculation.
147
148 It is recalled that the user can request additional information during the
149 preparation of its ADAO case, using the optional control "*AlgorithmParameters*" of
150 ADAO case. Reference will be made to the
151 :ref:`section_ref_options_Algorithm_Parameters` for the proper use of this
152 command, and to the description of each algorithm for the information available
153 by algorithm. One can also ask to keep some input information by changing the
154 boolean "* * Stored" associated with it in the edition of the ADAO case.
155
156 .. _subsection_r_o_v_Inventaire:
157
158 Inventory of potentially available information at the output
159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
160
161 The main set of potentially available information at the output is listed here
162 regardless of algorithms, for inventory. One has to look directly to algorithm
163 details to get full inventory.
164
165 The optimal state is an information that is always naturally available after an
166 optimization or a data assimilation calculation. It is indicated by the
167 following keywords:
168
169   .. include:: snippets/Analysis.rst
170
171 The following variables are input variables.  They are made available to the
172 user at the output in order to facilitate the writing of post-processing
173 procedures, and are conditioned by a user request using a boolean "*Stored*"
174 at the input. All these returned input variables can be obtained with the
175 standard command ".get(...)", which return the unique object given on input.
176
177   .. include:: snippets/Background.rst
178
179   .. include:: snippets/BackgroundError.rst
180
181   .. include:: snippets/EvolutionError.rst
182
183   .. include:: snippets/Observation.rst
184
185   .. include:: snippets/ObservationError.rst
186
187 All other information are conditioned by the algorithm and/or the user requests
188 of availability. The main ones are the following, in alphabetical order:
189
190   .. include:: snippets/APosterioriCorrelations.rst
191
192   .. include:: snippets/APosterioriCovariance.rst
193
194   .. include:: snippets/APosterioriStandardDeviations.rst
195
196   .. include:: snippets/APosterioriVariances.rst
197
198   .. include:: snippets/BMA.rst
199
200   .. include:: snippets/CostFunctionJ.rst
201
202   .. include:: snippets/CostFunctionJb.rst
203
204   .. include:: snippets/CostFunctionJo.rst
205
206   .. include:: snippets/CostFunctionJAtCurrentOptimum.rst
207
208   .. include:: snippets/CostFunctionJbAtCurrentOptimum.rst
209
210   .. include:: snippets/CostFunctionJoAtCurrentOptimum.rst
211
212   .. include:: snippets/CurrentOptimum.rst
213
214   .. include:: snippets/CurrentState.rst
215
216   .. include:: snippets/IndexOfOptimum.rst
217
218   .. include:: snippets/Innovation.rst
219
220   .. include:: snippets/InnovationAtCurrentState.rst
221
222   .. include:: snippets/OMA.rst
223
224   .. include:: snippets/OMB.rst
225
226   .. include:: snippets/Residu.rst
227
228   .. include:: snippets/SimulatedObservationAtBackground.rst
229
230   .. include:: snippets/SimulatedObservationAtCurrentOptimum.rst
231
232   .. include:: snippets/SimulatedObservationAtCurrentState.rst
233
234   .. include:: snippets/SimulatedObservationAtOptimum.rst
235
236   .. include:: snippets/SimulationQuantiles.rst
237
238 .. [#] For more information on PARAVIS, see the *PARAVIS module* and its integrated help available from the main menu *Help* of the SALOME platform.
239
240 .. [#] For more information on YACS, see the *YACS module* and its integrated help available from the main menu *Help* of the SALOME platform.