Commit ccee273c authored by Taddeüs Kroes's avatar Taddeüs Kroes

ModSim ass4 taddeus: Added comparison plot script.

parent a9a19711
#!/usr/bin/env python
from sys import argv
from pylab import plot, xlabel, ylabel, show, savefig, ylim, legend
# Collect data
x = []
seq = []
par = []
lines = open('compare.txt').readlines()[1:]
for i in range(len(lines))[::3]:
n = int(lines[i][:-1])
s = float(lines[i + 1][:-1])
p = float(lines[i + 2][:-1])
# Use the minimum of all measurements
if len(x) and x[-1] == n:
if seq[-1] > s:
seq[-1] = s
if par[-1] > p:
par[-1] = p
else:
x.append(n)
seq.append(s)
par.append(p)
# Plot and optionally save data
plot(x, seq, 'o-', label='Sequentieel')
plot(x, par, 'o-', label='Parallel (9 nodes)')
ylim(ymin=0)
legend()
xlabel('Aantal afstandsstappen')
ylabel('Tijd (s)')
if len(argv) > 1:
savefig(argv[1])
show()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment