Skip to content

Commit

Permalink
Chore: Remove the use of np.int
Browse files Browse the repository at this point in the history
  • Loading branch information
LmeSzinc committed May 30, 2023
1 parent 4382782 commit 18cba1f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dev_tools/research_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def project_select_index(self):
Returns:
np.ndarray: Shape (188,), lower index means to be selected first. 1000 for not selected projects.
"""
out = np.ones((PROJECTS.count,), dtype=np.int64) * 1000
out = np.ones((PROJECTS.count,), dtype=int) * 1000
for index, project in enumerate(self.filter):
if index != self.reset_index:
out[project.index] = index
Expand Down
8 changes: 4 additions & 4 deletions module/base/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def random_rectangle_vector(vector, box, random_range=(0, 0, 0, 0), padding=15):
tuple(int), tuple(int): start_point, end_point.
"""
vector = np.array(vector) + random_rectangle_point(random_range)
vector = np.round(vector).astype(np.int)
half_vector = np.round(vector / 2).astype(np.int)
vector = np.round(vector).astype(int)
half_vector = np.round(vector / 2).astype(int)
box = np.array(box) + np.append(np.abs(half_vector) + padding, -np.abs(half_vector) - padding)
center = random_rectangle_point(box)
start_point = center - half_vector
Expand Down Expand Up @@ -86,8 +86,8 @@ def random_rectangle_vector_opted(
tuple(int), tuple(int): start_point, end_point.
"""
vector = np.array(vector) + random_rectangle_point(random_range)
vector = np.round(vector).astype(np.int)
half_vector = np.round(vector / 2).astype(np.int)
vector = np.round(vector).astype(int)
half_vector = np.round(vector / 2).astype(int)
box_pad = np.array(box) + np.append(np.abs(half_vector) + padding, -np.abs(half_vector) - padding)
box_pad = area_offset(box_pad, half_vector)
segment = int(np.linalg.norm(vector) // 70) + 1
Expand Down
2 changes: 1 addition & 1 deletion module/device/method/minitouch.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def insert_swipe(p0, p3, speed=15, min_distance=10):
prev = (-100, -100)
for t in ts:
point = p0 * (1 - t) ** 3 + 3 * p1 * t * (1 - t) ** 2 + 3 * p2 * t ** 2 * (1 - t) + p3 * t ** 3
point = point.astype(np.int).tolist()
point = point.astype(int).tolist()
if np.linalg.norm(np.subtract(point, prev)) < min_distance:
continue

Expand Down
2 changes: 1 addition & 1 deletion module/map/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def match_movable(before, spawn, after, fleets, fleet_step=2):
after = after + fleets
x = len(after)
y = len(before)
distance = np.ones((y, x), dtype=np.int) * base_weight
distance = np.ones((y, x), dtype=int) * base_weight
for i1, g1 in enumerate(before):
for i2, g2 in enumerate(after):
distance[i1, i2] = fleet_step - sum(abs(np.subtract(g1, g2)))
Expand Down
2 changes: 1 addition & 1 deletion module/os/radar.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def __init__(self, config, center=(1140, 226), delta=(11.7, 11.7), radius=5.15):
for y in range(*self.shape[1]):
if np.linalg.norm([x, y]) > radius:
continue
grid_center = np.round(delta * (x, y) + center).astype(np.int)
grid_center = np.round(delta * (x, y) + center).astype(int)
self.grids[(x, y)] = RadarGrid(location=(x, y), image=None, center=grid_center, config=self.config)

def __iter__(self):
Expand Down

0 comments on commit 18cba1f

Please sign in to comment.