From: Jean-Philippe ARGAUD Date: Tue, 27 Dec 2022 20:11:52 +0000 (+0100) Subject: Minor documentation and code review corrections (36) X-Git-Tag: V9_11_0a1~16 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a89509e8abc814fdc0f6ddb7ebc0112edfaa7ded;p=modules%2Fadao.git Minor documentation and code review corrections (36) --- diff --git a/doc/en/scripts/simple_3DVAR.py b/doc/en/scripts/simple_3DVAR.py index 65a390d..f207887 100644 --- a/doc/en/scripts/simple_3DVAR.py +++ b/doc/en/scripts/simple_3DVAR.py @@ -19,7 +19,7 @@ print("Resolution of the calibration problem") print("-------------------------------------") print("") from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setBackground( Vector = Xb, Stored=True ) case.setBackgroundError( ScalarSparseMatrix = 1.e6 ) case.setObservation( Vector = Yobs, Stored=True ) diff --git a/doc/en/scripts/simple_AdjointTest.py b/doc/en/scripts/simple_AdjointTest.py index a68f18e..9a73dda 100644 --- a/doc/en/scripts/simple_AdjointTest.py +++ b/doc/en/scripts/simple_AdjointTest.py @@ -2,7 +2,7 @@ # from numpy import array, eye from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setCheckingPoint( Vector = array([0., 1., 2.]), Stored=True ) case.setObservation( Vector = [10., 11., 12.] ) case.setObservationOperator( Matrix = eye(3), ) diff --git a/doc/en/scripts/simple_Blue.py b/doc/en/scripts/simple_Blue.py index 58cf086..c5ed14a 100644 --- a/doc/en/scripts/simple_Blue.py +++ b/doc/en/scripts/simple_Blue.py @@ -2,7 +2,7 @@ # from numpy import array, ravel from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setBackground( Vector = array([0., 1., 2.]), Stored=True ) case.setBackgroundError( ScalarSparseMatrix = 1. ) case.setObservation( Vector=array([10., 11., 12.]), Stored=True ) diff --git a/doc/en/scripts/simple_DerivativeFreeOptimization.py b/doc/en/scripts/simple_DerivativeFreeOptimization.py index 7fb3083..ab25a7f 100644 --- a/doc/en/scripts/simple_DerivativeFreeOptimization.py +++ b/doc/en/scripts/simple_DerivativeFreeOptimization.py @@ -19,7 +19,7 @@ print("Resolution of the calibration problem") print("-------------------------------------") print("") from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setBackground( Vector = Xb, Stored=True ) case.setBackgroundError( ScalarSparseMatrix = 1.e6 ) case.setObservation( Vector = Yobs, Stored=True ) diff --git a/doc/en/scripts/simple_ExtendedBlue.py b/doc/en/scripts/simple_ExtendedBlue.py index 03ef1ca..4a7ff5f 100644 --- a/doc/en/scripts/simple_ExtendedBlue.py +++ b/doc/en/scripts/simple_ExtendedBlue.py @@ -2,7 +2,7 @@ # from numpy import array, ravel from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setBackground( Vector = array([0., 1., 2.]), Stored=True ) case.setBackgroundError( ScalarSparseMatrix = 1. ) case.setObservation( Vector=array([10., 11., 12.]), Stored=True ) diff --git a/doc/en/scripts/simple_KalmanFilter1.py b/doc/en/scripts/simple_KalmanFilter1.py index b4fac0f..4910a21 100644 --- a/doc/en/scripts/simple_KalmanFilter1.py +++ b/doc/en/scripts/simple_KalmanFilter1.py @@ -12,7 +12,7 @@ print("----------------------------------------------") print(" Noisy measurements acquired on %i time steps"%(len(Yobs)-1,)) print("") from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() # case.setBackground (Vector = [0.]) case.setBackgroundError (ScalarSparseMatrix = 1.) diff --git a/doc/en/scripts/simple_KalmanFilter2.py b/doc/en/scripts/simple_KalmanFilter2.py index f677dad..cc30384 100644 --- a/doc/en/scripts/simple_KalmanFilter2.py +++ b/doc/en/scripts/simple_KalmanFilter2.py @@ -12,7 +12,7 @@ print("----------------------------------------------") print(" Noisy measurements acquired on %i time steps"%(len(Yobs)-1,)) print("") from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() # case.setBackground (Vector = [0.]) case.setBackgroundError (ScalarSparseMatrix = 1.) diff --git a/doc/en/scripts/simple_NonLinearLeastSquares.py b/doc/en/scripts/simple_NonLinearLeastSquares.py index 6bae490..8b208eb 100644 --- a/doc/en/scripts/simple_NonLinearLeastSquares.py +++ b/doc/en/scripts/simple_NonLinearLeastSquares.py @@ -19,7 +19,7 @@ print("Resolution of the calibration problem") print("-------------------------------------") print("") from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setBackground( Vector = Xb, Stored=True ) case.setObservation( Vector = Yobs, Stored=True ) case.setObservationError( ScalarSparseMatrix = 1. ) diff --git a/doc/en/scripts/simple_ParallelFunctionTest.py b/doc/en/scripts/simple_ParallelFunctionTest.py index dde6bc1..7a6d6a8 100644 --- a/doc/en/scripts/simple_ParallelFunctionTest.py +++ b/doc/en/scripts/simple_ParallelFunctionTest.py @@ -6,7 +6,7 @@ from adao import adaoBuilder def SomeOperator( x ): return numpy.dot(numpy.eye(x.size), numpy.ravel(x)) # -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setAlgorithmParameters( Algorithm='ParallelFunctionTest', Parameters={ diff --git a/doc/en/tutorials_in_salome.rst b/doc/en/tutorials_in_salome.rst index dc70195..9b9028f 100644 --- a/doc/en/tutorials_in_salome.rst +++ b/doc/en/tutorials_in_salome.rst @@ -585,6 +585,7 @@ the following parameters can be defined in a Python script file named ], "StoreSupplementaryCalculations" : [ "CurrentState", + "CostFunctionJ", ], } diff --git a/doc/fr/scripts/simple_3DVAR.py b/doc/fr/scripts/simple_3DVAR.py index cde70b4..88c307c 100644 --- a/doc/fr/scripts/simple_3DVAR.py +++ b/doc/fr/scripts/simple_3DVAR.py @@ -19,7 +19,7 @@ print("Résolution du problème de calage") print("--------------------------------") print("") from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setBackground( Vector = Xb, Stored=True ) case.setBackgroundError( ScalarSparseMatrix = 1.e6 ) case.setObservation( Vector = Yobs, Stored=True ) diff --git a/doc/fr/scripts/simple_AdjointTest.py b/doc/fr/scripts/simple_AdjointTest.py index a68f18e..9a73dda 100644 --- a/doc/fr/scripts/simple_AdjointTest.py +++ b/doc/fr/scripts/simple_AdjointTest.py @@ -2,7 +2,7 @@ # from numpy import array, eye from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setCheckingPoint( Vector = array([0., 1., 2.]), Stored=True ) case.setObservation( Vector = [10., 11., 12.] ) case.setObservationOperator( Matrix = eye(3), ) diff --git a/doc/fr/scripts/simple_Blue.py b/doc/fr/scripts/simple_Blue.py index edef24d..0f81f69 100644 --- a/doc/fr/scripts/simple_Blue.py +++ b/doc/fr/scripts/simple_Blue.py @@ -2,7 +2,7 @@ # from numpy import array, ravel from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setBackground( Vector = array([0., 1., 2.]), Stored=True ) case.setBackgroundError( ScalarSparseMatrix = 1. ) case.setObservation( Vector = array([10., 11., 12.]), Stored=True ) diff --git a/doc/fr/scripts/simple_DerivativeFreeOptimization.py b/doc/fr/scripts/simple_DerivativeFreeOptimization.py index 361106d..1011377 100644 --- a/doc/fr/scripts/simple_DerivativeFreeOptimization.py +++ b/doc/fr/scripts/simple_DerivativeFreeOptimization.py @@ -19,7 +19,7 @@ print("Résolution du problème de calage") print("--------------------------------") print("") from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setBackground( Vector = Xb, Stored=True ) case.setBackgroundError( ScalarSparseMatrix = 1.e6 ) case.setObservation( Vector = Yobs, Stored=True ) diff --git a/doc/fr/scripts/simple_ExtendedBlue.py b/doc/fr/scripts/simple_ExtendedBlue.py index 7508fe7..fb2ea69 100644 --- a/doc/fr/scripts/simple_ExtendedBlue.py +++ b/doc/fr/scripts/simple_ExtendedBlue.py @@ -2,7 +2,7 @@ # from numpy import array, ravel from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setBackground( Vector = array([0., 1., 2.]), Stored=True ) case.setBackgroundError( ScalarSparseMatrix = 1. ) case.setObservation( Vector = array([10., 11., 12.]), Stored=True ) diff --git a/doc/fr/scripts/simple_KalmanFilter1.py b/doc/fr/scripts/simple_KalmanFilter1.py index afa3924..c81d2a5 100644 --- a/doc/fr/scripts/simple_KalmanFilter1.py +++ b/doc/fr/scripts/simple_KalmanFilter1.py @@ -12,7 +12,7 @@ print("------------------------------------------------") print(" Observations bruitées acquises sur %i pas de temps"%(len(Yobs)-1,)) print("") from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() # case.setBackground (Vector = [0.]) case.setBackgroundError (ScalarSparseMatrix = 1.) diff --git a/doc/fr/scripts/simple_KalmanFilter2.py b/doc/fr/scripts/simple_KalmanFilter2.py index 01dc98e..a7b4de8 100644 --- a/doc/fr/scripts/simple_KalmanFilter2.py +++ b/doc/fr/scripts/simple_KalmanFilter2.py @@ -12,7 +12,7 @@ print("------------------------------------------------") print(" Observations bruitées acquises sur %i pas de temps"%(len(Yobs)-1,)) print("") from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() # case.setBackground (Vector = [0.]) case.setBackgroundError (ScalarSparseMatrix = 1.) diff --git a/doc/fr/scripts/simple_NonLinearLeastSquares.py b/doc/fr/scripts/simple_NonLinearLeastSquares.py index 9f3ed1d..7854987 100644 --- a/doc/fr/scripts/simple_NonLinearLeastSquares.py +++ b/doc/fr/scripts/simple_NonLinearLeastSquares.py @@ -19,7 +19,7 @@ print("Résolution du problème de calage") print("--------------------------------") print("") from adao import adaoBuilder -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setBackground( Vector = Xb, Stored=True ) case.setObservation( Vector = Yobs, Stored=True ) case.setObservationError( ScalarSparseMatrix = 1. ) diff --git a/doc/fr/scripts/simple_ParallelFunctionTest.py b/doc/fr/scripts/simple_ParallelFunctionTest.py index dde6bc1..7a6d6a8 100644 --- a/doc/fr/scripts/simple_ParallelFunctionTest.py +++ b/doc/fr/scripts/simple_ParallelFunctionTest.py @@ -6,7 +6,7 @@ from adao import adaoBuilder def SomeOperator( x ): return numpy.dot(numpy.eye(x.size), numpy.ravel(x)) # -case = adaoBuilder.New('') +case = adaoBuilder.New() case.setAlgorithmParameters( Algorithm='ParallelFunctionTest', Parameters={ diff --git a/doc/fr/tutorials_in_salome.rst b/doc/fr/tutorials_in_salome.rst index 88c53eb..bca3804 100644 --- a/doc/fr/tutorials_in_salome.rst +++ b/doc/fr/tutorials_in_salome.rst @@ -616,6 +616,7 @@ définis dans un fichier de script Python nommé ], "StoreSupplementaryCalculations" : [ "CurrentState", + "CostFunctionJ", ], } diff --git a/src/daComposant/daAlgorithms/Atoms/c2ukf.py b/src/daComposant/daAlgorithms/Atoms/c2ukf.py index 1ba2dc8..d736544 100644 --- a/src/daComposant/daAlgorithms/Atoms/c2ukf.py +++ b/src/daComposant/daAlgorithms/Atoms/c2ukf.py @@ -69,7 +69,7 @@ def c2ukf(selfA, Xb, Y, U, HO, EM, CM, R, B, Q): __p = numpy.cumprod(Y.shape())[-1] else: duration = 2 - __p = numpy.array(Y).size + __p = numpy.size(Y) # # Précalcul des inversions de B et R if selfA._parameters["StoreInternalVariables"] \ diff --git a/src/daComposant/daAlgorithms/Atoms/cekf.py b/src/daComposant/daAlgorithms/Atoms/cekf.py index f1a814c..67932dc 100644 --- a/src/daComposant/daAlgorithms/Atoms/cekf.py +++ b/src/daComposant/daAlgorithms/Atoms/cekf.py @@ -46,7 +46,7 @@ def cekf(selfA, Xb, Y, U, HO, EM, CM, R, B, Q): __p = numpy.cumprod(Y.shape())[-1] else: duration = 2 - __p = numpy.array(Y).size + __p = numpy.size(Y) __n = Xb.size # # Précalcul des inversions de B et R diff --git a/src/daComposant/daAlgorithms/Atoms/etkf.py b/src/daComposant/daAlgorithms/Atoms/etkf.py index e9b5d06..0063e14 100644 --- a/src/daComposant/daAlgorithms/Atoms/etkf.py +++ b/src/daComposant/daAlgorithms/Atoms/etkf.py @@ -62,7 +62,7 @@ def etkf(selfA, Xb, Y, U, HO, EM, CM, R, B, Q, __p = numpy.cumprod(Y.shape())[-1] else: duration = 2 - __p = numpy.array(Y).size + __p = numpy.size(Y) # # Précalcul des inversions de B et R if selfA._parameters["StoreInternalVariables"] \ diff --git a/src/daComposant/daAlgorithms/Atoms/exkf.py b/src/daComposant/daAlgorithms/Atoms/exkf.py index befd65c..4c8b036 100644 --- a/src/daComposant/daAlgorithms/Atoms/exkf.py +++ b/src/daComposant/daAlgorithms/Atoms/exkf.py @@ -44,7 +44,7 @@ def exkf(selfA, Xb, Y, U, HO, EM, CM, R, B, Q): __p = numpy.cumprod(Y.shape())[-1] else: duration = 2 - __p = numpy.array(Y).size + __p = numpy.size(Y) __n = Xb.size # # Précalcul des inversions de B et R diff --git a/src/daComposant/daAlgorithms/Atoms/ienkf.py b/src/daComposant/daAlgorithms/Atoms/ienkf.py index 048ce73..7212d42 100644 --- a/src/daComposant/daAlgorithms/Atoms/ienkf.py +++ b/src/daComposant/daAlgorithms/Atoms/ienkf.py @@ -61,7 +61,7 @@ def ienkf(selfA, Xb, Y, U, HO, EM, CM, R, B, Q, VariantM="IEnKF12", __p = numpy.cumprod(Y.shape())[-1] else: duration = 2 - __p = numpy.array(Y).size + __p = numpy.size(Y) # # Précalcul des inversions de B et R if selfA._parameters["StoreInternalVariables"] \ diff --git a/src/daComposant/daAlgorithms/Atoms/mlef.py b/src/daComposant/daAlgorithms/Atoms/mlef.py index e727206..f2228f9 100644 --- a/src/daComposant/daAlgorithms/Atoms/mlef.py +++ b/src/daComposant/daAlgorithms/Atoms/mlef.py @@ -65,7 +65,7 @@ def mlef(selfA, Xb, Y, U, HO, EM, CM, R, B, Q, __p = numpy.cumprod(Y.shape())[-1] else: duration = 2 - __p = numpy.array(Y).size + __p = numpy.size(Y) # # Précalcul des inversions de B et R if selfA._parameters["StoreInternalVariables"] \ diff --git a/src/daComposant/daAlgorithms/Atoms/senkf.py b/src/daComposant/daAlgorithms/Atoms/senkf.py index b1a0da3..c707883 100644 --- a/src/daComposant/daAlgorithms/Atoms/senkf.py +++ b/src/daComposant/daAlgorithms/Atoms/senkf.py @@ -66,7 +66,7 @@ def senkf(selfA, Xb, Y, U, HO, EM, CM, R, B, Q, __p = numpy.cumprod(Y.shape())[-1] else: duration = 2 - __p = numpy.array(Y).size + __p = numpy.size(Y) # # Précalcul des inversions de B et R if selfA._parameters["StoreInternalVariables"] \ diff --git a/src/daComposant/daAlgorithms/Atoms/uskf.py b/src/daComposant/daAlgorithms/Atoms/uskf.py index d5e7c95..02e3d55 100644 --- a/src/daComposant/daAlgorithms/Atoms/uskf.py +++ b/src/daComposant/daAlgorithms/Atoms/uskf.py @@ -67,7 +67,7 @@ def uskf(selfA, Xb, Y, U, HO, EM, CM, R, B, Q): __p = numpy.cumprod(Y.shape())[-1] else: duration = 2 - __p = numpy.array(Y).size + __p = numpy.size(Y) # # Précalcul des inversions de B et R if selfA._parameters["StoreInternalVariables"] \ diff --git a/src/daComposant/daAlgorithms/SamplingTest.py b/src/daComposant/daAlgorithms/SamplingTest.py index befabad..d6edee1 100644 --- a/src/daComposant/daAlgorithms/SamplingTest.py +++ b/src/daComposant/daAlgorithms/SamplingTest.py @@ -97,7 +97,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): message = "Graine fixée pour le générateur aléatoire", ) self.requireInputArguments( - mandatory= ("Xb", "HO"), + mandatory= ("Xb", "Y", "HO", "R", "B"), ) self.setAttributes(tags=( "Checking", diff --git a/src/daComposant/daCore/BasicObjects.py b/src/daComposant/daCore/BasicObjects.py index 5723da3..4cdcfeb 100644 --- a/src/daComposant/daCore/BasicObjects.py +++ b/src/daComposant/daCore/BasicObjects.py @@ -84,11 +84,11 @@ class CacheManager(object): def storeValueInX(self, xValue, HxValue, oName="" ): "Stocke pour un opérateur o un calcul Hx correspondant à la valeur x" if self.__lengthOR < 0: - self.__lengthOR = 2 * min(xValue.size, 50) + 2 # 2 * xValue.size + 2 + self.__lengthOR = 2 * min(numpy.size(xValue), 50) + 2 self.__initlnOR = self.__lengthOR self.__seenNames.append(str(oName)) if str(oName) not in self.__seenNames: # Etend la liste si nouveau - self.__lengthOR += 2 * min(xValue.size, 50) + 2 # 2 * xValue.size + 2 + self.__lengthOR += 2 * min(numpy.size(xValue), 50) + 2 self.__initlnOR += self.__lengthOR self.__seenNames.append(str(oName)) while len(self.__listOPCV) > self.__lengthOR: