Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SGS18-READEX
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Ondrej Vysocky
SGS18-READEX
Commits
86efb314
Commit
86efb314
authored
6 years ago
by
Ivo Peterek
Browse files
Options
Downloads
Patches
Plain Diff
ENH: runing heatmap module
#5
parent
18223dc1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
new_gui/mainMenu.py
+5
-0
5 additions, 0 deletions
new_gui/mainMenu.py
new_gui/modules/heatmap.py
+85
-0
85 additions, 0 deletions
new_gui/modules/heatmap.py
with
90 additions
and
0 deletions
new_gui/mainMenu.py
+
5
−
0
View file @
86efb314
...
...
@@ -6,6 +6,7 @@
#
# WARNING! All changes made in this file will be lost!
from
modules
import
data_plot
from
modules
import
heatmap
from
PyQt5
import
QtCore
,
QtGui
,
QtWidgets
...
...
@@ -39,11 +40,15 @@ class Ui_MainMenu(object):
QtCore
.
QMetaObject
.
connectSlotsByName
(
MainMenu
)
self
.
pushButton_plot
.
clicked
.
connect
(
self
.
_plot
)
self
.
pushButton_heatmap
.
clicked
.
connect
(
self
.
_heatmap
)
def
_plot
(
self
):
main
=
data_plot
.
Window
()
main
.
show
()
def
_heatmap
(
self
):
heatmap
.
draw_heatmap
()
def
retranslateUi
(
self
,
MainMenu
):
_translate
=
QtCore
.
QCoreApplication
.
translate
MainMenu
.
setWindowTitle
(
_translate
(
"
MainMenu
"
,
"
Main menu
"
))
...
...
This diff is collapsed.
Click to expand it.
new_gui/modules/heatmap.py
0 → 100755
+
85
−
0
View file @
86efb314
#!/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
#import plotly.graph_objs as go
#import plotly
import
seaborn
as
sb
;
sb
.
set
()
#import os
data
=
None
# TODO handling data as parameter
def
onclick
(
event
):
idx
=
int
(
np
.
floor
(
event
.
xdata
))
idy
=
int
(
np
.
floor
(
event
.
ydata
))
print
(
'
Indices and content of current cell [{},{}]: {}
'
.
format
(
idx
,
idy
,
data
[
idy
+
1
,
idx
]))
def
draw_heatmap
():
C
=
np
.
loadtxt
(
'
../input/colormap.txt
'
)
cm
=
mpc
.
ListedColormap
(
C
/
255.0
)
'''
data = np.array([[1, 2, 3, 4, 5],
[-3, -1, 1, 3, 5],
[2, 3, 5, 7, 13],
#[9, 1, -2.5, 2, 8],
#[12,1,2,-4,4],
#[1,1,1,1,1],
#[1,1,1,1,1],
[8,8,8,8,8],
[-6,1,1,1,1]])
'''
dict_data
=
np
.
load
(
'
../input/data.npy
'
).
item
()
x
=
len
(
dict_data
[
'
0
'
])
y
=
len
(
dict_data
[
'
0
'
][
'
2.5
'
][
'
avgProgramStart
'
])
k
=
list
(
dict_data
[
'
0
'
].
keys
())
k
.
sort
()
data
=
np
.
zeros
([
y
,
x
])
ky
=
[
'
2.0
'
,
'
2.1
'
,
'
2.2
'
,
'
2.3
'
,
'
2.4
'
,
'
2.5
'
]
j
=
-
1
for
each
in
k
:
j
=
j
+
1
for
i
in
range
(
0
,
y
):
data
[
-
i
-
1
][
j
]
=
dict_data
[
'
0
'
].
get
(
each
)[
'
avgProgramStart
'
][
i
][
1
][
0
]
print
(
data
[
0
,:])
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
=
x
cells_in_column
=
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
'
,
onclick
)
sb
.
set_context
(
'
talk
'
)
hm
=
sb
.
heatmap
(
data
,
annot
=
True
,
annot_kws
=
{
"
size
"
:
cell_font_size
},
fmt
=
"
.3f
"
,
cmap
=
cm
,
square
=
False
,
cbar
=
False
)
hm
.
xaxis
.
tick_top
()
hm
.
set_xticklabels
(
k
,
ha
=
'
center
'
)
#pp.set_xticklabels
hm
.
set_yticklabels
(
ky
,
va
=
'
center
'
)
pp
.
yticks
(
rotation
=
0
)
pp
.
xlabel
(
'
Frequency [GHz (uncore)]
'
)
pp
.
ylabel
(
'
Frequency [GHz (core)]
'
)
pp
.
show
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment