Created
December 23, 2015 21:44
-
-
Save asarium/2ce04d7d2ac01b40e66a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pylab as plot | |
import sys | |
averageTime = 0.5 | |
MICROSECONDS_PER_SECOND = 1000000. | |
normalLabel = sys.argv[1] | |
changedLabel = sys.argv[2] | |
def average(time, frametime): | |
startIndex = 0 | |
currentTime = time[startIndex] | |
outTime = [] | |
outFPS = [] | |
for i in range(startIndex + 1, len(time)): | |
if time[i] - currentTime >= averageTime: | |
val = np.mean(frametime[startIndex:i]) | |
outTime.append(time[startIndex]) | |
outFPS.append(val) | |
startIndex = i | |
currentTime = time[i] | |
return outTime, outFPS | |
def adjustData(data): | |
times = data[2:, 0] / MICROSECONDS_PER_SECOND | |
frametimes = data[2:, 1] / MICROSECONDS_PER_SECOND | |
times = times - times[0] | |
frametimes = 1 / frametimes | |
return average(times, frametimes) | |
normalData = np.genfromtxt("normal.csv", delimiter=';') | |
changedData = np.genfromtxt("changed.csv", delimiter=';') | |
nT, nF = adjustData(normalData) | |
cT, cF = adjustData(changedData) | |
plot.plot(nT, nF, label=normalLabel) | |
plot.plot(cT, cF, label=changedLabel) | |
plot.xlabel("Mission time") | |
plot.ylabel("FPS") | |
plot.legend(loc=1) | |
plot.savefig("image.png") | |
#plot.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment