Notations and common conventions
================================
+.. index:: single: File (naming)
+.. index:: single: File (type)
+
In all this documentation, we use standard notations of linear algebra, data
assimilation (as described in [Ide97]_) and optimization.
-For algebraic formulations, vectors are written horizontally or vertically
-without making a difference. Matrices are written either normally, or with a
-condensed notation, consisting in the use of a space to separate the values,
-and a "``;``" to separate the rows of the matrix, in a continuous line.
+For algebraic formulations, **vectors** are written horizontally or vertically
+without making a difference. **Matrices** can be written either normally as a
+serie of number series, either in text condensed notation, consisting in the
+use of a space to separate the values, and a "``;``" to separate the rows of
+the matrix, in a continuous line.
-Files can be indicated by an absolute or relative path. For some old or shared
-file systems, the full name with the path must not contain more than 256
-characters. In the case of Python files, it is advisable not to use dots in the
-name apart for the extension, to prevent difficulties in using it that are
-complicated to diagnose.
+**Files** can be indicated by an absolute or relative path. For some old or
+shared file systems, the full name, including the path, must not contain more
+than 256 characters. In the case of Python files, it is advisable not to use
+dots in the name apart for the extension, to prevent difficulties in using it
+that are then complicated to diagnose.
-File type and naming conventions rely heavily on the extensions of the files
-themselves. Some of them are briefly specified here, without being exhaustive:
+**File type and naming conventions** rely heavily on the extensions of the
+files themselves. Some of them are briefly specified here, without being
+exhaustive:
-- extension ``.py`` : data or commands text file of Python source type
+- extension ``.py`` : data or commands text file of Python type
- extension ``.comm`` : commands text file of ADAO EFICAS type
- extension ``.xml`` : data text file of XML type or commands (for YACS, not exclusive)
- extension ``.txt`` : data text file with space separator
- extension ``.npz`` : data binary file of type Numpy multi-variables
- extension ``.sdf`` : data binary file of type Scientific Data Format
+For the use of some of these files, one can refer to the keyword "*DataFile*"
+as :ref:`section_ref_entry_types_info`.
+
.. ------------------------------------ ..
.. include:: snippets/Header2Algo07.rst
take :math:`\mathbf{dx}_0=Normal(0,\mathbf{x})` and
:math:`\mathbf{dx}=\alpha_0*\mathbf{dx}_0` with :math:`\alpha_0` a scaling user
parameter, defaulting to 1. :math:`F` is the computational operator or code
-(which is here acquired by the observation operator command
+(which is here defined by the observation operator command
"*ObservationOperator*").
One can observe the following residue, which is the difference of two scalar
This algorithm allows to verify that a given operator :math:`F`, in particular
the observation one, is working correctly and that its call is compatible with
its usage in ADAO algorithms. In practice, it allows to call one or several
-times the operator, activating or not the "debug" mode during execution.
+times the operator, activating or not the "debug" mode during execution. The
+:math:`F` operator is considered to depend on the vector variable
+:math:`\mathbf{x}`.
Statistics on input and output vectors for each execution of operator are
given, and an another global statistic is given at the end of the checking
"CurrentState",
"EnsembleOfSimulations",
"EnsembleOfStates",
+ "Innovation",
"InnovationAtCurrentState",
"SimulatedObservationAtCurrentState",
].
.. include:: snippets/EnsembleOfStates.rst
+.. include:: snippets/Innovation.rst
+
.. include:: snippets/InnovationAtCurrentState.rst
.. include:: snippets/SimulatedObservationAtCurrentState.rst
Pa = case.get("APosterioriCovariance")
#
print("")
-print(" Final a posteriori variance:",Pa[-1])
+print(" Final a posteriori variance:", Pa[-1])
print("")
#
#-------------------------------------------------------------------------------
Here is a very simple use of the given algorithm and its parameters, written in
:ref:`section_tui`, and from which input information allow to define an
-equivalent cas in graphical interface.
+equivalent case in graphical user interface.
:header: "Tool", "Minimal version", "Reached version"
:widths: 20, 10, 10
- Python, 3.6.5, 3.10.8
- Numpy, 1.14.3, 1.24.1
+ Python, 3.6.5, 3.10.9
+ Numpy, 1.14.3, 1.24.2
Scipy, 1.1.0, 1.10.0
MatplotLib, 2.2.2, 3.6.3
GnuplotPy, 1.8, 1.8
particulier celui d'observation, fonctionne correctement et que son appel se
déroule de manière compatible avec son usage dans les algorithmes d'ADAO. De
manière pratique, il permet d'appeler une ou plusieurs fois l'opérateur, en
-activant ou non le mode "debug" lors de l'exécution.
+activant ou non le mode "debug" lors de l'exécution. L'opérateur :math:`F` est
+considéré comme dépendant d'une variable vectorielle :math:`\mathbf{x}`.
Une statistique sur les vecteurs en entrée et en sortie de chaque exécution de
l'opérateur est indiquée, et une autre globale est fournie de manière
#. Dans son usage le plus simple, si l'ensemble des vecteurs d'état est
pré-existant, il suffit de le fournir par l'option "*EnsembleOfSnapshots*"
- d'algorithme. C'est par exemple le cas l'ensemble des états a été généré par
- un :ref:`section_ref_algorithm_EnsembleOfSimulationGenerationTask`.
+ d'algorithme. C'est par exemple le cas si l'ensemble des états a été généré
+ par un :ref:`section_ref_algorithm_EnsembleOfSimulationGenerationTask`.
#. Si l'ensemble des vecteurs d'état doit être obtenu par des simulations au
cours de l'algorithme, alors on doit fournir l'opérateur de simulation ou
d'observation :math:`H` et le plan d'expérience de l'espace des états
"CurrentState",
"EnsembleOfSimulations",
"EnsembleOfStates",
+ "Innovation",
"InnovationAtCurrentState",
"SimulatedObservationAtCurrentState",
].
.. include:: snippets/EnsembleOfStates.rst
+.. include:: snippets/Innovation.rst
+
.. include:: snippets/InnovationAtCurrentState.rst
.. include:: snippets/SimulatedObservationAtCurrentState.rst
Pa = case.get("APosterioriCovariance")
#
print("")
-print(" Variance a posteriori finale :",Pa[-1])
+print(" Variance a posteriori finale :", Pa[-1])
print("")
#
#-------------------------------------------------------------------------------
:header: "Outil", "Version minimale", "Version atteinte"
:widths: 20, 10, 10
- Python, 3.6.5, 3.10.8
- Numpy, 1.14.3, 1.24.1
+ Python, 3.6.5, 3.10.9
+ Numpy, 1.14.3, 1.24.2
Scipy, 1.1.0, 1.10.0
MatplotLib, 2.2.2, 3.6.3
GnuplotPy, 1.8, 1.8
HXb = Ht @ Xb
HXb = numpy.ravel( HXb ).reshape((-1,1))
if Y.size != HXb.size:
- raise ValueError("The size %i of observations Y and %i of observed calculation H(X) are different, they have to be identical."%(Y.size,HXb.size))
+ raise ValueError("The size %i of observations Yobs and %i of observed calculation F(X) are different, they have to be identical."%(Y.size,HXb.size))
if max(Y.shape) != max(HXb.shape):
- raise ValueError("The shapes %s of observations Y and %s of observed calculation H(X) are different, they have to be identical."%(Y.shape,HXb.shape))
+ raise ValueError("The shapes %s of observations Yobs and %s of observed calculation F(X) are different, they have to be identical."%(Y.shape,HXb.shape))
self.StoredVariables["SimulatedObservationAtCurrentState"].store( HXb )
#
self._post_run(HO)
# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
import numpy, logging
-from daCore import BasicObjects, NumericObjects
+from daCore import BasicObjects, NumericObjects, PlatformInfo
from daAlgorithms.Atoms import eosg
-from daCore.PlatformInfo import PlatformInfo
-mfp = PlatformInfo().MaximumPrecision()
+mfp = PlatformInfo.PlatformInfo().MaximumPrecision()
# ==============================================================================
class ElementaryAlgorithm(BasicObjects.Algorithm):
"CurrentState",
"EnsembleOfSimulations",
"EnsembleOfStates",
+ "Innovation",
"InnovationAtCurrentState",
"SimulatedObservationAtCurrentState",
]
Jo = numpy.max( numpy.abs(_Innovation) )
#
J = Jb + Jo
+ if self._toStore("Innovation"):
+ self.StoredVariables["Innovation"].store( _Innovation )
if self._toStore("CurrentState"):
self.StoredVariables["CurrentState"].store( _X )
if self._toStore("InnovationAtCurrentState"):
except Exception:
raise KeyError(msg)
- def run(self, Xb=None, Y=None, H=None, M=None, R=None, B=None, Q=None, Parameters=None):
+ def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None):
"""
Doit implémenter l'opération élémentaire de calcul algorithmique.
"""
__msg += "\n%s%30s : %s" %(__prefix,"sys.executable",sys.executable)
__msg += "\n%s%30s : %s" %(__prefix,"sys.version",sys.version.replace('\n',''))
__msg += "\n%s%30s : %s" %(__prefix,"sys.getfilesystemencoding",str(sys.getfilesystemencoding()))
- __msg += "\n%s%30s : %s" %(__prefix,"locale.getdefaultlocale",str(locale.getdefaultlocale()))
+ if sys.version_info.major == 3 and sys.version_info.minor < 11: # Python 3.10
+ __msg += "\n%s%30s : %s" %(__prefix,"locale.getdefaultlocale",str(locale.getdefaultlocale()))
+ else:
+ __msg += "\n%s%30s : %s" %(__prefix,"locale.getlocale",str(locale.getlocale()))
__msg += "\n"
__msg += "\n%s%30s : %s" %(__prefix,"os.cpu_count",os.cpu_count())
if hasattr(os, 'sched_getaffinity'):