-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotScript.py
More file actions
75 lines (67 loc) · 2.23 KB
/
plotScript.py
File metadata and controls
75 lines (67 loc) · 2.23 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
68
69
70
71
72
73
74
75
# -*- coding: utf-8 -*-
"""
Plotting as a ln plot the Score/ op/s against
the size of the array for matrix multiplication
"""
import numpy as np
import matplotlib as mpl
mpl.use("Agg")
from matplotlib import pyplot as mplot
import csv
import time
#declaring the lists
listScoreIJK = []
listScoreIKJ = []
listSizeIJK = []
listSizeIKJ = []
with open('testIJK') as csvfile:
#reading in the testIJK csv file
reader = csv.DictReader(csvfile)
i = int(0)
for row in reader:
#storing the values in the Score and noRows columns in two seperate lists
listScoreIJK.append(row['Score'])
listSizeIJK.append(row['Param: noRows'])
i=i+1
#converting the lists to arrays so can plot easily
arrScoreIJK = np.asarray(listScoreIJK)
arrSizeIJK = np.asarray(listSizeIJK)
arrScoreIJK = arrScoreIJK.astype(np.float)
arrSizeIJK = arrSizeIJK.astype(np.float)
#logging the values so plot a (roughly) straight line
#this makes it easier to compare
arrLnScoreIJK = np.log(arrScoreIJK)
arrLnSizeIJK = np.log(arrSizeIJK)
#plotting the graph
mplot.plot(arrLnSizeIJK,arrLnScoreIJK,'k-',label='IJK')
with open('testIKJ') as csvfile:
#reading in the testIKJ csv file
reader = csv.DictReader(csvfile)
i = int(0)
for row in reader:
#storing the values in the Score and noRows columns in two seperate lists
listScoreIKJ.append(row['Score'])
listSizeIKJ.append(row['Param: noRows'])
i=i+1
#converting the lists to arrays so can plot easily
arrScoreIKJ = np.asarray(listScoreIKJ)
arrSizeIKJ = np.asarray(listSizeIKJ)
arrScoreIKJ = arrScoreIKJ.astype(np.float)
arrSizeIKJ = arrSizeIKJ.astype(np.float)
#loggin the values so plot a (roughly) straight line
#this makes it easier to compare
arrLnScoreIKJ = np.log(arrScoreIKJ)
arrLnSizeIKJ = np.log(arrSizeIKJ)
#plotting the graph
mplot.plot(arrLnSizeIKJ,arrLnScoreIKJ,'r-',label='IKJ')
#labeling the graph
mplot.legend()
mplot.xlabel('ln(Size)')
mplot.ylabel('ln(Score/ op/s)')
#creating the filename with the date
filename = 'CompPlot'
theDate = time.strftime("%d-%m-%Y_-%H-%M")
filename += theDate
filename += '.png'
#saving the plot as a png file
mplot.savefig(filename)