BUG: Remove uses of xrange for py3 compatibility.

This commit is contained in:
Stefan van der Walt
2012-08-20 15:25:40 -07:00
parent 39569e8f9e
commit 1c3aeec2a8
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ def diamond(radius, dtype=np.uint8):
are 1 and 0 otherwise.
"""
half = radius
(I, J) = np.meshgrid(xrange(0, radius * 2 + 1), xrange(0, radius * 2 + 1))
(I, J) = np.meshgrid(range(0, radius * 2 + 1), range(0, radius * 2 + 1))
s = np.abs(I - half) + np.abs(J - half)
return np.array(s <= radius, dtype=dtype)
@@ -14,7 +14,7 @@ def test_grey():
# we expect 4 segments:
assert_equal(len(np.unique(seg)), 4)
# that mostly respect the 4 regions:
for i in xrange(4):
for i in range(4):
hist = np.histogram(img[seg == i], bins=[0, 0.1, 0.3, 0.5, 1])[0]
assert_greater(hist[i], 40)
@@ -16,7 +16,7 @@ def test_grey():
# we expect 4 segments:
assert_equal(len(np.unique(seg)), 4)
# that mostly respect the 4 regions:
for i in xrange(4):
for i in range(4):
hist = np.histogram(img[seg == i], bins=[0, 0.1, 0.3, 0.5, 1])[0]
assert_greater(hist[i], 20)