From 6306b7bc68388d4aa39a62946cc4ed2e571278c9 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Thu, 5 Apr 2012 16:42:22 +0200 Subject: [PATCH] Remove temporary KalmanFilter before introducing EvolutionModel in OptLoop for ADAO --- src/daComposant/daAlgorithms/KalmanFilter.py | 102 ------------------ .../daYacsSchemaCreator/infos_daComposant.py | 18 ++-- 2 files changed, 8 insertions(+), 112 deletions(-) delete mode 100644 src/daComposant/daAlgorithms/KalmanFilter.py diff --git a/src/daComposant/daAlgorithms/KalmanFilter.py b/src/daComposant/daAlgorithms/KalmanFilter.py deleted file mode 100644 index 683ac66..0000000 --- a/src/daComposant/daAlgorithms/KalmanFilter.py +++ /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' diff --git a/src/daSalome/daYacsSchemaCreator/infos_daComposant.py b/src/daSalome/daYacsSchemaCreator/infos_daComposant.py index 44ee9c1..16b8625 100644 --- a/src/daSalome/daYacsSchemaCreator/infos_daComposant.py +++ b/src/daSalome/daYacsSchemaCreator/infos_daComposant.py @@ -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 -- 2.39.2