99#
1010# IsoSpec is distributed in the hope that it will be useful,
1111# but WITHOUT ANY WARRANTY; without even the implied warranty of
12- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1313#
1414# You should have received a copy of the Simplified BSD Licence
1515# along with IsoSpec. If not, see <https://opensource.org/licenses/BSD-2-Clause>.
2626The current API is implemented in __init__.py, use that instead
2727'''
2828
29- try :
30- xrange
31- except NameError :
32- xrange = range
3329
3430import re
3531from .IsoSpecPy import IsoTotalProb , IsoThreshold
@@ -80,7 +76,7 @@ def __init__(
8076 except KeyError :
8177 raise Exception ("Invalid ISO method" )
8278
83- # Reference to iso needs to be held in this object: it will deallocate masses/lprobs/etc arrays on C++ side if we
79+ # Reference to iso needs to be held in this object: it will deallocate masses/lprobs/etc arrays on C++ side if we
8480 # allow GC to collect it prematurely
8581 self .iso = algo (_stopCondition )
8682
@@ -136,7 +132,7 @@ def getConfs(self):
136132 masses = list (masses )
137133 logProbs = list (logProbs )
138134 confs = []
139- for i in xrange (rows_no ):
135+ for i in range (rows_no ):
140136 confs .append ([x for sublist in isoCounts [i ] for x in sublist ])
141137 return masses , logProbs , confs
142138
@@ -157,7 +153,7 @@ def getConfsNumpy(self):
157153 def splitConf (self , l , offset = 0 ):
158154 conf = []
159155 idx = self .allIsotopeNumber * offset
160- for i in xrange (self .dimNumber ):
156+ for i in range (self .dimNumber ):
161157 conf .append (tuple (l [idx :idx + self ._isotopeNumbers [i ]]))
162158 idx += self ._isotopeNumbers [i ]
163159 return tuple (conf )
@@ -169,7 +165,7 @@ def printConfs(self):
169165 masses , logProbs , isoCounts = self .getConfsRaw ()
170166 confs = []
171167 step = sum (self ._isotopeNumbers )
172- for i in xrange (len (masses )):
168+ for i in range (len (masses )):
173169 confs .append ((masses [i ], logProbs [i ], self .splitConf (isoCounts , i )))
174170
175171 for conf in confs :
@@ -184,7 +180,7 @@ def __init__(self, iso, bin_w):
184180 self .bin_w = bin_w
185181 masses , logProbs , _isoCounts = iso .getConfsRaw ()
186182 dd = defaultdict (Summator )
187- for i in xrange (len (masses )):
183+ for i in range (len (masses )):
188184 dd [float (int (masses [i ]/ bin_w ))* bin_w ].add (math .exp (logProbs [i ]))
189185 for key , val in dd .items ():
190186 self [key ] = val .get ()
0 commit comments