#-*-coding:iso-8859-1-*-
#
-# Copyright (C) 2008-2014 EDF R&D
+# Copyright (C) 2008-2015 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
# Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
import logging
-from daCore import BasicObjects, PlatformInfo
-m = PlatformInfo.SystemUsage()
+from daCore import BasicObjects
import numpy
# ==============================================================================
default = [],
typecast = tuple,
message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
- listval = ["APosterioriCovariance", "BMA", "Innovation"]
+ listval = ["APosterioriCorrelations", "APosterioriCovariance", "APosterioriStandardDeviations", "APosterioriVariances", "BMA", "CurrentState", "CostFunctionJ", "Innovation"]
+ )
+ self.defineRequiredParameter( # Pas de type
+ name = "Bounds",
+ message = "Liste des valeurs de bornes",
)
def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None):
- logging.debug("%s Lancement"%self._name)
- logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("M")))
+ self._pre_run()
#
# Paramètres de pilotage
# ----------------------
else:
Cm = None
#
- # Nombre de pas du Kalman identique au nombre de pas d'observations
- # -----------------------------------------------------------------
+ # Nombre de pas identique au nombre de pas d'observations
+ # -------------------------------------------------------
if hasattr(Y,"stepnumber"):
duration = Y.stepnumber()
else:
#
self.StoredVariables["Analysis"].store( Xn.A1 )
if "APosterioriCovariance" in self._parameters["StoreSupplementaryCalculations"]:
- self.StoredVariables["APosterioriCovariance"].store( Pn )
+ self.StoredVariables["APosterioriCovariance"].store( Pn.asfullmatrix(Xn.size) )
covarianceXa = Pn
Xa = Xn
previousJMinimum = numpy.finfo(float).max
if Cm is not None and Un is not None: # Attention : si Cm est aussi dans H, doublon !
d = d - Cm * Un
#
+ _A = R + Ht * Pn_predicted * Ha
+ _u = numpy.linalg.solve( _A , d )
+ Xn = Xn_predicted + Pn_predicted * Ha * _u
Kn = Pn_predicted * Ha * (R + Ht * Pn_predicted * Ha).I
- Xn = Xn_predicted + Kn * d
Pn = Pn_predicted - Kn * Ht * Pn_predicted
#
self.StoredVariables["Analysis"].store( Xn.A1 )
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 )
+ if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["CurrentState"].store( Xn )
self.StoredVariables["CostFunctionJb"].store( Jb )
self.StoredVariables["CostFunctionJo"].store( Jo )
self.StoredVariables["CostFunctionJ" ].store( J )
if "BMA" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["BMA"].store( numpy.ravel(Xb) - numpy.ravel(Xa) )
#
- logging.debug("%s Nombre d'évaluation(s) de l'opérateur d'observation direct/tangent/adjoint : %i/%i/%i"%(self._name, HO["Direct"].nbcalls()[0],HO["Tangent"].nbcalls()[0],HO["Adjoint"].nbcalls()[0]))
- logging.debug("%s Taille mémoire utilisée de %.1f Mo"%(self._name, m.getUsedMemory("M")))
- logging.debug("%s Terminé"%self._name)
- #
+ self._post_run(HO)
return 0
# ==============================================================================