Commit 0ef646d6 authored by Ivo Peterek's avatar Ivo Peterek

Removing unused files

parent aee53c03
This diff is collapsed.
0 204 0
2 205 0
4 206 1
6 206 1
8 207 2
10 208 2
12 209 2
14 210 3
16 210 3
17 211 3
19 212 4
21 213 4
23 214 5
25 214 5
27 215 5
29 216 6
31 217 6
33 218 7
35 218 7
37 219 7
39 220 8
41 221 8
43 222 9
45 222 9
47 223 9
48 224 10
50 225 10
52 226 10
54 226 11
56 227 11
58 228 12
60 229 12
62 230 12
64 230 13
66 231 13
68 232 14
70 233 14
72 234 14
74 234 15
76 235 15
78 236 16
80 237 16
81 238 16
83 238 17
85 239 17
87 240 17
89 241 18
91 242 18
93 242 19
95 243 19
97 244 19
99 245 20
101 246 20
103 246 21
105 247 21
107 248 21
109 249 22
111 250 22
112 250 22
114 251 23
116 252 23
118 253 24
120 254 24
122 254 24
124 255 25
126 255 25
128 255 26
130 255 26
132 255 26
135 255 27
137 255 27
139 255 28
141 255 28
143 255 29
145 255 29
147 255 29
149 255 30
151 255 30
153 255 31
155 255 31
157 255 31
159 255 32
161 255 32
164 255 33
166 255 33
168 255 33
170 255 34
172 255 34
174 255 35
176 255 35
178 255 36
180 255 36
182 255 36
184 255 37
186 255 37
188 255 38
190 255 38
193 255 38
195 255 39
197 255 39
199 255 40
201 255 40
203 255 40
205 255 41
207 255 41
209 255 42
211 255 42
213 255 43
215 255 43
217 255 43
220 255 44
222 255 44
224 255 45
226 255 45
228 255 45
230 255 46
232 255 46
234 255 47
236 255 47
238 255 47
240 255 48
242 255 48
244 255 49
246 255 49
249 255 50
251 255 50
253 255 50
255 255 51
255 255 51
255 253 51
255 252 51
255 250 51
255 248 51
255 247 51
255 245 51
255 243 51
255 242 51
255 240 51
255 238 51
255 237 51
255 235 51
255 234 51
255 232 51
255 230 51
255 229 51
255 227 51
255 225 51
255 224 51
255 222 51
255 220 51
255 219 51
255 217 51
255 215 51
255 214 51
255 212 51
255 210 51
255 209 51
255 207 51
255 205 51
255 204 51
255 202 51
255 201 51
255 199 51
255 197 51
255 196 51
255 194 51
255 192 51
255 191 51
255 189 51
255 187 51
255 186 51
255 184 51
255 182 51
255 181 51
255 179 51
255 177 51
255 176 51
255 174 51
255 173 51
255 171 51
255 169 51
255 168 51
255 166 51
255 164 51
255 163 51
255 161 51
255 159 51
255 158 51
255 156 51
255 154 51
255 153 51
255 151 51
255 150 51
255 148 51
255 146 51
255 145 51
255 143 51
255 142 51
255 140 51
255 139 51
255 137 51
255 135 51
255 134 51
255 132 51
255 131 51
255 129 51
255 128 51
255 126 51
255 124 51
255 123 51
255 121 51
255 120 51
255 118 51
255 117 51
255 115 51
255 114 51
255 112 51
255 110 51
255 109 51
255 107 51
255 106 51
255 104 51
255 103 51
255 101 51
255 99 51
255 98 51
255 96 51
255 95 51
255 93 51
255 92 51
255 90 51
255 89 51
255 87 51
255 85 51
255 84 51
255 82 51
255 81 51
255 79 51
255 78 51
255 76 51
255 74 51
255 73 51
255 71 51
255 70 51
255 68 51
255 67 51
255 65 51
255 64 51
255 62 51
255 60 51
255 59 51
255 57 51
255 56 51
255 54 51
255 53 51
255 51 51
\ No newline at end of file
#!/usr/bin/env python3
import sys
from PyQt5 import QtGui, QtCore, QtWidgets
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure
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)
class Window(QtWidgets.QDialog):
def __init__(self, ownData = None, parent=None):
super(Window, self).__init__(parent)
# a figure instance to plot on
self.figure = Figure()
#self.ax = self.figure.add_subplot(111)
self.ax = self.figure.add_axes([0.15,0.15,0.68,0.75]) # left,bottom edge, width, height
self.sw = False
self.isCanvasClear = True
self.canvas = FigureCanvas(self.figure)
self.toolbar = NavigationToolbar(self.canvas, self)
self.button2 = QtWidgets.QCheckBox('Switch axes')
self.button2.clicked.connect(self.change_sw)
self.button3 = QtWidgets.QPushButton('Apply multiplier')
self.button3.clicked.connect(self.plot)
self.button4 = QtWidgets.QPushButton('Clear canvas')
self.button4.clicked.connect(self.clearCanvas)
self.bf = QtGui.QFont("Arial",13,QtGui.QFont.Bold)
self.mult = QtWidgets.QLineEdit("1")
self.mult.setAlignment(QtCore.Qt.AlignCenter)
# data loading, we can have more than one y_data! TODO
if not ownData:
self.d = run_path("get_data_for_gui.py")
else:
self.d = ownData
self.data = self.d["plot_summary_data"]
#self.data = self.d["nested_regions_report_data"][0]["plot_data"]
self.combo_reg = QtWidgets.QComboBox(self)
self.combo_reg.addItem('Overall summary')
#TODO - multiple measurements handling (2 in range is ad hoc)
for i in range(0,len(self.d["nested_regions_report_data"]),2):
self.combo_reg.addItem("REGION - {}".format(self.d["nested_regions_report_data"][i]["nested_region"]))
if len(self.data) > 1:
self.combo = QtWidgets.QComboBox(self)
for i in range(0,len(self.data)):
self.combo.addItem(self.data[i][0]["arg"])
# set the layout
layout = QtWidgets.QVBoxLayout()
self.plot_data = self.data[0]
self.lab_reg = QtWidgets.QLabel('Choose Area: ')
self.lab_reg.setFont(self.bf)
hl_reg = QtWidgets.QHBoxLayout()
hl_reg.addWidget(self.lab_reg)
hl_reg.addWidget(self.combo_reg)
self.combo_reg.activated[str].connect(self.chooseReg)
layout.addLayout(hl_reg)
if len(self.data) > 1:
self.label = QtWidgets.QLabel('Choose quantity: ')
self.label.setFont(self.bf)
hl = QtWidgets.QHBoxLayout()
hl.addWidget(self.label)
hl.addWidget(self.combo)
self.combo.activated[str].connect(self.chooseData)
layout.addLayout(hl)
layout.addWidget(self.toolbar)
layout.addWidget(self.canvas)
hlayout = QtWidgets.QHBoxLayout()
hlayout.addWidget(self.mult)
hlayout.addWidget(self.button3)
hlayout2 = QtWidgets.QHBoxLayout()
hlayout2.addWidget(self.button2)
hlayout2.addWidget(self.button4)
layout.addLayout(hlayout)
layout.addLayout(hlayout2)
self.setLayout(layout)
self.plot()
'''if not ownData:
print("Surprise")
else:
print("No surprise")'''
def chooseReg(self, dataLabel):
if dataLabel == "Overall summary":
self.data = self.d["plot_summary_data"]
else:
for i in range(0,len(self.d["nested_regions_report_data"])):
tmp = "REGION - {}".format(self.d["nested_regions_report_data"][i]["nested_region"])
if dataLabel == tmp:
self.data = self.d["nested_regions_report_data"][i]["plot_data"]
self.plot_data = self.data[0]
if len(self.data) > 1:
for i in range(0,len(self.data)):
if str(self.combo.currentText()) == self.data[i][0]["arg"]:
self.plot_data = self.data[i]
self.plot()
def chooseData(self, dataLabel):
for i in range(0,len(self.data)):
if dataLabel == self.data[i][0]["arg"]:
self.plot_data = self.data[i]
self.plot()
def clearCanvas(self):
self.ax.clear()
self.canvas.draw()
self.mult.setText("1")
self.isCanvasClear = True
def change_sw(self):
self.sw = not self.sw
self.plot()
#pp.pprint(self.d["nested_regions_report_data"])
def plot(self):
self.ax.clear()
self.isCanvasClear = False
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"])
K = self.plot_data[1]["heat_data"]
n = len(k)
optx = self.plot_data[1]["optim_x_val"]
optf = self.plot_data[1]["optim_func_label_value"]
ymin = min([y[1] for y in K[0]])
ymax = max([y[1] for y in K[0]])
for i in range(0,len(K)):
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]]
xmin = min(X)
xmax = max(X)
ymin0 = min(Y)
ymax0 = max(Y)
if ymin > ymin0:
ymin = ymin0
if ymax < ymax0:
ymax = ymax0
if self.sw:
self.ax.plot(Y,X,label = k[m])
else:
self.ax.plot(X,Y,label = k[m])
# 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"])
if self.sw:
self.ax.set_ylabel(self.xlab, fontsize = 14)
self.ax.set_xlabel(self.ylab, fontsize = 14)
self.ax.text(ymin,1.25*xmin-0.25*xmax,'optimal settings are {}: {} {}, {}: {} {}'.format(self.plot_data[1]["x_label_name"],optx,self.plot_data[1]["x_label_unit"],self.plot_data[1]["func_label_name"],optf,self.plot_data[1]["func_label_unit"]))
else:
self.ax.set_xlabel(self.xlab, fontsize = 14)
self.ax.set_ylabel(self.ylab, fontsize = 14)
self.ax.text(xmin,1.25*ymin-0.25*ymax,'optimal settings are {}: {} {}, {}: {} {}'.format(self.plot_data[1]["x_label_name"],optx,self.plot_data[1]["x_label_unit"],self.plot_data[1]["func_label_name"],optf,self.plot_data[1]["func_label_unit"]))
self.ax.tick_params(labelsize = 11)
self.ax.grid(linestyle = '--')
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("{} [{}]".format(self.plot_data[1]["func_label_name"],self.plot_data[1]["func_label_unit"]), prop = {'size': 'large'})
self.canvas.draw()
if __name__ == '__main__':
app = QtWidgets.QApplication(sys.argv)
main = Window(1)
main.show()
sys.exit(app.exec_())
\ No newline at end of file
#!/usr/bin/env python3
import matplotlib
from packaging import version
if version.parse(matplotlib.__version__) < version.parse("2.0.3"):
raise Exception("Matplotlib version must be >= 2.0.3, while yours is {}!".format(matplotlib.__version__))
#matplotlib.use('Qt5Agg')
import matplotlib.pyplot as pp
pp.switch_backend('Qt5Agg')
import numpy as np
import matplotlib.colors as mpc
from runpy import run_path
#import plotly.graph_objs as go
#import plotly
import seaborn as sb; sb.set()
#import os
C = np.loadtxt('colormap.txt')
cm = mpc.ListedColormap(C/255.0)
class RadarHeatmap():
def __init__(self, parent=None):
self.D = run_path("get_data_for_gui.py")
self.plot_data = self.D["plot_summary_data"][1]
self.heat_data = self.plot_data[1]["heat_data"]
self.k = self.plot_data[1]["lines"]
self.ky = [h[0] for h in self.heat_data[0]]
self.x = len(self.k)
self.y = len(self.ky)
self.data = np.zeros([self.y,self.x])
for i in range(0,self.x):
self.data[:,i] = [h[1] for h in self.heat_data[i]]
def onclick(self,event):
idx = int(np.floor(event.xdata))
idy = int(np.floor(event.ydata))
print('Indices and content of current cell [{},{}]: {}'.format(idy,idx,self.data[idy,idx]))
def draw_heatmap(self):
cell_font_size = 14
cell_height = 7/360*cell_font_size
cell_width = 4.5*cell_height
marg_top = 0.5
marg_bottom = 0.5
marg_left = 1
marg_right = 0.5
cells_in_row = self.x
cells_in_column = self.y
figwidth= cell_width*cells_in_row+marg_left+marg_right
figheight = cell_height*cells_in_column+marg_top+marg_bottom
fig = pp.figure(figsize=(figwidth, figheight))
fig.subplots_adjust(bottom =marg_bottom/figheight, top=1.-marg_top/figheight, left=marg_left/figwidth, right=1.-marg_right/figwidth)
cid = fig.canvas.mpl_connect('button_press_event', self.onclick)
sb.set_context('talk')
hm = sb.heatmap(self.data, annot=True, annot_kws = {"size": cell_font_size}, fmt=".3f", cmap=cm, square=False, cbar=False)
hm.xaxis.tick_top()
hm.set_xticklabels(self.k, ha = 'center')
#pp.set_xticklabels
hm.set_yticklabels(self.ky, va = 'center')
pp.yticks(rotation=0)
pp.xlabel("{} [{}]".format(self.plot_data[1]["func_label_name"],self.plot_data[1]["func_label_unit"]))
pp.ylabel("{} [{}]".format(self.plot_data[1]["x_label_name"],self.plot_data[1]["x_label_unit"]))
pp.show()
if __name__ == '__main__':
#app = QtWidgets.QApplication(sys.argv)
main = RadarHeatmap()
main.draw_heatmap()
#sys.exit(app.exec_())
\ No newline at end of file
#!/usr/bin/env python3
import sys
import matplotlib
from packaging import version
if version.parse(matplotlib.__version__) < version.parse("2.0.3"):
raise Exception("Matplotlib version must be >= 2.0.3, while yours is {}!".format(matplotlib.__version__))
from PyQt5 import QtGui, QtCore, QtWidgets
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure
import matplotlib.pyplot as pp
pp.switch_backend('Qt5Agg')
import numpy as np
import matplotlib.colors as mpc
from runpy import run_path
#import plotly.graph_objs as go
#import plotly
import seaborn as sb; sb.set()
#import os
C = np.loadtxt('colormap.txt')
cm = mpc.ListedColormap(C/255.0)
class Window(QtWidgets.QDialog):
def __init__(self, ownData = None, parent=None):
super(Window, self).__init__(parent)
if not ownData:
self.d = run_path("get_data_for_gui.py")
else:
self.d = ownData
self.D = self.d["plot_summary_data"]
self.sw = False
self.bf = QtGui.QFont("Arial",13,QtGui.QFont.Bold)
self.nf = QtGui.QFont("Arial",13)
#self.button.clicked.connect(self.draw_heatmap)
self.button2 = QtWidgets.QCheckBox('Switch axes')
self.button2.clicked.connect(self.change_sw)
self.combo_reg = QtWidgets.QComboBox(self)
self.combo_reg.addItem('Overall summary')
#TODO - multiple measurements handling (2 in range is ad hoc)
for i in range(0,len(self.d["nested_regions_report_data"]),2):
self.combo_reg.addItem("REGION - {}".format(self.d["nested_regions_report_data"][i]["nested_region"]))
if len(self.D) > 1:
self.combo = QtWidgets.QComboBox(self)
for i in range(0,len(self.D)):
self.combo.addItem(self.D[i][0]["arg"])
# set the layout
self.layout = QtWidgets.QVBoxLayout()
self.plot_data = self.D[0]
self.lab_reg = QtWidgets.QLabel('Choose Area: ')
self.lab_reg.setFont(self.bf)
hl_reg = QtWidgets.QHBoxLayout()
hl_reg.addWidget(self.lab_reg)
hl_reg.addWidget(self.combo_reg)
hl_reg.addWidget(self.button2)
self.combo_reg.activated[str].connect(self.chooseReg)
self.layout.addLayout(hl_reg)
if len(self.D) > 1:
self.label = QtWidgets.QLabel('Choose quantity: ')
self.label.setFont(self.bf)
hl = QtWidgets.QHBoxLayout()
hl.addWidget(self.label)
hl.addWidget(self.combo)
hl.addWidget(QtWidgets.QLabel(''))
self.combo.activated[str].connect(self.chooseData)
self.layout.addLayout(hl)
self.heat_data = self.plot_data[1]["heat_data"]
self.k = self.plot_data[1]["lines"]
self.ky = [h[0] for h in self.heat_data[0]]
self.x = len(self.k)
self.y = len(self.ky)
self.cell_font_size = 14
self.cell_height = 7/360*self.cell_font_size
self.cell_width = 4.5*self.cell_height
self.marg_top = 0.5
self.marg_bottom = 0.5
self.marg_left = 1
self.marg_right = 0.5
self.figwidth= self.cell_width*self.x + self.marg_left + self.marg_right
self.figheight = self.cell_height*self.y + self.marg_top + self.marg_bottom
# a figure instance to plot on
if self.sw:
self.figure = Figure(figsize=(self.figheight,self.figwidth))
else:
self.figure = Figure(figsize=(self.figwidth,self.figheight))
self.ax = self.figure.add_subplot(111)
self.canvas = FigureCanvas(self.figure)
self.toolbar = NavigationToolbar(self.canvas, self)
self.h2 = QtWidgets.QHBoxLayout()
self.l1 = QtWidgets.QLabel("Indices of clicked cell: ")
self.l1.setFont(self.bf)
self.l2 = QtWidgets.QLabel("Clicked cell value: ")
self.l2.setFont(self.bf)
self.l3 = QtWidgets.QLabel()
self.l3.setFont(self.nf)
self.l4 = QtWidgets.QLabel()
self.l4.setFont(self.nf)
self.h2.addWidget(self.l1)
self.h2.addWidget(self.l3)
self.h2.addWidget(self.l2)
self.h2.addWidget(self.l4)
self.layout.addWidget(self.canvas)
#self.layout.addWidget(self.button)
self.layout.addLayout(self.h2)
self.layout.addWidget(self.toolbar)
self.setLayout(self.layout)
self.draw_heatmap()
def chooseReg(self, dataLabel):
if dataLabel == "Overall summary":
self.D = self.d["plot_summary_data"]
else:
for i in range(0,len(self.d["nested_regions_report_data"])):
tmp = "REGION - {}".format(self.d["nested_regions_report_data"][i]["nested_region"])
if dataLabel == tmp:
self.D = self.d["nested_regions_report_data"][i]["plot_data"]
self.plot_data = self.D[0]
if len(self.D) > 1:
for i in range(0,len(self.D)):
if str(self.combo.currentText()) == self.D[i][0]["arg"]:
self.plot_data = self.D[i]
self.draw_heatmap()
def change_sw(self):
self.sw = not self.sw
self.draw_heatmap()
#self.figure.set_size_inches(self.figheight,self.figwidth, forward = True)
def onclick(self,event):
idx = int(np.floor(event.xdata))
idy = int(np.floor(event.ydata))
#print('Indices and content of current cell [{},{}]: {}'.format(idy,idx,self.data[idy,idx]))
self.l3.setText("[{},{}]".format(idy,idx))
if self.sw:
self.l4.setText(str(self.data[idx,idy]))
else:
self.l4.setText(str(self.data[idy,idx]))
def chooseData(self, dataLabel):
for i in range(0,len(self.D)):
if dataLabel == self.D[i][0]["arg"]:
self.plot_data =<