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_importData(self): """ tests importData() by reading all csv files in data folder. """ allFiles = os.listdir("..\data") for file in allFiles: device, dataFrame = tools.importData(file) print("-----------------------------------------------") print(file) print(device) print(list(dataFrame.columns))
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])
if os.path.isfile('results/auxoEcoliGames_all.pk') == False: # Concatanate the two files with open('results/auxoEcoliGames_0_20.pk','rb') as inputFile: games1 = pk.load(inputFile) with open('results/auxoEcoliGames_21_end.pk','rb') as inputFile: games2 = pk.load(inputFile) games = dict(games1.items() + games2.items()) with open('results/auxoEcoliGames_all.pk','wb') as outputFile: pk.dump(games,outputFile,-1) else: with open('results/auxoEcoliGames_all.pk','rb') as inputFile: games = pk.load(inputFile) print 'Loading experimental data ...\n' #--- Load the experimental flux data --- day1Rep1Inst = importData(inputFile = 'expData/day1Rep1.txt',delType = 'tab',dataType = 'float') day1Rep1 = day1Rep1Inst.run() day1Rep2Inst = importData(inputFile = 'expData/day1Rep2.txt',delType = 'tab',dataType = 'float') day1Rep2 = day1Rep2Inst.run() day4Rep1Inst = importData(inputFile = 'expData/day4Rep1.txt',delType = 'tab',dataType = 'float') day4Rep1 = day4Rep1Inst.run() day4Rep2Inst = importData(inputFile = 'expData/day4Rep2.txt',delType = 'tab',dataType = 'float') day4Rep2 = day4Rep2Inst.run() #--- Compute the measured fold change in growth of the pairs ---- print 'Computing the fold change in growth ...\n' # First find the average over replicates # Note that the data matrixes should actually be symmetric as (mutant1,mutant2) is the