def test_dataPlot_laps(self): """ tests dataPlot() by plotting lap data """ # import data from csv file = "run_04-28-18.csv" device, dataFrame = tools.importData(file) data = tools.getDataLists(device, dataFrame) time = data["Time"] dist = data["Distance"]["imperial"] speed = data["Speed"]["imperial"] hr = data["HeartRate"] time_split = tools.lapData(dist, time) dist_split = tools.lapData(dist, dist) speed_split = tools.lapData(dist, speed) hr_split = tools.lapData(dist, hr) # plot lap data ---------------------------------- print("Plot Lap Data") for lap in range(3): print("lap # ", lap + 1) x = time_split[lap] y = hr_split[lap] tools.dataPlot(x, y, xtitle="X VALUE", ytitle="Y VALUE", title="LAP # {}".format(lap + 1))
def test_getDataLists(self): """ tests getDataLists() by printing out data dictionary. """ vivofit_file = "run_04-28-18.csv" garmin_file = "race_10-04-16.csv" device_v, vivofit_df = tools.importData(vivofit_file) device_g, garmin_df = tools.importData(garmin_file) vivo_dataDict = tools.getDataLists(device_v, vivofit_df) garmin_dataDict = tools.getDataLists(device_g, garmin_df) dataDict = vivo_dataDict # print tree of data dict for key in dataDict: if isinstance(dataDict[key], dict): print(key) subdict = dataDict[key] for subkey in subdict: print("....", subkey) else: print(key)
def test_plotDistribution_all(self): """ tests plotDistribution() using all data """ # import data from csv file = "run_04-28-18.csv" device, dataFrame = tools.importData(file) # full data data = tools.getDataLists(device, dataFrame) time = data["Time"] dist = data["Distance"]["imperial"] speed = data["Speed"]["imperial"] hr = data["HeartRate"] for i in speed, hr: tools.plotDistribution(i)
def test_dataPlot_all(self): """ tests dataPlot() by plotting all data """ # import data from csv file = "run_04-28-18.csv" device, dataFrame = tools.importData(file) # plot all data data = tools.getDataLists(device, dataFrame) time = data["Time"] dist = data["Distance"]["imperial"] speed = data["Speed"]["imperial"] hr = data["HeartRate"] # test plotting full data ---------------------- print("Plot Full Data") tools.dataPlot(time, dist, xtitle="time", ytitle="distance") tools.dataPlot(time, speed, xtitle="time", ytitle="speed") tools.dataPlot(time, hr, xtitle="time", ytitle="hr")
def test_lapData(self): """ test lapData() by printing out all lap data. """ file = "race_11-15-15.csv" device, data = tools.importData(file) dataDict = tools.getDataLists(device, data) time = dataDict["Time"] dist_mi = dataDict["Distance"]["imperial"] dist_km = dataDict["Distance"]["metric"] speed_mi = dataDict["Speed"]["imperial"] speed_km = dataDict["Speed"]["metric"] speed_splits = tools.lapData(dist_km, speed_km) for i in range(len(speed_splits)): print("--------------------------") print("Lap # ", i + 1) print(speed_splits[i])
def test_getStats_all(self): """ tests getStatistics() on all data """ # import data from csv file = "run_04-28-18.csv" device, dataFrame = tools.importData(file) # full data data = tools.getDataLists(device, dataFrame) time = data["Time"] dist = data["Distance"]["imperial"] speed = data["Speed"]["imperial"] hr = data["HeartRate"] x = speed stats = tools.getStats(x) for key in stats: print(key, stats[key])
def test_getStats_laps(self): # import data from csv file = "run_04-28-18.csv" device, dataFrame = tools.importData(file) # full data data = tools.getDataLists(device, dataFrame) time = data["Time"] dist = data["Distance"]["imperial"] speed = data["Speed"]["imperial"] hr = data["HeartRate"] time_split = tools.lapData(dist, time) dist_split = tools.lapData(dist, dist) speed_split = tools.lapData(dist, speed) hr_split = tools.lapData(dist, hr) for i in range(len(speed_split)): print("--------------------------------") print("Lap # ", i + 1) stats = tools.getStats(speed_split[i]) for key in stats: print(key, stats[key])