From 4b71225a33129486c2970e21ed47fbd67dafb2c7 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Sun, 11 Nov 2012 22:32:51 +0100 Subject: [PATCH] Modifying algorithm parameter default for homogeneity --- src/daComposant/daAlgorithms/KalmanFilter.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/daComposant/daAlgorithms/KalmanFilter.py b/src/daComposant/daAlgorithms/KalmanFilter.py index c034e8c..f521066 100644 --- a/src/daComposant/daAlgorithms/KalmanFilter.py +++ b/src/daComposant/daAlgorithms/KalmanFilter.py @@ -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"))) -- 2.39.2