-#-*-coding:iso-8859-1-*-
+# -*- coding: utf-8 -*-
#
-# Copyright (C) 2008-2017 EDF R&D
+# Copyright (C) 2008-2018 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
name = "StoreInternalVariables",
default = False,
typecast = bool,
- message = "Stockage des variables internes ou intermédiaires du calcul",
+ message = "Stockage des variables internes ou intermédiaires du calcul",
)
self.defineRequiredParameter(
name = "StoreSupplementaryCalculations",
default = [],
typecast = tuple,
- message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
+ message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
listval = ["APosterioriCorrelations", "APosterioriCovariance", "APosterioriStandardDeviations", "APosterioriVariances", "BMA", "CurrentState", "CostFunctionJ", "CostFunctionJb", "CostFunctionJo", "Innovation"]
)
self.defineRequiredParameter( # Pas de type
name = "Bounds",
message = "Liste des valeurs de bornes",
)
+ self.requireInputArguments(
+ mandatory= ("Xb", "Y", "HO", "R", "B" ),
+ optional = ("U", "EM", "CM", "Q"),
+ )
def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None):
- self._pre_run(Parameters)
+ self._pre_run(Parameters, Xb, Y, R, B, Q)
#
if self._parameters["EstimationOf"] == "Parameters":
self._parameters["StoreInternalVariables"] = True
#
- # Opérateurs
+ # Opérateurs
# ----------
if B is None:
raise ValueError("Background error covariance matrix has to be properly defined!")
if self._parameters["EstimationOf"] == "State":
M = EM["Direct"].appliedControledFormTo
#
- if CM is not None and CM.has_key("Tangent") and U is not None:
+ if CM is not None and "Tangent" in CM and U is not None:
Cm = CM["Tangent"].asMatrix(Xb)
else:
Cm = None
else:
duration = 2
#
- # Précalcul des inversions de B et R
+ # Précalcul des inversions de B et R
# ----------------------------------
if self._parameters["StoreInternalVariables"]:
BI = B.getI()
self.StoredVariables["APosterioriCovariance"].store( Pn )
if "Innovation" in self._parameters["StoreSupplementaryCalculations"]:
self.StoredVariables["Innovation"].store( numpy.ravel( d.A1 ) )
- if self._parameters["StoreInternalVariables"]:
+ if self._parameters["StoreInternalVariables"] or "CurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["CurrentState"].store( Xn )
+ if self._parameters["StoreInternalVariables"] \
+ or "CostFunctionJ" in self._parameters["StoreSupplementaryCalculations"] \
+ or "CostFunctionJb" in self._parameters["StoreSupplementaryCalculations"] \
+ or "CostFunctionJo" in self._parameters["StoreSupplementaryCalculations"]:
Jb = 0.5 * (Xn - Xb).T * BI * (Xn - Xb)
Jo = 0.5 * d.T * RI * d
J = float( Jb ) + float( Jo )
- 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 )