This commit is contained in:
Ufnow 2020-04-22 00:59:19 +02:00
parent 50d7201e4e
commit 2870be7b73

View File

@ -1,26 +1,37 @@
#!/usr/bin/env python
import matplotlib.pyplot as plt
import sys
fig_wer, ax_wer = plt.subplots()
fig_srr, ax_srr = plt.subplots()
X1, Y1 = [], []
X2, Y2 = [], []
y_num=1
for line in open('wer.txt', 'r'):
Y1.append(float(line[:-1]))
X1.append(y_num)
y_num=y_num+1
def read_file(filename):
values = []
with open(filename) as f:
for line in f:
values.append(float(line.rstrip('\n')))
return values
ax_wer.plot(X1, Y1)
ax_wer.set_title("WER")
fig_wer.savefig('wer.png')
y_num=1
for line in open('srr.txt', 'r'):
Y2.append(float(line[:-1]))
X2.append(y_num)
y_num=y_num+1
def main():
input_file = sys.argv[1]
output_file = sys.argv[2]
ax_srr.plot(X2, Y2)
ax_srr.set_title("SRR")
fig_srr.savefig('srr.png')
# Get values
values = read_file(input_file)
# Setup values
plt.plot(values)
# Set x-label to 'executes'
plt.xlabel('executes')
# Set y-label to 'executes'
ylabel_name = input_file.split('.')[0]
plt.ylabel(ylabel_name)
# Save fig with 800 dpi
plt.savefig(output_file, dpi=800)
plt.close()
if __name__ == "__main__":
main()