Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
86ebe560
Commit
86ebe560
authored
2 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Plot window can opened from command line
parent
0449bba2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!231
Fixes related to plot window
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
b_asic/gui_utils/plot_window.py
+18
-10
18 additions, 10 deletions
b_asic/gui_utils/plot_window.py
b_asic/simulation.py
+7
-0
7 additions, 0 deletions
b_asic/simulation.py
with
25 additions
and
10 deletions
b_asic/gui_utils/plot_window.py
+
18
−
10
View file @
86ebe560
...
...
@@ -6,6 +6,7 @@
import
re
import
sys
from
typing
import
Dict
,
List
,
Optional
,
Tuple
from
matplotlib.backends.backend_qt5agg
import
FigureCanvasQTAgg
as
FigureCanvas
from
matplotlib.backends.backend_qt5agg
import
NavigationToolbar2QT
as
NavigationToolbar
...
...
@@ -32,8 +33,9 @@ class PlotWindow(QDialog):
def
__init__
(
self
,
sim_result
,
sim_result
:
Dict
[
str
,
List
[
complex
]]
,
logger
=
print
,
sfg_name
:
Optional
[
str
]
=
None
,
parent
=
None
,
):
super
().
__init__
(
parent
=
parent
)
...
...
@@ -43,7 +45,12 @@ class PlotWindow(QDialog):
|
Qt
.
WindowMinimizeButtonHint
|
Qt
.
WindowMaximizeButtonHint
)
self
.
setWindowTitle
(
"
Simulation result
"
)
title
=
(
f
"
Simulation results:
{
sfg_name
}
"
if
sfg_name
is
not
None
else
"
Simulation results
"
)
self
.
setWindowTitle
(
title
)
self
.
_auto_redraw
=
False
# Categorise sim_results into inputs, outputs, delays, others
...
...
@@ -187,10 +194,16 @@ class PlotWindow(QDialog):
self
.
_update_legend
()
def
start_simulation_dialog
(
sim_results
:
Dict
[
str
,
List
[
complex
]],
sfg_name
:
Optional
[
str
]
=
None
):
app
=
QApplication
(
sys
.
argv
)
win
=
PlotWindow
(
sim_result
=
sim_results
,
sfg_name
=
sfg_name
)
win
.
exec_
()
# Simple test of the dialog
if
__name__
==
"
__main__
"
:
app
=
QApplication
(
sys
.
argv
)
# sim_res = {"c1": [3, 6, 7], "c2": [4, 5, 5], "bfly1.0": [7, 0, 0], "bfly1.1": [-1, 0, 2], "0": [1, 2, 3]}
sim_res
=
{
'
0
'
:
[
0.5
,
0.5
,
0
,
0
],
'
add1
'
:
[
0.5
,
0.5
,
0
,
0
],
...
...
@@ -199,9 +212,4 @@ if __name__ == "__main__":
'
in1
'
:
[
1
,
0
,
0
,
0
],
'
t1
'
:
[
0
,
1
,
0
,
0
],
}
win
=
PlotWindow
(
# window=None, sim_result=sim_res, sfg_name="hej", logger=print
sim_result
=
sim_res
,
)
win
.
exec_
()
# win.show()
start_simulation_dialog
(
sim_res
,
"
Test data
"
)
This diff is collapsed.
Click to expand it.
b_asic/simulation.py
+
7
−
0
View file @
86ebe560
...
...
@@ -217,3 +217,10 @@ class Simulation:
Clear all current state of the simulation, except for the results and iteration.
"""
self
.
_delays
.
clear
()
def
show
(
self
)
->
None
:
"""
Show the simulation results.
"""
# import here to avoid cyclic imports
from
b_asic.gui_utils.plot_window
import
start_simulation_dialog
start_simulation_dialog
(
self
.
results
,
self
.
_sfg
.
name
)
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