#-*-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", "OMA", "OMB", "Innovation", "SigmaBck2", "SigmaObs2", "MahalanobisConsistency", "SimulationQuantiles"]
+ listval = ["APosterioriCovariance", "BMA", "OMA", "OMB", "CostFunctionJ", "Innovation", "SigmaBck2", "SigmaObs2", "MahalanobisConsistency", "SimulationQuantiles", "SimulatedObservationAtBackground", "SimulatedObservationAtOptimum"]
)
self.defineRequiredParameter(
name = "Quantiles",
default = [],
typecast = tuple,
message = "Liste des valeurs de quantiles",
+ minval = 0.,
+ maxval = 1.,
)
self.defineRequiredParameter(
name = "SetSeed",
)
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
# ----------------------
# Calcul de la fonction coût
# --------------------------
if self._parameters["StoreInternalVariables"] or \
- "OMA" in self._parameters["StoreSupplementaryCalculations"] or \
- "SigmaObs2" in self._parameters["StoreSupplementaryCalculations"] or \
- "MahalanobisConsistency" in self._parameters["StoreSupplementaryCalculations"] or \
- "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]:
+ "CostFunctionJ" in self._parameters["StoreSupplementaryCalculations"] or \
+ "OMA" in self._parameters["StoreSupplementaryCalculations"] or \
+ "SigmaObs2" in self._parameters["StoreSupplementaryCalculations"] or \
+ "MahalanobisConsistency" in self._parameters["StoreSupplementaryCalculations"] or \
+ "SimulatedObservationAtOptimum" in self._parameters["StoreSupplementaryCalculations"] or \
+ "SimulationQuantiles" in self._parameters["StoreSupplementaryCalculations"]:
HXa = numpy.matrix(numpy.ravel( H( Xa ) )).T
oma = Y - HXa
if self._parameters["StoreInternalVariables"] or \
- "MahalanobisConsistency" in self._parameters["StoreSupplementaryCalculations"]:
+ "CostFunctionJ" in self._parameters["StoreSupplementaryCalculations"] or \
+ "MahalanobisConsistency" in self._parameters["StoreSupplementaryCalculations"]:
Jb = 0.5 * (Xa - Xb).T * BI * (Xa - Xb)
Jo = 0.5 * oma.T * RI * oma
J = float( Jb ) + float( Jo )
if YQ is None: YQ = YfQ[:,indice]
else: YQ = numpy.hstack((YQ,YfQ[:,indice]))
self.StoredVariables["SimulationQuantiles"].store( YQ )
+ if "SimulatedObservationAtBackground" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["SimulatedObservationAtBackground"].store( numpy.ravel(HXb) )
+ if "SimulatedObservationAtOptimum" in self._parameters["StoreSupplementaryCalculations"]:
+ self.StoredVariables["SimulatedObservationAtOptimum"].store( numpy.ravel(HXa) )
#
- 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 Nombre d'appels au cache d'opérateur d'observation direct/tangent/adjoint..: %i/%i/%i"%(self._name, HO["Direct"].nbcalls(3),HO["Tangent"].nbcalls(3),HO["Adjoint"].nbcalls(3)))
- 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
# ==============================================================================