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
553ba290
Commit
553ba290
authored
6 years ago
by
ulc0011
Browse files
Options
Downloads
Patches
Plain Diff
gg.py replaced with data_plot.py, containing text with optimal parameters
#3
parent
38dd1e82
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
data_plot.py
+163
-0
163 additions, 0 deletions
data_plot.py
with
163 additions
and
0 deletions
data_plot.py
0 → 100644
+
163
−
0
View file @
553ba290
#!/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
#data = np.array([[1, 2, 3, 4, 5],
# [-8, -1, 0, 1, 8]])
a
=
0
b
=
1
dict_data
=
np
.
load
(
'
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
'
]
K
=
list
(
map
(
float
,
ky
))
j
=
-
1
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
):
super
(
Window
,
self
).
__init__
(
parent
)
# a figure instance to plot on
self
.
figure
=
Figure
()
# 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
self
.
button
=
QtWidgets
.
QPushButton
(
'
Plot
'
)
self
.
button
.
clicked
.
connect
(
self
.
plot
)
self
.
button2
=
QtWidgets
.
QPushButton
(
'
Switch axes
'
)
self
.
button2
.
clicked
.
connect
(
self
.
SwitchAxes
)
self
.
button3
=
QtWidgets
.
QPushButton
(
'
Apply multiplier
'
)
self
.
button3
.
clicked
.
connect
(
self
.
plot
)
self
.
mult
=
QtWidgets
.
QLineEdit
(
"
1
"
)
self
.
mult
.
setAlignment
(
QtCore
.
Qt
.
AlignCenter
)
# set the layout
layout
=
QtWidgets
.
QVBoxLayout
()
layout
.
addWidget
(
self
.
toolbar
)
layout
.
addWidget
(
self
.
canvas
)
layout
.
addWidget
(
self
.
button
)
layout
.
addWidget
(
self
.
button2
)
hlayout
=
QtWidgets
.
QHBoxLayout
()
hlayout
.
addWidget
(
self
.
mult
)
hlayout
.
addWidget
(
self
.
button3
)
layout
.
addLayout
(
hlayout
)
self
.
setLayout
(
layout
)
def
plot
(
self
):
ax
=
self
.
figure
.
add_axes
([
0.11
,
0.15
,
0.61
,
0.75
])
# left,bottom edge, width, height
#ax = self.figure.add_subplot(111)
ax
.
clear
()
strMultiplier
=
self
.
mult
.
text
()
numMultiplier
=
float
(
strMultiplier
)
n
=
data
.
shape
[
b
]
idx
=
np
.
where
(
data
==
np
.
min
(
data
))
optC
=
k
[
idx
[
0
][
0
]]
optU
=
k
[
idx
[
1
][
0
]]
for
i
in
range
(
0
,
len
(
K
)):
K
[
i
]
=
numMultiplier
*
K
[
i
]
for
m
in
range
(
0
,
n
):
ax
.
plot
(
K
,
data
[:,
m
],
label
=
k
[
m
])
ax
.
set_xlabel
(
'
Frequency [GHz (core)]
'
,
fontsize
=
14
)
ax
.
set_ylabel
(
'
Energy summary [J]
'
,
fontsize
=
14
)
ax
.
tick_params
(
labelsize
=
11
)
ax
.
grid
(
linestyle
=
'
--
'
)
handles
,
labels
=
ax
.
get_legend_handles_labels
()
lgd
=
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
'
})
ax
.
text
(
2
,
132
,
'
optimal settings are {} GHz core, {} GHz uncore
'
.
format
(
optC
,
optU
))
#pp.tight_layout()
#pp.subplots_adjust(right = 10)
#pp.show(bbox_extra_artists=(lgd,),bbox_inches='tight')
#self.figure.subplot_adjust(right = 0.2)
#ax.xticks(np.arange(0,x),k)
self
.
canvas
.
draw
()
def
SwitchAxes
(
self
):
ax
=
self
.
figure
.
add_subplot
(
111
)
ax
.
clear
()
global
a
# TODO - screw globals
global
b
c
=
cp
.
copy
(
a
)
a
=
cp
.
copy
(
b
)
b
=
cp
.
copy
(
c
)
strMultiplier
=
self
.
mult
.
text
()
numMultiplier
=
float
(
strMultiplier
)
n
=
data
.
shape
[
b
]
if
a
==
0
:
K
=
list
(
map
(
float
,
ky
))
else
:
K
=
list
(
map
(
float
,
k
))
for
i
in
range
(
0
,
len
(
K
)):
K
[
i
]
=
numMultiplier
*
K
[
i
]
for
m
in
range
(
0
,
n
):
ax
.
plot
(
K
,
np
.
transpose
(
data
)[:,
m
])
self
.
canvas
.
draw
()
if
__name__
==
'
__main__
'
:
app
=
QtWidgets
.
QApplication
(
sys
.
argv
)
main
=
Window
()
main
.
show
()
sys
.
exit
(
app
.
exec_
())
\ No newline at end of file
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