X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FdaComposant%2FdaAlgorithms%2FExtendedBlue.py;h=73451e01ea5a0d582b57f91ad3184f23aa1da2ef;hb=bd9eda86ec988924fa98879466a94787c1bd80fe;hp=e80c39cb03a981b42fa8fd1961c9af19a6a914f2;hpb=7bf69a5322576eda00a4d90fa54d1d60a65d0ea6;p=modules%2Fadao.git diff --git a/src/daComposant/daAlgorithms/ExtendedBlue.py b/src/daComposant/daAlgorithms/ExtendedBlue.py index e80c39c..73451e0 100644 --- a/src/daComposant/daAlgorithms/ExtendedBlue.py +++ b/src/daComposant/daAlgorithms/ExtendedBlue.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright (C) 2008-2018 EDF R&D +# Copyright (C) 2008-2020 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 @@ -40,25 +40,31 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): typecast = tuple, message = "Liste de calculs supplémentaires à stocker et/ou effectuer", listval = [ + "Analysis", "APosterioriCorrelations", "APosterioriCovariance", "APosterioriStandardDeviations", "APosterioriVariances", "BMA", - "OMA", - "OMB", - "CurrentState", "CostFunctionJ", + "CostFunctionJAtCurrentOptimum", "CostFunctionJb", + "CostFunctionJbAtCurrentOptimum", "CostFunctionJo", + "CostFunctionJoAtCurrentOptimum", + "CurrentOptimum", + "CurrentState", "Innovation", + "MahalanobisConsistency", + "OMA", + "OMB", "SigmaBck2", "SigmaObs2", - "MahalanobisConsistency", - "SimulationQuantiles", "SimulatedObservationAtBackground", + "SimulatedObservationAtCurrentOptimum", "SimulatedObservationAtCurrentState", "SimulatedObservationAtOptimum", + "SimulationQuantiles", ] ) self.defineRequiredParameter( @@ -91,9 +97,14 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): 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): - 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 @@ -137,17 +148,22 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # 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("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("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 ) @@ -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["CostFunctionJbAtCurrentOptimum"].store( Jb ) + self.StoredVariables["CostFunctionJoAtCurrentOptimum"].store( Jo ) + self.StoredVariables["CostFunctionJAtCurrentOptimum" ].store( J ) # # 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._toStore("CurrentOptimum"): + self.StoredVariables["CurrentOptimum"].store( numpy.ravel(Xa) ) 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) ) + if self._toStore("SimulatedObservationAtCurrentOptimum"): + self.StoredVariables["SimulatedObservationAtCurrentOptimum"].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__": - print('\n AUTODIAGNOSTIC \n') + print('\n AUTODIAGNOSTIC\n')