From 502bf026f63ceeb240b79892148a28ccb9a67ca3 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Wed, 24 Sep 2014 10:01:21 +0200 Subject: [PATCH] Minor documentation and source improvements --- doc/en/ref_algorithm_SamplingTest.rst | 13 +++- doc/fr/ref_algorithm_SamplingTest.rst | 13 +++- src/daComposant/daAlgorithms/3DVAR.py | 4 +- .../daAlgorithms/ExtendedKalmanFilter.py | 4 +- src/daComposant/daCore/AssimilationStudy.py | 65 ++++++++++--------- 5 files changed, 58 insertions(+), 41 deletions(-) diff --git a/doc/en/ref_algorithm_SamplingTest.rst b/doc/en/ref_algorithm_SamplingTest.rst index d29e58a..31c2e36 100644 --- a/doc/en/ref_algorithm_SamplingTest.rst +++ b/doc/en/ref_algorithm_SamplingTest.rst @@ -41,9 +41,12 @@ particular, to the state :math:`\mathbf{x}` variations. When a state is not observable, a *"NaN"* value is returned. The sampling of the states :math:`\mathbf{x}` can be given explicitly or under -the form of hyper-cubes, explicit or sampled. Be careful to the size of the -hyper-cube (and then to the number of calculations) that can be reached, it can -be big very quickly. +the form of hyper-cubes, explicit or sampled using classic distributions. Be +careful to the size of the hyper-cube (and then to the number of calculations) +that can be reached, it can be big very quickly. + +To perform distributed or complex sampling, see other modules available in +SALOME : PARAMETRIC or OPENTURNS. Optional and required commands ++++++++++++++++++++++++++++++ @@ -179,3 +182,7 @@ See also References to other sections: - :ref:`section_ref_algorithm_FunctionTest` + +References to other SALOME modules: + - PARAMETRIC, see the *User guide of PARAMETRIC module* in the main "*Help*" menu of SALOME platform + - OPENTURNS, see the *User guide of OPENTURNS module* in the main "*Help*" menu of SALOME platform diff --git a/doc/fr/ref_algorithm_SamplingTest.rst b/doc/fr/ref_algorithm_SamplingTest.rst index 73c0dd0..d3ed4fa 100644 --- a/doc/fr/ref_algorithm_SamplingTest.rst +++ b/doc/fr/ref_algorithm_SamplingTest.rst @@ -42,9 +42,12 @@ particulier, aux variations de l' pas observable, une valeur *"NaN"* est retournée. L'échantillon des états :math:`\mathbf{x}` peut être fourni explicitement ou -sous la forme d'hyper-cubes, explicites ou échantillonnés. Attention à la taille -de l'hyper-cube (et donc au nombre de calculs) qu'il est possible d'atteindre, -elle peut rapidement devenir importante. +sous la forme d'hyper-cubes, explicites ou échantillonnés selon des lois +courantes. Attention à la taille de l'hyper-cube (et donc au nombre de calculs) +qu'il est possible d'atteindre, elle peut rapidement devenir importante. + +Pour effectuer un échantillonage distribué ou plus complexe, voir d'autres +modules disponibles dans SALOME : PARAMETRIC ou OPENTURNS. Commandes requises et optionnelles ++++++++++++++++++++++++++++++++++ @@ -186,3 +189,7 @@ Voir aussi Références vers d'autres sections : - :ref:`section_ref_algorithm_FunctionTest` + +Références vers d'autres modules SALOME : + - PARAMETRIC, voir le *Guide utilisateur du module PARAMETRIC* dans le menu principal *Aide* de l'environnement SALOME + - OPENTURNS, voir le *Guide utilisateur du module OPENTURNS* dans le menu principal *Aide* de l'environnement SALOME diff --git a/src/daComposant/daAlgorithms/3DVAR.py b/src/daComposant/daAlgorithms/3DVAR.py index 313e1b5..3be52c8 100644 --- a/src/daComposant/daAlgorithms/3DVAR.py +++ b/src/daComposant/daAlgorithms/3DVAR.py @@ -123,8 +123,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): if self._parameters.has_key("Minimizer") == "TNC": self.setParameterValue("StoreInternalVariables",True) # - # Opérateur d'observation - # ----------------------- + # Opérateurs + # ---------- Hm = HO["Direct"].appliedTo Ha = HO["Adjoint"].appliedInXTo # diff --git a/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py b/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py index c9256d2..b7a0c59 100644 --- a/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py +++ b/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py @@ -88,8 +88,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): else: Cm = None # - # Nombre de pas du Kalman identique au nombre de pas d'observations - # ----------------------------------------------------------------- + # Nombre de pas identique au nombre de pas d'observations + # ------------------------------------------------------- if hasattr(Y,"stepnumber"): duration = Y.stepnumber() else: diff --git a/src/daComposant/daCore/AssimilationStudy.py b/src/daComposant/daCore/AssimilationStudy.py index d06f402..c981715 100644 --- a/src/daComposant/daCore/AssimilationStudy.py +++ b/src/daComposant/daCore/AssimilationStudy.py @@ -231,6 +231,7 @@ class AssimilationStudy: asMatrix = None, appliedToX = None, toBeStored = False, + avoidRC = True, ): """ Permet de définir un opérateur d'observation H. L'ordre de priorité des @@ -291,23 +292,23 @@ class AssimilationStudy: mpEnabled = asFunction["withmpEnabled"], mpWorkers = asFunction["withmpWorkers"], ) - self.__HO["Direct"] = Operator( fromMethod = FDA.DirectOperator ) - self.__HO["Tangent"] = Operator( fromMethod = FDA.TangentOperator ) - self.__HO["Adjoint"] = Operator( fromMethod = FDA.AdjointOperator ) + self.__HO["Direct"] = Operator( fromMethod = FDA.DirectOperator, avoidingRedundancy = avoidRC ) + self.__HO["Tangent"] = Operator( fromMethod = FDA.TangentOperator, avoidingRedundancy = avoidRC ) + self.__HO["Adjoint"] = Operator( fromMethod = FDA.AdjointOperator, avoidingRedundancy = avoidRC ) elif (type(asFunction) is type({})) and \ asFunction.has_key("Tangent") and asFunction.has_key("Adjoint") and \ (asFunction["Tangent"] is not None) and (asFunction["Adjoint"] is not None): if not asFunction.has_key("Direct") or (asFunction["Direct"] is None): - self.__HO["Direct"] = Operator( fromMethod = asFunction["Tangent"] ) + self.__HO["Direct"] = Operator( fromMethod = asFunction["Tangent"], avoidingRedundancy = avoidRC ) else: - self.__HO["Direct"] = Operator( fromMethod = asFunction["Direct"] ) - self.__HO["Tangent"] = Operator( fromMethod = asFunction["Tangent"] ) - self.__HO["Adjoint"] = Operator( fromMethod = asFunction["Adjoint"] ) + self.__HO["Direct"] = Operator( fromMethod = asFunction["Direct"], avoidingRedundancy = avoidRC ) + self.__HO["Tangent"] = Operator( fromMethod = asFunction["Tangent"], avoidingRedundancy = avoidRC ) + self.__HO["Adjoint"] = Operator( fromMethod = asFunction["Adjoint"], avoidingRedundancy = avoidRC ) elif asMatrix is not None: matrice = numpy.matrix( asMatrix, numpy.float ) - self.__HO["Direct"] = Operator( fromMatrix = matrice ) - self.__HO["Tangent"] = Operator( fromMatrix = matrice ) - self.__HO["Adjoint"] = Operator( fromMatrix = matrice.T ) + self.__HO["Direct"] = Operator( fromMatrix = matrice, avoidingRedundancy = avoidRC ) + self.__HO["Tangent"] = Operator( fromMatrix = matrice, avoidingRedundancy = avoidRC ) + self.__HO["Adjoint"] = Operator( fromMatrix = matrice.T, avoidingRedundancy = avoidRC ) del matrice else: raise ValueError("Improperly defined observation operator, it requires at minima either a matrix, a Direct for approximate derivatives or a Tangent/Adjoint pair.") @@ -338,6 +339,7 @@ class AssimilationStudy: asMatrix = None, Scheduler = None, toBeStored = False, + avoidRC = True, ): """ Permet de définir un opérateur d'évolution M. L'ordre de priorité des @@ -394,23 +396,23 @@ class AssimilationStudy: mpEnabled = asFunction["withmpEnabled"], mpWorkers = asFunction["withmpWorkers"], ) - self.__EM["Direct"] = Operator( fromMethod = FDA.DirectOperator ) - self.__EM["Tangent"] = Operator( fromMethod = FDA.TangentOperator ) - self.__EM["Adjoint"] = Operator( fromMethod = FDA.AdjointOperator ) + self.__EM["Direct"] = Operator( fromMethod = FDA.DirectOperator, avoidingRedundancy = avoidRC ) + self.__EM["Tangent"] = Operator( fromMethod = FDA.TangentOperator, avoidingRedundancy = avoidRC ) + self.__EM["Adjoint"] = Operator( fromMethod = FDA.AdjointOperator, avoidingRedundancy = avoidRC ) elif (type(asFunction) is type({})) and \ asFunction.has_key("Tangent") and asFunction.has_key("Adjoint") and \ (asFunction["Tangent"] is not None) and (asFunction["Adjoint"] is not None): if not asFunction.has_key("Direct") or (asFunction["Direct"] is None): - self.__EM["Direct"] = Operator( fromMethod = asFunction["Tangent"] ) + self.__EM["Direct"] = Operator( fromMethod = asFunction["Tangent"], avoidingRedundancy = avoidRC ) else: - self.__EM["Direct"] = Operator( fromMethod = asFunction["Direct"] ) - self.__EM["Tangent"] = Operator( fromMethod = asFunction["Tangent"] ) - self.__EM["Adjoint"] = Operator( fromMethod = asFunction["Adjoint"] ) + self.__EM["Direct"] = Operator( fromMethod = asFunction["Direct"], avoidingRedundancy = avoidRC ) + self.__EM["Tangent"] = Operator( fromMethod = asFunction["Tangent"], avoidingRedundancy = avoidRC ) + self.__EM["Adjoint"] = Operator( fromMethod = asFunction["Adjoint"], avoidingRedundancy = avoidRC ) elif asMatrix is not None: matrice = numpy.matrix( asMatrix, numpy.float ) - self.__EM["Direct"] = Operator( fromMatrix = matrice ) - self.__EM["Tangent"] = Operator( fromMatrix = matrice ) - self.__EM["Adjoint"] = Operator( fromMatrix = matrice.T ) + self.__EM["Direct"] = Operator( fromMatrix = matrice, avoidingRedundancy = avoidRC ) + self.__EM["Tangent"] = Operator( fromMatrix = matrice, avoidingRedundancy = avoidRC ) + self.__EM["Adjoint"] = Operator( fromMatrix = matrice.T, avoidingRedundancy = avoidRC ) del matrice else: raise ValueError("Improperly defined evolution model, it requires at minima either a matrix, a Direct for approximate derivatives or a Tangent/Adjoint pair.") @@ -439,7 +441,7 @@ class AssimilationStudy: être rendue disponible au même titre que les variables de calcul """ self.__Q = Covariance( - name = "ObservationError", + name = "EvolutionError", asCovariance = asCovariance, asEyeByScalar = asEyeByScalar, asEyeByVector = asEyeByVector, @@ -459,6 +461,7 @@ class AssimilationStudy: asMatrix = None, Scheduler = None, toBeStored = False, + avoidRC = True, ): """ Permet de définir un opérateur de controle C. L'ordre de priorité des @@ -491,23 +494,23 @@ class AssimilationStudy: centeredDF = asFunction["withCenteredDF"], increment = asFunction["withIncrement"], dX = asFunction["withdX"] ) - self.__CM["Direct"] = Operator( fromMethod = FDA.DirectOperator ) - self.__CM["Tangent"] = Operator( fromMethod = FDA.TangentOperator ) - self.__CM["Adjoint"] = Operator( fromMethod = FDA.AdjointOperator ) + self.__CM["Direct"] = Operator( fromMethod = FDA.DirectOperator, avoidingRedundancy = avoidRC ) + self.__CM["Tangent"] = Operator( fromMethod = FDA.TangentOperator, avoidingRedundancy = avoidRC ) + self.__CM["Adjoint"] = Operator( fromMethod = FDA.AdjointOperator, avoidingRedundancy = avoidRC ) elif (type(asFunction) is type({})) and \ asFunction.has_key("Tangent") and asFunction.has_key("Adjoint") and \ (asFunction["Tangent"] is not None) and (asFunction["Adjoint"] is not None): if not asFunction.has_key("Direct") or (asFunction["Direct"] is None): - self.__CM["Direct"] = Operator( fromMethod = asFunction["Tangent"] ) + self.__CM["Direct"] = Operator( fromMethod = asFunction["Tangent"], avoidingRedundancy = avoidRC ) else: - self.__CM["Direct"] = Operator( fromMethod = asFunction["Direct"] ) - self.__CM["Tangent"] = Operator( fromMethod = asFunction["Tangent"] ) - self.__CM["Adjoint"] = Operator( fromMethod = asFunction["Adjoint"] ) + self.__CM["Direct"] = Operator( fromMethod = asFunction["Direct"], avoidingRedundancy = avoidRC ) + self.__CM["Tangent"] = Operator( fromMethod = asFunction["Tangent"], avoidingRedundancy = avoidRC ) + self.__CM["Adjoint"] = Operator( fromMethod = asFunction["Adjoint"], avoidingRedundancy = avoidRC ) elif asMatrix is not None: matrice = numpy.matrix( asMatrix, numpy.float ) - self.__CM["Direct"] = Operator( fromMatrix = matrice ) - self.__CM["Tangent"] = Operator( fromMatrix = matrice ) - self.__CM["Adjoint"] = Operator( fromMatrix = matrice.T ) + self.__CM["Direct"] = Operator( fromMatrix = matrice, avoidingRedundancy = avoidRC ) + self.__CM["Tangent"] = Operator( fromMatrix = matrice, avoidingRedundancy = avoidRC ) + self.__CM["Adjoint"] = Operator( fromMatrix = matrice.T, avoidingRedundancy = avoidRC ) del matrice else: raise ValueError("Improperly defined input control model, it requires at minima either a matrix, a Direct for approximate derivatives or a Tangent/Adjoint pair.") -- 2.39.2