Salome HOME
projects
/
modules
/
adao.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improvement of algorithms arguments validation and tests
[modules/adao.git]
/
src
/
daComposant
/
daAlgorithms
/
ExtendedBlue.py
diff --git
a/src/daComposant/daAlgorithms/ExtendedBlue.py
b/src/daComposant/daAlgorithms/ExtendedBlue.py
index e80c39cb03a981b42fa8fd1961c9af19a6a914f2..73451e01ea5a0d582b57f91ad3184f23aa1da2ef 100644
(file)
--- a/
src/daComposant/daAlgorithms/ExtendedBlue.py
+++ b/
src/daComposant/daAlgorithms/ExtendedBlue.py
@@
-1,6
+1,6
@@
# -*- coding: utf-8 -*-
#
# -*- coding: utf-8 -*-
#
-# Copyright (C) 2008-20
18
EDF R&D
+# Copyright (C) 2008-20
20
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
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@
-40,25
+40,31
@@
class ElementaryAlgorithm(BasicObjects.Algorithm):
typecast = tuple,
message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
listval = [
typecast = tuple,
message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
listval = [
+ "Analysis",
"APosterioriCorrelations",
"APosterioriCovariance",
"APosterioriStandardDeviations",
"APosterioriVariances",
"BMA",
"APosterioriCorrelations",
"APosterioriCovariance",
"APosterioriStandardDeviations",
"APosterioriVariances",
"BMA",
- "OMA",
- "OMB",
- "CurrentState",
"CostFunctionJ",
"CostFunctionJ",
+ "CostFunctionJAtCurrentOptimum",
"CostFunctionJb",
"CostFunctionJb",
+ "CostFunctionJbAtCurrentOptimum",
"CostFunctionJo",
"CostFunctionJo",
+ "CostFunctionJoAtCurrentOptimum",
+ "CurrentOptimum",
+ "CurrentState",
"Innovation",
"Innovation",
+ "MahalanobisConsistency",
+ "OMA",
+ "OMB",
"SigmaBck2",
"SigmaObs2",
"SigmaBck2",
"SigmaObs2",
- "MahalanobisConsistency",
- "SimulationQuantiles",
"SimulatedObservationAtBackground",
"SimulatedObservationAtBackground",
+ "SimulatedObservationAtCurrentOptimum",
"SimulatedObservationAtCurrentState",
"SimulatedObservationAtOptimum",
"SimulatedObservationAtCurrentState",
"SimulatedObservationAtOptimum",
+ "SimulationQuantiles",
]
)
self.defineRequiredParameter(
]
)
self.defineRequiredParameter(
@@
-91,9
+97,14
@@
class ElementaryAlgorithm(BasicObjects.Algorithm):
self.requireInputArguments(
mandatory= ("Xb", "Y", "HO", "R", "B"),
)
self.requireInputArguments(
mandatory= ("Xb", "Y", "HO", "R", "B"),
)
+ self.setAttributes(tags=(
+ "DataAssimilation",
+ "NonLinear",
+ "Filter",
+ ))
def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None):
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, Xb, Y, R, B, Q)
+ self._pre_run(Parameters, Xb, Y,
U, HO, EM, CM,
R, B, Q)
#
Hm = HO["Tangent"].asMatrix(Xb)
Hm = Hm.reshape(Y.size,Xb.size) # ADAO & check shape
#
Hm = HO["Tangent"].asMatrix(Xb)
Hm = Hm.reshape(Y.size,Xb.size) # ADAO & check shape
@@
-137,17
+148,22
@@
class ElementaryAlgorithm(BasicObjects.Algorithm):
# Calcul de la fonction coût
# --------------------------
if self._parameters["StoreInternalVariables"] or \
# Calcul de la fonction coût
# --------------------------
if self._parameters["StoreInternalVariables"] or \
- self._toStore("CostFunctionJ") or \
+ self._toStore("CostFunctionJ") or self._toStore("CostFunctionJAtCurrentOptimum") or \
+ self._toStore("CostFunctionJb") or self._toStore("CostFunctionJbAtCurrentOptimum") or \
+ self._toStore("CostFunctionJo") or self._toStore("CostFunctionJoAtCurrentOptimum") or \
self._toStore("OMA") or \
self._toStore("SigmaObs2") or \
self._toStore("MahalanobisConsistency") or \
self._toStore("OMA") or \
self._toStore("SigmaObs2") or \
self._toStore("MahalanobisConsistency") or \
+ self._toStore("SimulatedObservationAtCurrentOptimum") or \
self._toStore("SimulatedObservationAtCurrentState") or \
self._toStore("SimulatedObservationAtOptimum") or \
self._toStore("SimulationQuantiles"):
HXa = numpy.matrix(numpy.ravel( H( Xa ) )).T
oma = Y - HXa
if self._parameters["StoreInternalVariables"] or \
self._toStore("SimulatedObservationAtCurrentState") or \
self._toStore("SimulatedObservationAtOptimum") or \
self._toStore("SimulationQuantiles"):
HXa = numpy.matrix(numpy.ravel( H( Xa ) )).T
oma = Y - HXa
if self._parameters["StoreInternalVariables"] or \
- self._toStore("CostFunctionJ") or \
+ self._toStore("CostFunctionJ") or self._toStore("CostFunctionJAtCurrentOptimum") or \
+ self._toStore("CostFunctionJb") or self._toStore("CostFunctionJbAtCurrentOptimum") or \
+ self._toStore("CostFunctionJo") or self._toStore("CostFunctionJoAtCurrentOptimum") or \
self._toStore("MahalanobisConsistency"):
Jb = float( 0.5 * (Xa - Xb).T * BI * (Xa - Xb) )
Jo = float( 0.5 * oma.T * RI * oma )
self._toStore("MahalanobisConsistency"):
Jb = float( 0.5 * (Xa - Xb).T * BI * (Xa - Xb) )
Jo = float( 0.5 * oma.T * RI * oma )
@@
-155,6
+171,9
@@
class ElementaryAlgorithm(BasicObjects.Algorithm):
self.StoredVariables["CostFunctionJb"].store( Jb )
self.StoredVariables["CostFunctionJo"].store( Jo )
self.StoredVariables["CostFunctionJ" ].store( J )
self.StoredVariables["CostFunctionJb"].store( Jb )
self.StoredVariables["CostFunctionJo"].store( Jo )
self.StoredVariables["CostFunctionJ" ].store( J )
+ self.StoredVariables["CostFunctionJbAtCurrentOptimum"].store( Jb )
+ self.StoredVariables["CostFunctionJoAtCurrentOptimum"].store( Jo )
+ self.StoredVariables["CostFunctionJAtCurrentOptimum" ].store( J )
#
# Calcul de la covariance d'analyse
# ---------------------------------
#
# Calcul de la covariance d'analyse
# ---------------------------------
@@
-178,6
+197,8
@@
class ElementaryAlgorithm(BasicObjects.Algorithm):
# ---------------------------------------
if self._parameters["StoreInternalVariables"] or self._toStore("CurrentState"):
self.StoredVariables["CurrentState"].store( numpy.ravel(Xa) )
# ---------------------------------------
if self._parameters["StoreInternalVariables"] or self._toStore("CurrentState"):
self.StoredVariables["CurrentState"].store( numpy.ravel(Xa) )
+ if self._toStore("CurrentOptimum"):
+ self.StoredVariables["CurrentOptimum"].store( numpy.ravel(Xa) )
if self._toStore("Innovation"):
self.StoredVariables["Innovation"].store( numpy.ravel(d) )
if self._toStore("BMA"):
if self._toStore("Innovation"):
self.StoredVariables["Innovation"].store( numpy.ravel(d) )
if self._toStore("BMA"):
@@
-222,6
+243,8
@@
class ElementaryAlgorithm(BasicObjects.Algorithm):
self.StoredVariables["SimulatedObservationAtBackground"].store( numpy.ravel(HXb) )
if self._toStore("SimulatedObservationAtCurrentState"):
self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(HXa) )
self.StoredVariables["SimulatedObservationAtBackground"].store( numpy.ravel(HXb) )
if self._toStore("SimulatedObservationAtCurrentState"):
self.StoredVariables["SimulatedObservationAtCurrentState"].store( numpy.ravel(HXa) )
+ if self._toStore("SimulatedObservationAtCurrentOptimum"):
+ self.StoredVariables["SimulatedObservationAtCurrentOptimum"].store( numpy.ravel(HXa) )
if self._toStore("SimulatedObservationAtOptimum"):
self.StoredVariables["SimulatedObservationAtOptimum"].store( numpy.ravel(HXa) )
#
if self._toStore("SimulatedObservationAtOptimum"):
self.StoredVariables["SimulatedObservationAtOptimum"].store( numpy.ravel(HXa) )
#
@@
-230,4
+253,4
@@
class ElementaryAlgorithm(BasicObjects.Algorithm):
# ==============================================================================
if __name__ == "__main__":
# ==============================================================================
if __name__ == "__main__":
- print('\n AUTODIAGNOSTIC
\n')
+ print('\n AUTODIAGNOSTIC\n')