From ceb38a85ad5c0c55c20f999ba5e9157c3e9423d2 Mon Sep 17 00:00:00 2001 From: Lorenzo Date: Wed, 10 Feb 2021 10:57:14 +0100 Subject: [PATCH] convert tensors for future compatibility --- monstereo/activity.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/monstereo/activity.py b/monstereo/activity.py index e123dfc..59d4f09 100644 --- a/monstereo/activity.py +++ b/monstereo/activity.py @@ -79,11 +79,15 @@ def check_f_formations(idx, idx_t, centers, angles, radii, social_distance=False # Find the center of o-space as average of two candidates (based on their orientation) for radius in radii: - x_0 = np.array([centers[idx][0], centers[idx][1]]) - x_1 = np.array([centers[idx_t][0], centers[idx_t][1]]) + x_0 = np.array([float(centers[idx][0]), float(centers[idx][1])]) + x_1 = np.array([float(centers[idx_t][0]), float(centers[idx_t][1])]) - mu_0 = np.array([centers[idx][0] + radius * math.cos(theta0), centers[idx][1] - radius * math.sin(theta0)]) - mu_1 = np.array([centers[idx_t][0] + radius * math.cos(theta1), centers[idx_t][1] - radius * math.sin(theta1)]) + mu_0 = np.array([ + float(centers[idx][0]) + radius * math.cos(theta0), + float(centers[idx][1]) - radius * math.sin(theta0)]) + mu_1 = np.array([ + float(centers[idx_t][0]) + radius * math.cos(theta1), + float(centers[idx_t][1]) - radius * math.sin(theta1)]) o_c = (mu_0 + mu_1) / 2 # 1) Verify they are looking inwards.