Skip to content

Commit 7b46a55

Browse files
committed
apply 2to3 -w -f xrange
1 parent 5d585ea commit 7b46a55

File tree

13 files changed

+14
-14
lines changed

13 files changed

+14
-14
lines changed

jsk_pcl_ros/scripts/color_histogram_visualizer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def plot_hist_hue(self, hist):
111111
plt.subplot(gs[1], facecolor='silver')
112112
else: # matplotlib version < 2.0.0
113113
plt.subplot(gs[1], axisbg='silver')
114-
bars = plt.bar(range(2), hist[-2:], label=["white", "black"],
114+
bars = plt.bar(list(range(2)), hist[-2:], label=["white", "black"],
115115
width=1.0, linewidth=2.0)
116116
bars[0].set_facecolor((1.0, 1.0, 1.0, 1.0))
117117
bars[1].set_facecolor((0.0, 0.0, 0.0, 1.0))

jsk_pcl_ros/scripts/draw_3d_circle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def publish(self):
4343
point_array = PointArrayStamped()
4444
point_array.header.frame_id = self.frame_id
4545
point_array.header.stamp = now
46-
for i in range(self.RESOLUTION + 1) + [0]:
46+
for i in list(range(self.RESOLUTION + 1)) + [0]:
4747
theta = 2 * math.pi / self.RESOLUTION * i
4848
x = self.radius * math.cos(theta)
4949
y = self.radius * math.sin(theta)

jsk_pcl_ros/scripts/extract_top_polygon_likelihood.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def unsubscribe(self):
2929
def callback(self, msg, msg_coef):
3030
if len(msg.polygons) > 0:
3131
#self._pub.publish(msg.histograms[0])
32-
max_index = max(xrange(len(msg.polygons)), key=lambda i: msg.likelihood[i])
32+
max_index = max(range(len(msg.polygons)), key=lambda i: msg.likelihood[i])
3333
res = PolygonArray()
3434
res.header = msg.header
3535
res.polygons = [msg.polygons[max_index]]

jsk_perception/node_scripts/draw_classification_result.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def _draw(self, cls_msg, imgmsg):
3939
rgb = bridge.imgmsg_to_cv2(imgmsg, desired_encoding='rgb8')
4040

4141
n_results = len(cls_msg.labels)
42-
for i in xrange(n_results):
42+
for i in range(n_results):
4343
label = cls_msg.labels[i]
4444
color = self.cmap[label % len(self.cmap)] * 255
4545
legend_size = int(rgb.shape[0] * 0.1)

jsk_perception/node_scripts/rect_array_to_image_marker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def convert(self, msg):
2424
marker.type = ImageMarker2.LINE_LIST
2525
n_colors = min(len(msg.rects), 256)
2626
cmap = jsk_recognition_utils.color.labelcolormap(n_colors)
27-
for rect, rect_i in zip(msg.rects, range(n_colors)):
27+
for rect, rect_i in zip(msg.rects, list(range(n_colors))):
2828
points = [(rect.x, rect.y),
2929
(rect.x, rect.y + rect.height),
3030
(rect.x + rect.width, rect.y + rect.height),

jsk_perception/node_scripts/ssd_object_detector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def image_cb(self, msg):
174174
xmin = max(0, int(np.floor(bbox[1])))
175175
ymax = min(H, int(np.ceil(bbox[2])))
176176
xmax = min(W, int(np.ceil(bbox[3])))
177-
indices = [range(W*y+xmin, W*y+xmax) for y in range(ymin, ymax)]
177+
indices = [list(range(W*y+xmin, W*y+xmax)) for y in range(ymin, ymax)]
178178
indices = np.array(indices, dtype=np.int32).flatten()
179179
indices_msg = PointIndices(header=msg.header, indices=indices)
180180
cluster_indices_msg.cluster_indices.append(indices_msg)

jsk_perception/scripts/create_db_for_feature_based_object_recognition.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def main():
111111
knn.fit(X, y)
112112
y_pred = knn.predict(X)
113113
# validation: must be all 1.0
114-
print(classification_report(y, y_pred, labels=range(len(target_names)),
114+
print(classification_report(y, y_pred, labels=list(range(len(target_names))),
115115
target_names=target_names))
116116

117117

jsk_recognition_utils/node_scripts/rect_array_to_cluster_point_indices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _convert(self, rects_msg, img_height=None, img_width=None):
5757
xmin = max(0, int(np.floor(rect.x)))
5858
ymax = min(H, int(np.ceil(rect.y + rect.height)))
5959
xmax = min(W, int(np.ceil(rect.x + rect.width)))
60-
indices = [range(W*y+xmin, W*y+xmax) for y in range(ymin, ymax)]
60+
indices = [list(range(W*y+xmin, W*y+xmax)) for y in range(ymin, ymax)]
6161
indices_msg.indices = np.array(indices, dtype=np.int32).flatten()
6262
cpi_msg.cluster_indices.append(indices_msg)
6363
self.pub.publish(cpi_msg)

jsk_recognition_utils/python/jsk_recognition_utils/mask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def bounding_rect_of_mask(img, mask):
1313

1414
def descent_closing(mask, init_selem, n_times):
1515
S = init_selem.shape
16-
for i in xrange(n_times):
16+
for i in range(n_times):
1717
selem = np.ones((S[0] * (n_times - i), S[1] * (n_times - i)))
1818
mask = binary_closing(mask, selem=selem)
1919
return mask

posedetectiondb/src/GatherDetectionResults.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def UniformlySampleSpace(self,bandwidth,bandthresh,delta=0.02):
7878
kdtree = pyANN.KDTree(self.measurements/bandwidth)
7979
sampledists = zeros(samplepoints.shape[0])
8080
goodpoints = []
81-
for i in xrange(samplepoints.shape[0]):
81+
for i in range(samplepoints.shape[0]):
8282
neighs,dists,kball = kdtree.kFRSearchArray(samplepoints[i:(i+1),:],5.0**2,32,0.0001)
8383
sampledists[i] = sum(exp(-dists[neighs>=0]))
8484
uniformpoints = samplepoints[sampledists>bandthresh,:]*bandwidth
@@ -90,7 +90,7 @@ def Prune(self,rawposes, nsize, thresh2, neighsize,giveupiters=100):
9090
"""rawposes is Nx7"""
9191
iter = 1
9292
poses = array(rawposes)
93-
indices = range(poses.shape[0])
93+
indices = list(range(poses.shape[0]))
9494
N = poses.shape[0]
9595
nochange=0
9696
while N > nsize:

0 commit comments

Comments
 (0)