in scripts/latency.py [0:0]
def plot(aggregated_log_file, x_label='Committee size', legend_position='upper right'):
with open(aggregated_log_file, 'r') as f:
orders = eval(f.read())
for (orders_type, order) in orders.items():
fig = plt.figure()
for (z_value, items) in order.items():
x_values = []
y_values = []
y_err = []
for item in items:
x, y = list(zip(*item))
x = int(x[0])
y = y[15:len(y)-15]
x_values.append(x)
y_values.append(np.mean(y))
y_err.append(np.std(y))
data = list(zip(x_values, y_values, y_err))
data.sort(key=lambda tup: tup[0])
x_values, y_values, y_err = list(zip(*data))
plt.ylim(0, 300)
plt.errorbar(x_values, y_values, yerr=y_err, uplims=True, lolims=True,
label='%s' % z_value, marker='.', alpha=1, dashes=None)
plt.legend(loc=legend_position)
plt.xlabel(x_label)
plt.ylabel('Observed latency (ms)')
plt.savefig('latency-%s.pdf' % orders_type)
print('created figure "latency-%s.pdf".' % orders_type)