In [1]:
# reads a file generated by a central run to calculate split times more accurately
import numpy as np
import StringIO
import matplotlib.pyplot as plt
import pylab as P
minIndex = 5
maxIndex = 100
In [2]:
prefix = 'singleplants/scalability_'
column = 'runtimePerStepCentral'
plt.ioff()
averageRuntimes = []
for i in range(minIndex, maxIndex+1):
fileName = prefix+str(i)+'.csv'
data = np.genfromtxt(fileName,dtype=float, delimiter=';', skip_header=0,names=True)
runtimeCentral = data[column]
meanTime = np.mean(runtimeCentral)
stdTime = np.std(runtimeCentral)
averageRuntimes += [(i, meanTime, stdTime)]
mu = meanTime
sigma = stdTime
n, bins, patches = P.hist(runtimeCentral, 50, normed=1, histtype='bar')
P.setp(patches, 'facecolor', 'g', 'alpha', 0.75)
# add a line showing the expected distribution
y = P.normpdf( bins, mu, sigma)
l = P.plot(bins, y, 'k--', linewidth=1.5)
xlabel('Runtime (secs)')
ylabel('Rel frequency')
title(str(i) + ' power plants')
savefig('singleplants/plants_'+str(i)+'.pdf')
plt.figure()
plt.ion()
plt.figure()
averageRuntimes = np.array(averageRuntimes)
#plot(averageRuntimes[:,0],averageRuntimes[:,1], 'rx-')
plt.errorbar(averageRuntimes[:,0], averageRuntimes[:,1], averageRuntimes[:,2])
xlabel('# plants')
ylabel('runtime (secs)')
title('Mean runtimes per #plants')
fig = matplotlib.pyplot.gcf()
fig.set_size_inches(18.5,10.5)
savefig('singleplants/meantimes.pdf')