s421818-plots/diagrams.py

43 lines
879 B
Python
Raw Normal View History

2020-04-21 16:53:53 +02:00
import matplotlib.pyplot as plt
import sys
import re
ssr = open("ssr.txt", "r")
wer = open("wer.txt", "r")
reversedSSR = []
for line in reversed(list(open("ssr.txt"))):
if (re.match('[0-9]+[\.]*[0-9]*\%', line)):
reversedSSR.append(line.replace('%','').replace('\n',''))
if (len(reversedSSR) >= 50):
break
SSR = []
for i in reversed(reversedSSR):
SSR.append(float(i))
reversedWER = []
for line in reversed(list(open("wer.txt"))):
if (re.match('AVG: [0-9]+[\.]*[0-9]*\%', line)):
reversedWER.append(line.replace('%','').replace('\n','').replace('AVG: ',''))
if (len(reversedWER) >= 50):
break
WER = []
for i in reversed(reversedWER):
WER.append(float(i))
plt.plot(SSR)
plt.xlabel('timeline')
plt.ylabel('ssr')
plt.savefig('ssr.png', dpi=800)
plt.close()
plt.plot(WER)
plt.xlabel('timeline')
plt.ylabel('wer')
plt.savefig('wer.png', dpi=800)
plt.close()