-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimePlot100.py
More file actions
67 lines (58 loc) · 1.88 KB
/
timePlot100.py
File metadata and controls
67 lines (58 loc) · 1.88 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import numpy as np
import matplotlib as mpl
mpl.use("Agg")
from matplotlib import pyplot as mplot
import csv
#declaring the lists
listScore = []
listCommit = []
#opening the file which holds the data with time
f = open("master/dataWithTime100","a")
with open("master/normData/time100Norm") as g:
i = int(1)
for line in g:
#skipping writing the first line as this contains the header
if i!=1:
f.write(line)
i = i+1
f.close()
g.close()
with open("master/dataWithTime100") as csvfile:
#reading in the data against commits/time file
reader = csv.DictReader(csvfile)
i = int(0)
for row in reader:
#storing the values in the Score columns in a list
listScore.append(row['Score'])
listCommit.append(i)
i=i+1
#converting the lists to arrays so can plot
arrScore = np.asarray(listScore)
arrCommit = np.asarray(listCommit)
arrScore = arrScore.astype(np.float)
#plotting the graph
mplot.plot(arrCommit,arrScore,'k')
#labeling the graph
mplot.xlabel('Relative commit number (highest is most recent)')
mplot.ylabel('Relative Throughput Score/ op/s')
mplot.title('Score over time, noRows=100')
#saving the plot as a png file
mplot.savefig("TimePlot100.png")
#plotting a figure with only the most recent 10 results in
listLen = len(listScore)
if listLen <= 10:
mplot.savefig("TimePlotTen100.png")
else:
listTenScore = []
mplot.clf()
for i in range(0,10):
listTenScore.append(listScore[listLen-10+i])
arrTenScore = np.asarray(listTenScore)
arrTenCommit = np.asarray([0,1,2,3,4,5,6,7,8,9])
mplot.plot(arrTenCommit,arrTenScore,'k')
#labeling the graph
mplot.xlabel('Relative commit number (highest is most recent)')
mplot.ylabel('Relative Throughput Score/ op/s')
mplot.title('Score over last 10, noRows=100')
#saving the plot as a png file
mplot.savefig("TimePlotTen100.png")