Salome HOME
Minor dev documentation corrections
[modules/adao.git] / src / daComposant / daAlgorithms / SamplingTest.py
index 1d60f73d7d541e160fa84f778d5287233b1734b6..967640c537cac3a18cfec6709e7348af9eb89e9c 100644 (file)
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2008-2017 EDF R&D
+# Copyright (C) 2008-2019 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
@@ -74,16 +74,26 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             default  = [],
             typecast = tuple,
             message  = "Liste de calculs supplémentaires à stocker et/ou effectuer",
-            listval  = ["CostFunctionJ", "CostFunctionJb", "CostFunctionJo","CurrentState","InnovationAtCurrentState","SimulatedObservationAtCurrentState"]
+            listval  = [
+                "CostFunctionJ",
+                "CostFunctionJb",
+                "CostFunctionJo",
+                "CurrentState",
+                "InnovationAtCurrentState",
+                "SimulatedObservationAtCurrentState",
+                ]
             )
         self.defineRequiredParameter(
             name     = "SetSeed",
             typecast = numpy.random.seed,
             message  = "Graine fixée pour le générateur aléatoire",
             )
+        self.requireInputArguments(
+            mandatory= ("Xb", "HO"),
+            )
 
     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)
         #
         Hm = HO["Direct"].appliedTo
         #
@@ -151,11 +161,11 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
                     Jo  = numpy.max( numpy.abs(Y - _HX) )
                 #
                 J   = float( Jb ) + float( Jo )
-            if "CurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+            if self._toStore("CurrentState"):
                 self.StoredVariables["CurrentState"].store( _X )
-            if "InnovationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+            if self._toStore("InnovationAtCurrentState"):
                 self.StoredVariables["InnovationAtCurrentState"].store( Y - _HX )
-            if "SimulatedObservationAtCurrentState" in self._parameters["StoreSupplementaryCalculations"]:
+            if self._toStore("SimulatedObservationAtCurrentState"):
                 self.StoredVariables["SimulatedObservationAtCurrentState"].store( _HX )
             self.StoredVariables["CostFunctionJb"].store( Jb )
             self.StoredVariables["CostFunctionJo"].store( Jo )
@@ -191,4 +201,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print('\n AUTODIAGNOSTIC \n')
+    print('\n AUTODIAGNOSTIC\n')