diff --git a/pysis/binning/abstract.py b/pysis/binning/abstract.py index b373874..436c302 100644 --- a/pysis/binning/abstract.py +++ b/pysis/binning/abstract.py @@ -3,6 +3,7 @@ from collections import namedtuple from itertools import izip from abc import ABCMeta, abstractmethod +from six.moves import range __all__ = [ @@ -61,7 +62,7 @@ def _iterkeys(bin): def iterbounds(self): """An iterator over each bins bounds.""" - for bin_num in xrange(self.num_bins): + for bin_num in range(self.num_bins): yield self.get_bounds(bin_num) def iterbins_bounds(self): diff --git a/pysis/binning/bounded.py b/pysis/binning/bounded.py index 8c83e37..a8b2168 100644 --- a/pysis/binning/bounded.py +++ b/pysis/binning/bounded.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from bisect import bisect +from six.moves import range from .abstract import AbstractBinnedKeys @@ -19,7 +20,7 @@ def __init__(self, bounds): self.max_value = bounds[-1] self.num_bins = len(bounds) - 1 - self.bins = [[] for _ in xrange(self.num_bins)] + self.bins = [[] for _ in range(self.num_bins)] def get_bin_index(self, value): """Used to get the index of the bin to place a particular value.""" diff --git a/pysis/binning/const_width.py b/pysis/binning/const_width.py index a15e221..0df6289 100644 --- a/pysis/binning/const_width.py +++ b/pysis/binning/const_width.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from math import ceil +from six.moves import range from .abstract import AbstractBinnedKeys @@ -24,7 +25,7 @@ def __init__(self, min_value, max_value, num_bins=None, max_bin_size=None): self.num_bins = int(num_bins) self.bin_size = (self.max_value - self.min_value) / self.num_bins - self.bins = [[] for _ in xrange(self.num_bins)] + self.bins = [[] for _ in range(self.num_bins)] def get_bin_index(self, value): """Used to get the index of the bin to place a particular value.""" diff --git a/pysis/binning/geometric.py b/pysis/binning/geometric.py index 70f4653..969dc03 100644 --- a/pysis/binning/geometric.py +++ b/pysis/binning/geometric.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from math import log, ceil +from six.moves import range from .abstract import AbstractBinnedKeys @@ -24,7 +25,7 @@ def __init__(self, min_value, max_value): self.max_value = pow(2.0, self.num_bins / 2.0) * self.min_value self.num_bins = int(self.num_bins) - self.bins = [[] for _ in xrange(self.num_bins)] + self.bins = [[] for _ in range(self.num_bins)] def get_bin_index(self, value): """Used to get the index of the bin to place a particular value."""