From ac06735bbdbbb40fb7cf1084255da5c7aa3b90dc Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Thu, 13 Mar 2014 20:51:20 +0100 Subject: [PATCH] Improving elementary storage facilities --- src/daComposant/daAlgorithms/3DVAR.py | 2 +- src/daComposant/daAlgorithms/EnsembleBlue.py | 3 +-- src/daComposant/daAlgorithms/ExtendedKalmanFilter.py | 2 +- src/daComposant/daAlgorithms/KalmanFilter.py | 2 +- src/daComposant/daAlgorithms/NonLinearLeastSquares.py | 4 ++-- src/daComposant/daAlgorithms/QuantileRegression.py | 2 +- src/daComposant/daAlgorithms/UnscentedKalmanFilter.py | 2 +- src/daComposant/daCore/Persistence.py | 2 +- 8 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/daComposant/daAlgorithms/3DVAR.py b/src/daComposant/daAlgorithms/3DVAR.py index 1bc5ea6..c6818eb 100644 --- a/src/daComposant/daAlgorithms/3DVAR.py +++ b/src/daComposant/daAlgorithms/3DVAR.py @@ -162,7 +162,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): Jo = 0.5 * (Y - _HX).T * RI * (Y - _HX) J = float( Jb ) + float( Jo ) if self._parameters["StoreInternalVariables"]: - self.StoredVariables["CurrentState"].store( _X.A1 ) + self.StoredVariables["CurrentState"].store( _X ) self.StoredVariables["CostFunctionJb"].store( Jb ) self.StoredVariables["CostFunctionJo"].store( Jo ) self.StoredVariables["CostFunctionJ" ].store( J ) diff --git a/src/daComposant/daAlgorithms/EnsembleBlue.py b/src/daComposant/daAlgorithms/EnsembleBlue.py index bb6831b..8906321 100644 --- a/src/daComposant/daAlgorithms/EnsembleBlue.py +++ b/src/daComposant/daAlgorithms/EnsembleBlue.py @@ -81,8 +81,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): for iens in range(nb_ens): d = EnsembleY[:,iens] - Hm * Xb[iens] Xa = Xb[iens] + K*d - - self.StoredVariables["CurrentState"].store( Xa.A1 ) + self.StoredVariables["CurrentState"].store( Xa ) self.StoredVariables["Innovation"].store( d.A1 ) # # Fabrication de l'analyse diff --git a/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py b/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py index 8db849c..49ae71b 100644 --- a/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py +++ b/src/daComposant/daAlgorithms/ExtendedKalmanFilter.py @@ -177,7 +177,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): Jb = 0.5 * (Xn - Xb).T * BI * (Xn - Xb) Jo = 0.5 * d.T * RI * d J = float( Jb ) + float( Jo ) - self.StoredVariables["CurrentState"].store( Xn.A1 ) + self.StoredVariables["CurrentState"].store( Xn ) self.StoredVariables["CostFunctionJb"].store( Jb ) self.StoredVariables["CostFunctionJo"].store( Jo ) self.StoredVariables["CostFunctionJ" ].store( J ) diff --git a/src/daComposant/daAlgorithms/KalmanFilter.py b/src/daComposant/daAlgorithms/KalmanFilter.py index 406cbcb..754b772 100644 --- a/src/daComposant/daAlgorithms/KalmanFilter.py +++ b/src/daComposant/daAlgorithms/KalmanFilter.py @@ -152,7 +152,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): Jb = 0.5 * (Xn - Xb).T * BI * (Xn - Xb) Jo = 0.5 * d.T * RI * d J = float( Jb ) + float( Jo ) - self.StoredVariables["CurrentState"].store( Xn.A1 ) + self.StoredVariables["CurrentState"].store( Xn ) self.StoredVariables["CostFunctionJb"].store( Jb ) self.StoredVariables["CostFunctionJo"].store( Jo ) self.StoredVariables["CostFunctionJ" ].store( J ) diff --git a/src/daComposant/daAlgorithms/NonLinearLeastSquares.py b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py index 501046b..ed1bc5e 100644 --- a/src/daComposant/daAlgorithms/NonLinearLeastSquares.py +++ b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py @@ -138,7 +138,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): Jo = 0.5 * (Y - _HX).T * RI * (Y - _HX) J = float( Jb ) + float( Jo ) if self._parameters["StoreInternalVariables"]: - self.StoredVariables["CurrentState"].store( _X.A1 ) + self.StoredVariables["CurrentState"].store( _X ) self.StoredVariables["CostFunctionJb"].store( Jb ) self.StoredVariables["CostFunctionJo"].store( Jo ) self.StoredVariables["CostFunctionJ" ].store( J ) @@ -161,7 +161,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): Jo = 0.5 * (Y - _HX).T * RI * (Y - _HX) J = float( Jb ) + float( Jo ) if self._parameters["StoreInternalVariables"]: - self.StoredVariables["CurrentState"].store( _X.A1 ) + self.StoredVariables["CurrentState"].store( _X ) self.StoredVariables["CostFunctionJb"].store( Jb ) self.StoredVariables["CostFunctionJo"].store( Jo ) self.StoredVariables["CostFunctionJ" ].store( J ) diff --git a/src/daComposant/daAlgorithms/QuantileRegression.py b/src/daComposant/daAlgorithms/QuantileRegression.py index 95a9c9a..59eba18 100644 --- a/src/daComposant/daAlgorithms/QuantileRegression.py +++ b/src/daComposant/daAlgorithms/QuantileRegression.py @@ -115,7 +115,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): Jo = 0. J = Jb + Jo if self._parameters["StoreInternalVariables"]: - self.StoredVariables["CurrentState"].store( _X.A1 ) + self.StoredVariables["CurrentState"].store( _X ) self.StoredVariables["CostFunctionJb"].store( Jb ) self.StoredVariables["CostFunctionJo"].store( Jo ) self.StoredVariables["CostFunctionJ" ].store( J ) diff --git a/src/daComposant/daAlgorithms/UnscentedKalmanFilter.py b/src/daComposant/daAlgorithms/UnscentedKalmanFilter.py index d66e6e0..ffc1739 100644 --- a/src/daComposant/daAlgorithms/UnscentedKalmanFilter.py +++ b/src/daComposant/daAlgorithms/UnscentedKalmanFilter.py @@ -273,7 +273,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): Jb = 0.5 * (Xn - Xb).T * BI * (Xn - Xb) Jo = 0.5 * d.T * RI * d J = float( Jb ) + float( Jo ) - self.StoredVariables["CurrentState"].store( Xn.A1 ) + self.StoredVariables["CurrentState"].store( Xn ) self.StoredVariables["CostFunctionJb"].store( Jb ) self.StoredVariables["CostFunctionJo"].store( Jo ) self.StoredVariables["CostFunctionJ" ].store( J ) diff --git a/src/daComposant/daCore/Persistence.py b/src/daComposant/daCore/Persistence.py index 4193e26..892cd16 100644 --- a/src/daComposant/daCore/Persistence.py +++ b/src/daComposant/daCore/Persistence.py @@ -76,7 +76,7 @@ class Persistence: """ if value is None: raise ValueError("Value argument required") # - self.__values.append(self.__basetype(value)) + self.__values.append(copy.copy(self.__basetype(value))) self.__tags.append(kwargs) # if self.__dynamic: self.__replots() -- 2.39.2