]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
Python 3 compatibility improvement
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Wed, 15 Mar 2017 21:25:37 +0000 (22:25 +0100)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Wed, 15 Mar 2017 21:25:37 +0000 (22:25 +0100)
21 files changed:
src/daComposant/daAlgorithms/3DVAR.py
src/daComposant/daAlgorithms/4DVAR.py
src/daComposant/daAlgorithms/AdjointTest.py
src/daComposant/daAlgorithms/Blue.py
src/daComposant/daAlgorithms/DerivativeFreeOptimization.py
src/daComposant/daAlgorithms/EnsembleBlue.py
src/daComposant/daAlgorithms/ExtendedBlue.py
src/daComposant/daAlgorithms/ExtendedKalmanFilter.py
src/daComposant/daAlgorithms/FunctionTest.py
src/daComposant/daAlgorithms/GradientTest.py
src/daComposant/daAlgorithms/KalmanFilter.py
src/daComposant/daAlgorithms/LinearLeastSquares.py
src/daComposant/daAlgorithms/LinearityTest.py
src/daComposant/daAlgorithms/NonLinearLeastSquares.py
src/daComposant/daAlgorithms/ObserverTest.py
src/daComposant/daAlgorithms/ParticleSwarmOptimization.py
src/daComposant/daAlgorithms/QuantileRegression.py
src/daComposant/daAlgorithms/SamplingTest.py
src/daComposant/daAlgorithms/TabuSearch.py
src/daComposant/daAlgorithms/TangentTest.py
src/daComposant/daAlgorithms/UnscentedKalmanFilter.py

index d9a1187535dcec15b907cf1078f71947a2f0c34c..7ddc1bbdc5f7359521767276e8bfe0b76e17fdc9 100644 (file)
@@ -364,4 +364,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 9c49f91f5c8f2ead086ee3fa46812c197abc47de..344ee6cd5306c1e0dcfcd3d08df27befcdf17169 100644 (file)
@@ -324,4 +324,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index bda716223d50b1eec0d10d13d38dd248b32f7023..92ae2f377008af2572efb8a9781fadef36fa3396 100644 (file)
@@ -163,13 +163,12 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         #
         # Sorties eventuelles
         # -------------------
-        print
-        print "Results of adjoint check by \"%s\" formula:"%self._parameters["ResiduFormula"]
-        print msgs
+        print("\nResults of adjoint check by \"%s\" formula:"%self._parameters["ResiduFormula"])
+        print(msgs)
         #
         self._post_run(HO)
         return 0
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 2e9b1afa68554fe09394ac6bd74dbb3e8208f360..00c429d6248bddbc2c04b3ed3c83e7ac188dbfb3 100644 (file)
@@ -207,4 +207,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 44f93647dab488c7099c457ff0631e7ad0c2c3d3..221d4efe659465ee7181b385939197dd9c90dd23 100644 (file)
@@ -217,8 +217,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
                 lb = lub[:,0]
                 ub = lub[:,1]
                 if self._parameters["optdisp"]:
-                    print "%s: upper bounds %s"%(opt.get_algorithm_name(),ub)
-                    print "%s: lower bounds %s"%(opt.get_algorithm_name(),lb)
+                    print("%s: upper bounds %s"%(opt.get_algorithm_name(),ub))
+                    print("%s: lower bounds %s"%(opt.get_algorithm_name(),lb))
                 opt.set_upper_bounds(ub)
                 opt.set_lower_bounds(lb)
             opt.set_ftol_rel(self._parameters["CostDecrementTolerance"])
@@ -226,9 +226,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             opt.set_maxeval(self._parameters["MaximumNumberOfFunctionEvaluations"])
             Minimum = opt.optimize( Xini )
             if self._parameters["optdisp"]:
-                print "%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum)
-                print "%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value())
-                print "%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result())
+                print("%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum))
+                print("%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value()))
+                print("%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result()))
         elif self._parameters["Minimizer"] == "SIMPLEX" and not PlatformInfo.has_nlopt:
             Minimum, J_optimal, niter, nfeval, rc = scipy.optimize.fmin(
                 func        = CostFunction,
@@ -253,8 +253,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
                 lb = lub[:,0]
                 ub = lub[:,1]
                 if self._parameters["optdisp"]:
-                    print "%s: upper bounds %s"%(opt.get_algorithm_name(),ub)
-                    print "%s: lower bounds %s"%(opt.get_algorithm_name(),lb)
+                    print("%s: upper bounds %s"%(opt.get_algorithm_name(),ub))
+                    print("%s: lower bounds %s"%(opt.get_algorithm_name(),lb))
                 opt.set_upper_bounds(ub)
                 opt.set_lower_bounds(lb)
             opt.set_ftol_rel(self._parameters["CostDecrementTolerance"])
@@ -262,9 +262,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             opt.set_maxeval(self._parameters["MaximumNumberOfFunctionEvaluations"])
             Minimum = opt.optimize( Xini )
             if self._parameters["optdisp"]:
-                print "%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum)
-                print "%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value())
-                print "%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result())
+                print("%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum))
+                print("%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value()))
+                print("%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result()))
         elif self._parameters["Minimizer"] == "BOBYQA" and PlatformInfo.has_nlopt:
             import nlopt
             opt = nlopt.opt(nlopt.LN_BOBYQA, Xini.size)
@@ -277,8 +277,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
                 lb = lub[:,0]
                 ub = lub[:,1]
                 if self._parameters["optdisp"]:
-                    print "%s: upper bounds %s"%(opt.get_algorithm_name(),ub)
-                    print "%s: lower bounds %s"%(opt.get_algorithm_name(),lb)
+                    print("%s: upper bounds %s"%(opt.get_algorithm_name(),ub))
+                    print("%s: lower bounds %s"%(opt.get_algorithm_name(),lb))
                 opt.set_upper_bounds(ub)
                 opt.set_lower_bounds(lb)
             opt.set_ftol_rel(self._parameters["CostDecrementTolerance"])
@@ -286,9 +286,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             opt.set_maxeval(self._parameters["MaximumNumberOfFunctionEvaluations"])
             Minimum = opt.optimize( Xini )
             if self._parameters["optdisp"]:
-                print "%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum)
-                print "%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value())
-                print "%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result())
+                print("%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum))
+                print("%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value()))
+                print("%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result()))
         elif self._parameters["Minimizer"] == "NEWUOA" and PlatformInfo.has_nlopt:
             import nlopt
             opt = nlopt.opt(nlopt.LN_NEWUOA, Xini.size)
@@ -301,8 +301,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
                 lb = lub[:,0]
                 ub = lub[:,1]
                 if self._parameters["optdisp"]:
-                    print "%s: upper bounds %s"%(opt.get_algorithm_name(),ub)
-                    print "%s: lower bounds %s"%(opt.get_algorithm_name(),lb)
+                    print("%s: upper bounds %s"%(opt.get_algorithm_name(),ub))
+                    print("%s: lower bounds %s"%(opt.get_algorithm_name(),lb))
                 opt.set_upper_bounds(ub)
                 opt.set_lower_bounds(lb)
             opt.set_ftol_rel(self._parameters["CostDecrementTolerance"])
@@ -310,9 +310,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             opt.set_maxeval(self._parameters["MaximumNumberOfFunctionEvaluations"])
             Minimum = opt.optimize( Xini )
             if self._parameters["optdisp"]:
-                print "%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum)
-                print "%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value())
-                print "%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result())
+                print("%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum))
+                print("%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value()))
+                print("%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result()))
         elif self._parameters["Minimizer"] == "SUBPLEX" and PlatformInfo.has_nlopt:
             import nlopt
             opt = nlopt.opt(nlopt.LN_SBPLX, Xini.size)
@@ -325,8 +325,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
                 lb = lub[:,0]
                 ub = lub[:,1]
                 if self._parameters["optdisp"]:
-                    print "%s: upper bounds %s"%(opt.get_algorithm_name(),ub)
-                    print "%s: lower bounds %s"%(opt.get_algorithm_name(),lb)
+                    print("%s: upper bounds %s"%(opt.get_algorithm_name(),ub))
+                    print("%s: lower bounds %s"%(opt.get_algorithm_name(),lb))
                 opt.set_upper_bounds(ub)
                 opt.set_lower_bounds(lb)
             opt.set_ftol_rel(self._parameters["CostDecrementTolerance"])
@@ -334,9 +334,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
             opt.set_maxeval(self._parameters["MaximumNumberOfFunctionEvaluations"])
             Minimum = opt.optimize( Xini )
             if self._parameters["optdisp"]:
-                print "%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum)
-                print "%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value())
-                print "%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result())
+                print("%s: optimal state: %s"%(opt.get_algorithm_name(),Minimum))
+                print("%s: minimum of J: %s"%(opt.get_algorithm_name(),opt.last_optimum_value()))
+                print("%s: return code: %i"%(opt.get_algorithm_name(),opt.last_optimize_result()))
         else:
             raise ValueError("Error in Minimizer name: %s"%self._parameters["Minimizer"])
         #
@@ -377,4 +377,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index f07c53cdc20506f0eac6d63616e5f992e84b6068..6cc0cf2abf1dcbfb67502801be5ee9d732232b8e 100644 (file)
@@ -110,4 +110,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index eb6ff58617a1e9a882798407f3fefd7543a17398..8f775140031683fd9c6f55561d6595a23db0458b 100644 (file)
@@ -208,4 +208,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index b38239ed4fad56d5cae4c7e20da929f5a5e1181f..f15f183305725695f4c259e1ef96a06906993aeb 100644 (file)
@@ -201,4 +201,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 4d194a2f846d77cd5b2aa7409c50a4fea62a6b02..8b4cd5b52c1f8677b821d9ac00642ca76f654bc5 100644 (file)
@@ -172,4 +172,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 842604bc1ae0fe81332772ffde518870316f0fa3..66eacba87c826f60fa7968c9a5ca7a91d85454fc 100644 (file)
@@ -276,9 +276,8 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         msgs += "\n"
         #
         # ----------
-        print
-        print "Results of gradient check by \"%s\" formula:"%self._parameters["ResiduFormula"]
-        print msgs
+        print("\nResults of gradient check by \"%s\" formula:"%self._parameters["ResiduFormula"])
+        print(msgs)
         #
         if self._parameters["PlotAndSave"]:
             f = open(str(self._parameters["ResultFile"])+".txt",'a')
@@ -375,4 +374,4 @@ def dessiner(
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index caca1e7525219dc6b4b7250b861b5bbf69c77897..6684c8b93609c711fda66dac1c39e12c85978458 100644 (file)
@@ -177,4 +177,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 491ea0a5ec89cb3eb07d5eae4dd95ae15cbd5e83..fe21b644bbea9e155d0523e1f0ec4a9e5c8e08ab 100644 (file)
@@ -91,4 +91,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index c09fcf6be00144207dfe8bed4eb5069516717469..8f79f4839fa1c3ca168fef9f6d106fe1140d547e 100644 (file)
@@ -334,13 +334,12 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         #
         # Sorties eventuelles
         # -------------------
-        print
-        print "Results of linearity check by \"%s\" formula:"%self._parameters["ResiduFormula"]
-        print msgs
+        print("\nResults of linearity check by \"%s\" formula:"%self._parameters["ResiduFormula"])
+        print(msgs)
         #
         self._post_run(HO)
         return 0
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index b568207b0a44d6e141c96aa41948aff9a6c03fa5..ca3f98bc41917b9a1a7af797f7ab753529f860f4 100644 (file)
@@ -286,4 +286,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 07b20df078fda1789f665f71219f7a770f476557..e08fd68bdf9e6bced0f0fca3e9cee78e1bce33ce 100644 (file)
@@ -31,9 +31,9 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
     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)
-        print "Results of observer check on all potential variables or commands,"
-        print "         only activated on selected ones by explicit association."
-        print
+        print("Results of observer check on all potential variables or commands,")
+        print("         only activated on selected ones by explicit association.")
+        print("")
         #
         __Xa = 1.+numpy.arange(3.)
         __Xb = numpy.zeros(3)
@@ -71,10 +71,10 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         self.StoredVariables["SimulatedObservationAtOptimum"].store( __YY )
         self.StoredVariables["SimulatedObservationAtCurrentOptimum"].store( __YY )
         #
-        print
+        print("")
         self._post_run()
         return 0
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 68dba9f6c3537056943847960b941bb3a2a599e1..7b7edd0caafa5d6b0016a9e607e919437350c74c 100644 (file)
@@ -272,4 +272,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 671bfa5ee2e5f69de7a7b67f098e634706a7a787..d6c50c1a41d911d37c4cc6cce61882899f93da1d 100644 (file)
@@ -174,4 +174,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index cb712577fa2bbd2e03f35501c1e045f6fd9f5dc7..77d08afa9d9c1452cd8c3efd0210fad12cebbcea 100644 (file)
@@ -191,4 +191,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 9efa49b763090e583406012106d70fd3f568afd8..161fd4ae8a659bc37d89885d2526386953d4c622 100644 (file)
@@ -265,4 +265,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 1ed6440cf9921ab4315b8921929699a144a5efd4..3612f553872432542331dda00a4cee6b620f9b3c 100644 (file)
@@ -191,13 +191,12 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
         #
         # Sorties eventuelles
         # -------------------
-        print
-        print "Results of tangent check by \"%s\" formula:"%self._parameters["ResiduFormula"]
-        print msgs
+        print("\nResults of tangent check by \"%s\" formula:"%self._parameters["ResiduFormula"])
+        print(msgs)
         #
         self._post_run(HO)
         return 0
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')
index 3f1245c918b3eadc6be0ad18cd9e1a634bf09a3c..fdb6b4f1da464af3a56c153c8dc963efce4c531c 100644 (file)
@@ -295,4 +295,4 @@ class ElementaryAlgorithm(BasicObjects.Algorithm):
 
 # ==============================================================================
 if __name__ == "__main__":
-    print '\n AUTODIAGNOSTIC \n'
+    print('\n AUTODIAGNOSTIC \n')