Salome HOME
Remove temporary KalmanFilter before introducing EvolutionModel in OptLoop for ADAO
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Thu, 5 Apr 2012 14:42:22 +0000 (16:42 +0200)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Thu, 5 Apr 2012 14:42:22 +0000 (16:42 +0200)
src/daComposant/daAlgorithms/KalmanFilter.py [deleted file]
src/daSalome/daYacsSchemaCreator/infos_daComposant.py

diff --git a/src/daComposant/daAlgorithms/KalmanFilter.py b/src/daComposant/daAlgorithms/KalmanFilter.py
deleted file mode 100644 (file)
index 683ac66..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-#-*-coding:iso-8859-1-*-
-#
-#  Copyright (C) 2008-2012 EDF R&D
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-import logging
-from daCore import BasicObjects, PlatformInfo
-m = PlatformInfo.SystemUsage()
-
-# ==============================================================================
-class ElementaryAlgorithm(BasicObjects.Algorithm):
-    def __init__(self):
-        BasicObjects.Algorithm.__init__(self)
-        self._name = "KALMANFILTER"
-        logging.debug("%s Initialisation"%self._name)
-
-    def run(self, Xb=None, Y=None, H=None, M=None, R=None, B=None, Q=None, Parameters=None):
-        """
-        Calcul de l'estimateur du filtre de Kalman
-
-        Remarque : les observations sont exploitées à partir du pas de temps 1,
-        et sont utilisées dans Yo comme rangées selon ces indices. Donc le pas 0
-        n'est pas utilisé puisque la première étape de Kalman passe de 0 à 1
-        avec l'observation du pas 1.
-        """
-        logging.debug("%s Lancement"%self._name)
-        logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("Mo")))
-        #
-        # Opérateur d'observation
-        # -----------------------
-        Hm = H["Direct"].asMatrix()
-        Ht = H["Adjoint"].asMatrix()
-        #
-        # Opérateur d'évolution
-        # ---------------------
-        Mm = M["Direct"].asMatrix()
-        Mt = M["Adjoint"].asMatrix()
-        #
-        # Paramètres de pilotage
-        # ----------------------
-        if Parameters.has_key("CalculateAPosterioriCovariance"):
-            CalculateAPosterioriCovariance = bool(Parameters["CalculateAPosterioriCovariance"])
-        else:
-            CalculateAPosterioriCovariance = False
-        logging.debug("%s Calcul de la covariance a posteriori = %s"%(self._name, CalculateAPosterioriCovariance))
-        #
-        # Nombre de pas du Kalman identique au nombre de pas d'observations
-        # -----------------------------------------------------------------
-        duration = Y.stepnumber()
-        #
-        # Initialisation
-        # --------------
-        Xn = Xb
-        Pn = B
-        self.StoredVariables["Analysis"].store( Xn.A1 )
-        if CalculateAPosterioriCovariance:
-            self.StoredVariables["APosterioriCovariance"].store( Pn )
-        #
-        for step in range(duration-1):
-            logging.debug("%s Etape de Kalman %i (i.e. %i->%i) sur un total de %i"%(self._name, step+1, step,step+1, duration-1))
-            #
-            # Etape de prédiction
-            # -------------------
-            Xn_predicted = Mm * Xn
-            Pn_predicted = Mm * Pn * Mt + Q
-            #
-            # Etape de correction
-            # -------------------
-            d  = Y.valueserie(step+1) - Hm * Xn_predicted
-            K  = Pn_predicted * Ht * (Hm * Pn_predicted * Ht + R).I
-            Xn = Xn_predicted + K * d
-            Pn = Pn_predicted - K * Hm * Pn_predicted
-            #
-            self.StoredVariables["Analysis"].store( Xn.A1 )
-            self.StoredVariables["Innovation"].store( d.A1 )
-            if CalculateAPosterioriCovariance:
-                self.StoredVariables["APosterioriCovariance"].store( Pn )
-        #
-        logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("Mo")))
-        logging.debug("%s Terminé"%self._name)
-        #
-        return 0
-
-# ==============================================================================
-if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
index 44ee9c10154cbd1ad22fe58b1eef562328bde993..16b8625e2d7724bc03f61a54c74c64d4067e7855 100644 (file)
@@ -54,7 +54,7 @@ AssimAlgos = [
     "3DVAR",
     "Blue",
     "EnsembleBlue",
-    "KalmanFilter",
+#     "KalmanFilter", # Removed because EvolutionModel must be available in OptLoop
     "LinearLeastSquares",
     "NonLinearLeastSquares",
     ]
@@ -75,12 +75,12 @@ AlgoDataRequirements["EnsembleBlue"] = [
     "Observation", "ObservationError",
     "ObservationOperator",
     ]
-AlgoDataRequirements["KalmanFilter"] = [
-    "Background", "BackgroundError",
-    "Observation", "ObservationError",
-    "EvolutionModel", "EvolutionError",
-    "ObservationOperator",
-    ]
+AlgoDataRequirements["KalmanFilter"] = [
+    "Background", "BackgroundError",
+    "Observation", "ObservationError",
+    "EvolutionModel", "EvolutionError",
+    "ObservationOperator",
+    ]
 AlgoDataRequirements["LinearLeastSquares"] = [
     "Observation", "ObservationError",
     "ObservationOperator",
@@ -94,11 +94,9 @@ AlgoType = {}
 AlgoType["3DVAR"] = "Optim"
 AlgoType["Blue"] = "Optim"
 AlgoType["EnsembleBlue"] = "Optim"
-AlgoType["KalmanFilter"] = "Optim"
+AlgoType["KalmanFilter"] = "Optim"
 AlgoType["LinearLeastSquares"] = "Optim"
 AlgoType["NonLinearLeastSquares"] = "Optim"
-#AlgoType["Blue"] = "Direct"
-
 
 # Variables qui sont partages avec le generateur de
 # catalogue Eficas