1 # -*- coding: utf-8 -*-
3 # Copyright (C) 2008-2024 EDF R&D
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License.
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 # Author: Jean-Philippe Argaud, jean-philippe.argaud@edf.fr, EDF R&D
24 from daCore import BasicObjects, NumericObjects
25 from daAlgorithms.Atoms import ecwblue
27 # ==============================================================================
28 class ElementaryAlgorithm(BasicObjects.Algorithm):
30 BasicObjects.Algorithm.__init__(self, "BLUE")
31 self.defineRequiredParameter(
35 message = "Variant ou formulation de la méthode",
43 self.defineRequiredParameter(
44 name = "EstimationOf",
45 default = "Parameters",
47 message = "Estimation d'état ou de paramètres",
48 listval = ["State", "Parameters"],
50 self.defineRequiredParameter(
51 name = "StoreInternalVariables",
54 message = "Stockage des variables internes ou intermédiaires du calcul",
56 self.defineRequiredParameter(
57 name = "StoreSupplementaryCalculations",
60 message = "Liste de calculs supplémentaires à stocker et/ou effectuer",
63 "APosterioriCorrelations",
64 "APosterioriCovariance",
65 "APosterioriStandardDeviations",
66 "APosterioriVariances",
69 "CostFunctionJAtCurrentOptimum",
71 "CostFunctionJbAtCurrentOptimum",
73 "CostFunctionJoAtCurrentOptimum",
79 "InnovationAtCurrentAnalysis",
80 "MahalanobisConsistency",
83 "SampledStateForQuantiles",
86 "SimulatedObservationAtBackground",
87 "SimulatedObservationAtCurrentOptimum",
88 "SimulatedObservationAtCurrentState",
89 "SimulatedObservationAtOptimum",
90 "SimulationQuantiles",
93 self.defineRequiredParameter(
97 message = "Liste des valeurs de quantiles",
101 self.defineRequiredParameter(
103 typecast = numpy.random.seed,
104 message = "Graine fixée pour le générateur aléatoire",
106 self.defineRequiredParameter(
107 name = "NumberOfSamplesForQuantiles",
110 message = "Nombre d'échantillons simulés pour le calcul des quantiles",
113 self.defineRequiredParameter(
114 name = "SimulationForQuantiles",
117 message = "Type de simulation en estimation des quantiles",
118 listval = ["Linear", "NonLinear"]
120 self.defineRequiredParameter( # Pas de type
121 name = "StateBoundsForQuantiles",
122 message = "Liste des paires de bornes pour les états utilisés en estimation des quantiles",
124 self.requireInputArguments(
125 mandatory= ("Xb", "Y", "HO", "R", "B"),
126 optional = ("U", "EM", "CM", "Q"),
137 "ParallelDerivativesOnly",
138 "ConvergenceOnStatic",
142 def run(self, Xb=None, Y=None, U=None, HO=None, EM=None, CM=None, R=None, B=None, Q=None, Parameters=None):
143 self._pre_run(Parameters, Xb, Y, U, HO, EM, CM, R, B, Q)
145 # --------------------------
146 if self._parameters["Variant"] == "Blue":
147 NumericObjects.multiXOsteps(self, Xb, Y, U, HO, EM, CM, R, B, Q, ecwblue.ecwblue)
149 # --------------------------
150 elif self._parameters["Variant"] == "OneCorrection":
151 ecwblue.ecwblue(self, Xb, Y, U, HO, CM, R, B)
153 # --------------------------
155 raise ValueError("Error in Variant name: %s"%self._parameters["Variant"])
157 self._post_run(HO, EM)
160 # ==============================================================================
161 if __name__ == "__main__":
162 print("\n AUTODIAGNOSTIC\n")