From 43fa75dd0611b34ce6ad5f8809c0cb0ef3bf420e Mon Sep 17 00:00:00 2001 From: marc131183 <marcg99@zedat.fu-berlin.de> Date: Wed, 24 Feb 2021 12:16:54 +0100 Subject: [PATCH] quicksave --- src/conversion_scripts/convert_marc.py | 8 ------ src/robofish/evaluate/evaluate.py | 40 +++++++++++++------------- 2 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/conversion_scripts/convert_marc.py b/src/conversion_scripts/convert_marc.py index ae3faa1..bf68ef3 100644 --- a/src/conversion_scripts/convert_marc.py +++ b/src/conversion_scripts/convert_marc.py @@ -37,13 +37,5 @@ def convertTrajectory(path, save_path, categories): category=categories[1], positions=ar[:, [3, 4]], orientations=ar[:, [5]] ) - # convert orientation from radians to orientation vector - ori_vec = np.array([np.cos(ar[:, 5]), np.sin(ar[:, 5])]).T - # get new trajectory with x, y, ori_x, ori_y - temp = np.append(ar[:, [3, 4]], ori_vec, axis=1) - # convert x,y from m to cm - temp[:, [0, 1]] = temp[:, [0, 1]] * 100 - - new.create_single_entity(type_="fish", name="fish_2", poses=temp, monotonic_step=50) new.validate() new.save(save_path) \ No newline at end of file diff --git a/src/robofish/evaluate/evaluate.py b/src/robofish/evaluate/evaluate.py index 4352d84..3ab7391 100644 --- a/src/robofish/evaluate/evaluate.py +++ b/src/robofish/evaluate/evaluate.py @@ -19,26 +19,26 @@ from typing import Iterable from scipy import stats -def get_all_poses_from_paths(paths: Iterable(str)): - """This function reads all poses from given paths. - - Args: - paths: An array of strings, with files or folders - Returns: - An array, containing poses with the shape [paths][files][entities, timesteps, 4] - """ - # Open all files, shape (paths, files) - files_per_path = [robofish.io.read_multiple_files(p) for p in paths] - - # Read all poses from the files, shape (paths, files) - poses_per_path = [[f.get_poses() for f in files] for files in files_per_path] - - # close all files - for p in files_per_path: - for f in p: - f.close() - - return poses_per_path +# def get_all_poses_from_paths(paths: Iterable(str)): +# """This function reads all poses from given paths. + +# Args: +# paths: An array of strings, with files or folders +# Returns: +# An array, containing poses with the shape [paths][files][entities, timesteps, 4] +# """ +# # Open all files, shape (paths, files) +# files_per_path = [robofish.io.read_multiple_files(p) for p in paths] + +# # Read all poses from the files, shape (paths, files) +# poses_per_path = [[f.get_poses() for f in files] for files in files_per_path] + +# # close all files +# for p in files_per_path: +# for f in p: +# f.close() + +# return poses_per_path def evaluate_speed( -- GitLab