]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Modifying algorithm parameter default for homogeneity
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Sun, 11 Nov 2012 21:32:51 +0000 (22:32 +0100)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Sun, 11 Nov 2012 21:32:51 +0000 (22:32 +0100)
src/daComposant/daAlgorithms/KalmanFilter.py

index c034e8c824a36b47a8cb77166a5f2732acd1799d..f52106652dd247431766c6a296a8cdace9a69839 100644 (file)
@@ -29,10 +29,11 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
     def __init__(self):
         BasicObjects.Algorithm.__init__(self, "KALMANFILTER")
         self.defineRequiredParameter(
-            name     = "CalculateAPosterioriCovariance",
-            default  = False,
-            typecast = bool,
-            message  = "Calcul de la covariance a posteriori",
+            name     = "StoreSupplementaryCalculations",
+            default  = [],
+            typecast = tuple,
+            message  = "Liste de calculs supplémentaires à stocker et/ou effectuer",
+            listval  = ["APosterioriCovariance", "Innovation"]
             )
 
     def run(self, Xb=None, Y=None, H=None, M=None, R=None, B=None, Q=None, Parameters=None):
@@ -67,7 +68,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         Xn = Xb
         Pn = B
         self.StoredVariables["Analysis"].store( Xn.A1 )
-        if self._parameters["CalculateAPosterioriCovariance"]:
+        if "APosterioriCovariance" in self._parameters["StoreSupplementaryCalculations"]:
             self.StoredVariables["APosterioriCovariance"].store( Pn )
         #
         for step in range(duration-1):
@@ -80,8 +81,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             Pn = Pn_predicted - K * Hm * Pn_predicted
             #
             self.StoredVariables["Analysis"].store( Xn.A1 )
-            self.StoredVariables["Innovation"].store( d.A1 )
-            if self._parameters["CalculateAPosterioriCovariance"]:
+            if "Innovation" in self._parameters["StoreSupplementaryCalculations"]:
+                self.StoredVariables["Innovation"].store( numpy.ravel( d.A1 ) )
+            if "APosterioriCovariance" in self._parameters["StoreSupplementaryCalculations"]:
                 self.StoredVariables["APosterioriCovariance"].store( Pn )
         #
         logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("M")))