-
Notifications
You must be signed in to change notification settings - Fork 0
/
draw_errors.py
executable file
·45 lines (40 loc) · 1.44 KB
/
draw_errors.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/env python
import glob
import csv
import pylab
import matplotlib.pyplot as plt
import numpy as np
from lmfit.models import SkewedGaussianModel
from scipy.optimize import curve_fit
from scipy.misc import factorial
from scipy.stats import skewnorm
if __name__ == "__main__":
files = glob.glob('2017*_cycles.csv')
for data in files:
print "Parsing {}".format(data)
with open(data, 'r') as csvfile:
xvals = []
errors = []
sched_errors = []
event_key = data.split('_')[0]
reader = csv.reader(csvfile)
for row in reader:
xvals.append(int(row[0]))
errors.append(int(row[1]))
sched_errors.append(int(row[2]))
plt.clf()
plt.plot(xvals, errors)
plt.title('{} Time Prediction Errors'.format(event_key))
plt.ylabel('Error (seconds)')
plt.xlabel('Match')
axes = plt.gca()
axes.set_ylim([-100, min(max(errors), 4000)])
plt.savefig('{}_error.png'.format(event_key))
plt.clf()
plt.plot(xvals, sched_errors)
plt.title('{} Schedule Errors'.format(event_key))
plt.ylabel('Error (seconds)')
plt.xlabel('Match')
axes = plt.gca()
axes.set_ylim([min(sched_errors), min(max(sched_errors), 4000)])
plt.savefig('{}_sched_error.png'.format(event_key))