Skip to content
Snippets Groups Projects
Commit d64d4f73 authored by ulc0011's avatar ulc0011
Browse files

Overall plot summary, based on radar analysis data #3

parent 68740e8c
No related branches found
No related tags found
No related merge requests found
......@@ -9,10 +9,14 @@ from matplotlib import pyplot as pp
import numpy as np
import copy as cp
from runpy import run_path
import pprint
pp = pprint.PrettyPrinter(indent=4)
#data = np.array([[1, 2, 3, 4, 5],
# [-8, -1, 0, 1, 8]])
a = 0
'''a = 0
b = 1
dict_data = np.load('../input/data.npy').item()
......@@ -34,7 +38,7 @@ for each in k:
j = j + 1
for i in range(0,y):
data[-1-i][j] = dict_data['0'].get(each)['avgProgramStart'][i][1][0]
'''
class Window(QtWidgets.QDialog):
def __init__(self, parent=None):
......@@ -43,18 +47,23 @@ class Window(QtWidgets.QDialog):
# a figure instance to plot on
self.figure = Figure()
#self.ax = self.figure.add_subplot(111)
self.ax = self.figure.add_axes([0.11,0.15,0.6,0.75]) # left,bottom edge, width, height
self.ax = self.figure.add_axes([0.15,0.15,0.68,0.75]) # left,bottom edge, width, height
self.sw = False
# this is the Canvas Widget that displays the `figure`
# it takes the `figure` instance as a parameter to __init__
self.canvas = FigureCanvas(self.figure)
# this is the Navigation widget
# it takes the Canvas widget and a parent
self.toolbar = NavigationToolbar(self.canvas, self)
# Just some button connected to `plot` method
# data loading, we can have more than one y_data! TODO
self.data = run_path("get_data_for_gui.py")
self.plot_data = self.data["plot_summary_data"][1]
# plot structure
self.xlab = "{} [{}]".format(self.plot_data[1]["x_label_name"],self.plot_data[1]["x_label_unit"])
self.ylab = "{} [{}]".format(self.plot_data[0]["arg"],self.plot_data[0]["unit"])
self.button = QtWidgets.QPushButton('Plot')
self.button.clicked.connect(self.plot)
......@@ -84,41 +93,51 @@ class Window(QtWidgets.QDialog):
def change_sw(self):
self.sw = not self.sw
pp.pprint(min(self.plot_data[1]["heat_data"]))
def plot(self):
self.ax.clear()
self.ax = self.figure.add_axes([0.11,0.15,0.6,0.75]) # left,bottom edge, width, height
self.ax = self.figure.add_axes([0.15,0.15,0.68,0.75]) # left,bottom edge, width, height
#ax = self.figure.add_subplot(111)
strMultiplier = self.mult.text()
numMultiplier = float(strMultiplier)
k = list(self.plot_data[1]["lines"])
n = data.shape[b]
idx = np.where(data==np.min(data))
optC = k[idx[0][0]]
optU = k[idx[1][0]]
K = self.plot_data[1]["heat_data"]
n = len(k)
for i in range(0,len(K)):
K[i] = numMultiplier*K[i]
'''X = [x[1] for x in K[i]]
XX = [x[0] for x in K[i]]
M = np.min(X)
idf = i
print(np.where(X==M))
idx = XX[np.where(X==M)]'''
for j in range(0,len(K[i])):
tmp = list(K[i][j])
tmp[0] = numMultiplier*tmp[0]
K[i][j] = tuple(tmp)
for m in range(0,n):
X = [x[0] for x in K[m]]
Y = [x[1] for x in K[m]]
if self.sw:
self.ax.plot(data[:,m],K,label = k[m])
self.ax.plot(Y,X,label = k[m])
else:
self.ax.plot(K,data[:,m],label = k[m])
self.ax.plot(X,Y,label = k[m])
if self.sw:
self.ax.set_ylabel('Frequency [GHz (core)]', fontsize = 14)
self.ax.set_xlabel('Energy summary [J]', fontsize = 14)
self.ax.text(134.6,numMultiplier*1.87,'optimal settings are {} GHz core, {} GHz uncore'.format(optC,optU))
self.ax.set_ylabel(self.xlab, fontsize = 14)
self.ax.set_xlabel(self.ylab, fontsize = 14)
#self.ax.text(M,numMultiplier*0.9*idx,'optimal settings are {}: {} {}, {}: {} {}'.format(self.plot_data[1]["x_label_name"],idx,self.plot_data[1]["x_label_unit"],self.plot_data[1]["func_label_name"],k[idf],self.plot_data[1]["func_label_unit"]))
else:
self.ax.set_xlabel('Frequency [GHz (core)]', fontsize = 14)
self.ax.set_ylabel('Energy summary [J]', fontsize = 14)
self.ax.text(numMultiplier*2,132,'optimal settings are {} GHz core, {} GHz uncore'.format(optC,optU))
self.ax.set_xlabel(self.xlab, fontsize = 14)
self.ax.set_ylabel(self.ylab, fontsize = 14)
#self.ax.text(numMultiplier*idx,0.9*M,'optimal settings are {}: {} {}, {}: {} {}'.format(self.plot_data[1]["x_label_name"],idx,self.plot_data[1]["x_label_unit"],self.plot_data[1]["func_label_name"],k[idf],self.plot_data[1]["func_label_unit"]))
self.ax.tick_params(labelsize = 11)
......@@ -128,7 +147,7 @@ class Window(QtWidgets.QDialog):
handles, labels = self.ax.get_legend_handles_labels()
lgd = self.ax.legend(handles,labels,loc="upper left",bbox_to_anchor=(1,1.025),ncol=1,fontsize='large')
lgd.set_title('Uncore freq [GHz (uncore)]', prop = {'size': 'large'})
lgd.set_title("{} [{}]".format(self.plot_data[1]["func_label_name"],self.plot_data[1]["func_label_unit"]), prop = {'size': 'large'})
self.canvas.draw()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment