mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-04 14:14:42 +08:00
BUG: Remove uses of xrange for py3 compatibility.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user