From 86128a6f00e11a06ea03e3b249d5f7db3af64a8a Mon Sep 17 00:00:00 2001 From: Holden Rohrer Date: Mon, 28 Mar 2022 19:13:51 -0400 Subject: more usable framework --- run.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 run.py (limited to 'run.py') diff --git a/run.py b/run.py new file mode 100644 index 0000000..7ff0b74 --- /dev/null +++ b/run.py @@ -0,0 +1,24 @@ +#!/usr/bin/python3 +import os +import re +import pandas as pd +import numpy as np +from regression import velvar, combine_estimates + +robot_velvars = {} +for entry in os.scandir('data'): + if not (entry.is_file() and entry.name.endswith('.csv')): + continue + match = re.match(r'^robot(\d+)_trial(\d+).csv$', entry.name) + if match == None: + continue + robot = int(match.group(1)) + if not robot in robot_velvars: + robot_velvars[robot] = [] + trial = int(match.group(2)) + data = pd.read_csv(entry.path).values + robot_velvars[robot].append(velvar(data, data[0][0])) + +for robot in robot_velvars: + est = [x*1000/3.28 for x in combine_estimates(robot_velvars[robot])] + print(f"robot {robot}'s kick velocity is {est[0]} ± {np.sqrt(est[1])*2} m/s (p > .95)") -- cgit