From 8e88e1fa4f153be32e26a56b576f8eb671f212a6 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Sun, 19 Mar 2017 21:46:39 +0100 Subject: [PATCH] Range and dictionary key handling improvement --- src/daComposant/daAlgorithms/AdjointTest.py | 2 +- src/daComposant/daAlgorithms/Blue.py | 2 +- src/daComposant/daAlgorithms/GradientTest.py | 6 +++--- src/daComposant/daAlgorithms/LinearityTest.py | 2 +- src/daComposant/daAlgorithms/TangentTest.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/daComposant/daAlgorithms/AdjointTest.py b/src/daComposant/daAlgorithms/AdjointTest.py index 92ae2f3..78088e3 100644 --- a/src/daComposant/daAlgorithms/AdjointTest.py +++ b/src/daComposant/daAlgorithms/AdjointTest.py @@ -83,7 +83,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): Ha = HO["Adjoint"].appliedInXTo # # ---------- - Perturbations = [ 10**i for i in xrange(self._parameters["EpsilonMinimumExponent"],1) ] + Perturbations = [ 10**i for i in range(self._parameters["EpsilonMinimumExponent"],1) ] Perturbations.reverse() # X = numpy.asmatrix(numpy.ravel( Xb )).T diff --git a/src/daComposant/daAlgorithms/Blue.py b/src/daComposant/daAlgorithms/Blue.py index 00c429d..a382264 100644 --- a/src/daComposant/daAlgorithms/Blue.py +++ b/src/daComposant/daAlgorithms/Blue.py @@ -79,7 +79,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # # Utilisation éventuelle d'un vecteur H(Xb) précalculé (sans cout) # ---------------------------------------------------------------- - if HO["AppliedToX"] is not None and HO["AppliedToX"].has_key("HXb"): + if HO["AppliedToX"] is not None and "HXb" in HO["AppliedToX"]: HXb = HO["AppliedToX"]["HXb"] else: HXb = Hm * Xb diff --git a/src/daComposant/daAlgorithms/GradientTest.py b/src/daComposant/daAlgorithms/GradientTest.py index 66eacba..e81fd57 100644 --- a/src/daComposant/daAlgorithms/GradientTest.py +++ b/src/daComposant/daAlgorithms/GradientTest.py @@ -109,7 +109,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): Ht = HO["Tangent"].appliedInXTo # # ---------- - Perturbations = [ 10**i for i in xrange(self._parameters["EpsilonMinimumExponent"],1) ] + Perturbations = [ 10**i for i in range(self._parameters["EpsilonMinimumExponent"],1) ] Perturbations.reverse() # X = numpy.asmatrix(numpy.ravel( Xb )).T @@ -286,7 +286,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # Residus = self.StoredVariables["Residu"][-len(Perturbations):] if self._parameters["ResiduFormula"] in ["Taylor", "TaylorOnNorm"]: - PerturbationsCarre = [ 10**(2*i) for i in xrange(-len(NormesdFXGdX)+1,1) ] + PerturbationsCarre = [ 10**(2*i) for i in range(-len(NormesdFXGdX)+1,1) ] PerturbationsCarre.reverse() dessiner( Perturbations, @@ -336,7 +336,7 @@ def dessiner( __g('set grid') __g('set autoscale') __g('set title "'+titre+'"') - # __g('set xrange [] reverse') + # __g('set range [] reverse') # __g('set yrange [0:2]') # if logX: diff --git a/src/daComposant/daAlgorithms/LinearityTest.py b/src/daComposant/daAlgorithms/LinearityTest.py index 8f79f48..d4ca039 100644 --- a/src/daComposant/daAlgorithms/LinearityTest.py +++ b/src/daComposant/daAlgorithms/LinearityTest.py @@ -98,7 +98,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # # Construction des perturbations # ------------------------------ - Perturbations = [ 10**i for i in xrange(self._parameters["EpsilonMinimumExponent"],1) ] + Perturbations = [ 10**i for i in range(self._parameters["EpsilonMinimumExponent"],1) ] Perturbations.reverse() # # Calcul du point courant diff --git a/src/daComposant/daAlgorithms/TangentTest.py b/src/daComposant/daAlgorithms/TangentTest.py index 3612f55..ca81ee5 100644 --- a/src/daComposant/daAlgorithms/TangentTest.py +++ b/src/daComposant/daAlgorithms/TangentTest.py @@ -91,7 +91,7 @@ class ElementaryAlgorithm(BasicObjects.Algorithm): # # Construction des perturbations # ------------------------------ - Perturbations = [ 10**i for i in xrange(self._parameters["EpsilonMinimumExponent"],1) ] + Perturbations = [ 10**i for i in range(self._parameters["EpsilonMinimumExponent"],1) ] Perturbations.reverse() # # Calcul du point courant -- 2.39.2