From: Jean-Philippe ARGAUD Date: Wed, 29 Apr 2015 17:16:07 +0000 (+0200) Subject: Improving observer variables saving X-Git-Tag: V7_6_0~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e02fce8ea06653b6ea165f0f26baae4633f6f751;p=modules%2Fadao.git Improving observer variables saving --- diff --git a/src/daComposant/daAlgorithms/3DVAR.py b/src/daComposant/daAlgorithms/3DVAR.py index a4a475c..a7e2e3c 100644 --- a/src/daComposant/daAlgorithms/3DVAR.py +++ b/src/daComposant/daAlgorithms/3DVAR.py @@ -159,15 +159,15 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # ------------------------------ def CostFunction(x): _X = numpy.asmatrix(numpy.ravel( x )).T + if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]: + self.StoredVariables["CurrentState"].store( _X ) _HX = Hm( _X ) _HX = numpy.asmatrix(numpy.ravel( _HX )).T + if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]: + self.StoredVariables["SimulatedObservationAtCurrentState"].store( _HX ) Jb = 0.5 * (_X - Xb).T * BI * (_X - Xb) Jo = 0.5 * (Y - _HX).T * RI * (Y - _HX) J = float( Jb ) + float( Jo ) - if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]: - self.StoredVariables["CurrentState"].store( _X ) - if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]: - self.StoredVariables["SimulatedObservationAtCurrentState"].store( _HX ) self.StoredVariables["CostFunctionJb"].store( Jb ) self.StoredVariables["CostFunctionJo"].store( Jo ) self.StoredVariables["CostFunctionJ" ].store( J ) diff --git a/src/daComposant/daAlgorithms/4DVAR.py b/src/daComposant/daAlgorithms/4DVAR.py index 12bc9ac..3c6a439 100644 --- a/src/daComposant/daAlgorithms/4DVAR.py +++ b/src/daComposant/daAlgorithms/4DVAR.py @@ -169,6 +169,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): self.DirectInnovation = [None,] # Le pas 0 n'est pas observé def CostFunction(x): _X = numpy.asmatrix(numpy.ravel( x )).T + if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]: + self.StoredVariables["CurrentState"].store( _X ) Jb = 0.5 * (_X - Xb).T * BI * (_X - Xb) self.DirectCalculation = [None,] self.DirectInnovation = [None,] @@ -202,8 +204,6 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): Jo = Jo + _YmHMX.T * RI * _YmHMX Jo = 0.5 * Jo J = float( Jb ) + float( Jo ) - if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]: - 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/NonLinearLeastSquares.py b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py index 9a934ff..dad0715 100644 --- a/src/daComposant/daAlgorithms/NonLinearLeastSquares.py +++ b/src/daComposant/daAlgorithms/NonLinearLeastSquares.py @@ -133,15 +133,15 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # ------------------------------ def CostFunction(x): _X = numpy.asmatrix(numpy.ravel( x )).T + if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]: + self.StoredVariables["CurrentState"].store( _X ) _HX = Hm( _X ) _HX = numpy.asmatrix(numpy.ravel( _HX )).T + if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]: + self.StoredVariables["SimulatedObservationAtCurrentState"].store( _HX ) Jb = 0. Jo = 0.5 * (Y - _HX).T * RI * (Y - _HX) J = float( Jb ) + float( Jo ) - if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]: - self.StoredVariables["CurrentState"].store( _X ) - if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]: - self.StoredVariables["SimulatedObservationAtCurrentState"].store( _HX ) 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 218efb4..504adee 100644 --- a/src/daComposant/daAlgorithms/QuantileRegression.py +++ b/src/daComposant/daAlgorithms/QuantileRegression.py @@ -111,15 +111,15 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # ------------------------------ def CostFunction(x): _X = numpy.asmatrix(numpy.ravel( x )).T + if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]: + self.StoredVariables["CurrentState"].store( _X ) _HX = Hm( _X ) _HX = numpy.asmatrix(numpy.ravel( _HX )).T + if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]: + self.StoredVariables["SimulatedObservationAtCurrentState"].store( _HX ) Jb = 0. Jo = 0. J = Jb + Jo - if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]: - self.StoredVariables["CurrentState"].store( _X ) - if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]: - self.StoredVariables["SimulatedObservationAtCurrentState"].store( _HX ) self.StoredVariables["CostFunctionJb"].store( Jb ) self.StoredVariables["CostFunctionJo"].store( Jo ) self.StoredVariables["CostFunctionJ" ].store( J )