#!/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)")