s452097-plots/plotCreator.py

40 lines
862 B
Python
Raw Permalink Normal View History

2020-04-03 19:12:13 +02:00
import matplotlib.pyplot as plt
import numpy as np
2020-04-03 20:51:44 +02:00
def readFile(file, y):
2020-04-03 19:12:13 +02:00
with open(file, 'r') as inFile:
2020-04-03 20:08:32 +02:00
for line in inFile:
2020-04-03 20:55:01 +02:00
y.append(float(line.strip()))
2020-04-03 20:58:32 +02:00
return y;
2020-04-03 19:12:13 +02:00
2020-04-03 19:52:09 +02:00
def createplotWER():
2020-04-03 20:43:48 +02:00
y = []
2020-04-03 20:58:32 +02:00
y = readFile('werForPlot.txt', y)
2020-04-03 19:12:13 +02:00
fig, ax = plt.subplots()
2020-04-03 21:02:38 +02:00
ax.plot(list(range(1, len(y) + 1)), y)
2020-04-03 19:40:36 +02:00
ax.set(xlabel='Build number', ylabel='Percent [%]',
2020-04-03 19:39:11 +02:00
title='Metric for ASR')
2020-04-03 19:12:13 +02:00
ax.grid()
2020-04-03 19:52:09 +02:00
fig.savefig('wer.png')
plt.show()
def createplotSRR():
2020-04-03 20:43:48 +02:00
x = []
y = []
2020-04-03 20:58:32 +02:00
y = readFile('srrForPlot.txt', y)
2020-04-03 19:52:09 +02:00
fig, ax = plt.subplots()
2020-04-03 21:02:38 +02:00
ax.plot(list(range(1, len(y) + 1)), y)
2020-04-03 19:52:09 +02:00
ax.set(xlabel='Build number', ylabel='Percent [%]',
title='Metric for ASR')
ax.grid()
fig.savefig('srr.png')
2020-04-03 19:12:13 +02:00
plt.show()
if __name__ == '__main__':
2020-04-03 19:52:09 +02:00
createplotWER()
createplotSRR()