Aggregating Velocity Data

In this notebook, we will write a code to gather velocity data from all the drives we have done so far.

[1]:
from strym import strymread
import strym
import glob
import pandas as pd
import os
Loading BokehJS ...
[2]:
parentfolder = "../../PandaData/"
csvlist = []
folderlist = glob.glob(parentfolder+"*")
speedlist = []
for datafolder in folderlist:
    csvlisttmp = glob.glob(datafolder+"/*.csv")
    for f in csvlisttmp:
        if "CAN" not in f:
            continue
        csvlist.append(f)

[3]:
vel_directory = '../../speed/'
if not os.path.exists(vel_directory):
    os.mkdir(vel_directory)
for csv in csvlist:
    print("\nReading the CSV file {}".format(csv))
    pathsplit = csv.split('/')
    speedfile = vel_directory + pathsplit[-1][0:-4] + "_speed.csv"
    if os.path.exists(speedfile):
        continue

    r = strymread(csvfile=csv)
    if r.success == True :
        speed = r.speed()
        print("Writing Speed Data to CSV file {}\n".format(speedfile))
        speed.to_csv(speedfile)