2 Copyright (C) 2008-2018 EDF R&D
4 This file is part of SALOME ADAO module.
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.
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.
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
20 See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
24 .. _section_ref_output_variables:
26 Variables and informations available at the output
27 --------------------------------------------------
29 How to obtain the information available at the output
30 +++++++++++++++++++++++++++++++++++++++++++++++++++++
32 .. index:: single: UserPostAnalysis
33 .. index:: single: algoResults
34 .. index:: single: getResults
35 .. index:: single: get
36 .. index:: single: ADD
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.
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):
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()``.
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`.
57 For example, to have the optimal state after a data assimilation or optimization
58 calculation, one use the following call::
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).
67 .. _subsection_r_o_v_Template:
69 Examples of Python scripts to obtain or treat the outputs
70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
72 .. index:: single: Template
73 .. index:: single: AnalysisPrinter
74 .. index:: single: AnalysisSaver
75 .. index:: single: AnalysisPrinterAndSaver
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.
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::
93 xa=numpy.ravel(ADD.get('Analysis')[-1])
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
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::
105 xa=numpy.ravel(ADD.get('Analysis')[-1])
106 f='/tmp/analysis.txt'
107 print 'Analysis saved in "%s"'%f
110 The chosen recording file is a text one named ``/tmp/analysis.txt``.
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::
118 xa=numpy.ravel(ADD.get('Analysis')[-1])
120 f='/tmp/analysis.txt'
121 print 'Analysis saved in "%s"'%f
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
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`.
133 Cross compliance of the information available at the output
134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
136 .. index:: single: AlgorithmParameters
137 .. index:: single: Stored
139 The availability of information after the calculation is conditioned by the fact
140 that they have been calculated or requested.
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.
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.
156 .. _subsection_r_o_v_Inventaire:
158 Inventory of potentially available information at the output
159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
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.
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
169 .. include:: snippets/Analysis.rst
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.
177 .. include:: snippets/Background.rst
179 .. include:: snippets/BackgroundError.rst
181 .. include:: snippets/EvolutionError.rst
183 .. include:: snippets/Observation.rst
185 .. include:: snippets/ObservationError.rst
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:
190 .. include:: snippets/APosterioriCorrelations.rst
192 .. include:: snippets/APosterioriCovariance.rst
194 .. include:: snippets/APosterioriStandardDeviations.rst
196 .. include:: snippets/APosterioriVariances.rst
198 .. include:: snippets/BMA.rst
200 .. include:: snippets/CostFunctionJ.rst
202 .. include:: snippets/CostFunctionJb.rst
204 .. include:: snippets/CostFunctionJo.rst
206 .. include:: snippets/CostFunctionJAtCurrentOptimum.rst
208 .. include:: snippets/CostFunctionJbAtCurrentOptimum.rst
210 .. include:: snippets/CostFunctionJoAtCurrentOptimum.rst
212 .. include:: snippets/CurrentOptimum.rst
214 .. include:: snippets/CurrentState.rst
216 .. include:: snippets/IndexOfOptimum.rst
218 .. include:: snippets/Innovation.rst
220 .. include:: snippets/InnovationAtCurrentState.rst
222 .. include:: snippets/OMA.rst
224 .. include:: snippets/OMB.rst
226 .. include:: snippets/Residu.rst
228 .. include:: snippets/SimulatedObservationAtBackground.rst
230 .. include:: snippets/SimulatedObservationAtCurrentOptimum.rst
232 .. include:: snippets/SimulatedObservationAtCurrentState.rst
234 .. include:: snippets/SimulatedObservationAtOptimum.rst
236 .. include:: snippets/SimulationQuantiles.rst
238 .. [#] For more information on PARAVIS, see the *PARAVIS module* and its integrated help available from the main menu *Help* of the SALOME platform.
240 .. [#] For more information on YACS, see the *YACS module* and its integrated help available from the main menu *Help* of the SALOME platform.