Skip to content

Commit

Permalink
Address DeprecationWarning: Conversion of an array with ndim > 0 to a…
Browse files Browse the repository at this point in the history
… scalar is deprecated (#260)
  • Loading branch information
hackdna authored Oct 28, 2024
1 parent 9989247 commit b755818
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions forest/bonsai/simulate_gps_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def gen_basic_traj(location_start: Tuple[float, float],
time_end = time_start
while traveled < distance:
random_speed = np.random.uniform(speed_range[0], speed_range[1], 1)[0]
random_time = int(np.around(np.random.uniform(30, 120, 1), 0))
random_time = int(np.around(np.random.uniform(30, 120), 0))
mov = random_speed * random_time
if (
traveled + mov > distance
Expand Down Expand Up @@ -800,7 +800,7 @@ def gen_basic_pause(location_start: Tuple[float, float], time_start: float,
if len(t_diff_range) == 2:
random_time = int(
np.around(
np.random.uniform(t_diff_range[0], t_diff_range[1], 1), 0
np.random.uniform(t_diff_range[0], t_diff_range[1]), 0
)
)
else:
Expand All @@ -809,7 +809,7 @@ def gen_basic_pause(location_start: Tuple[float, float], time_start: float,
if len(t_e_range) == 2:
random_time = int(
np.around(
np.random.uniform(t_e_range[0], t_e_range[1], 1), 0
np.random.uniform(t_e_range[0], t_e_range[1]), 0
) - time_start
)
else:
Expand Down Expand Up @@ -1036,7 +1036,7 @@ def remove_data(
sample_dur = int(np.around(60 * cycle * (1 - percentage), 0))
index_all: np.ndarray = np.array([])
for i in range(day):
start = int(np.around(np.random.uniform(0, 60 * cycle, 1), 0))
start = int(np.around(np.random.uniform(0, 60 * cycle), 0))
start += 86400 * i
index_cycle = np.arange(start, start + sample_dur)
if i == 0:
Expand Down

0 comments on commit b755818

Please sign in to comment.