Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
core_tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
QuTech QDLabs
core_tools
Commits
0cda90e5
Unverified
Commit
0cda90e5
authored
4 years ago
by
Stephan Philips
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #2 from peendebak/feat/virtual_matrix_gui
fix labels of virtual matrix in GUI
parents
0bf36815
8432db0f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core_tools/GUI/virt_gate_matrix/virt_gate_matrix_main.py
+21
-14
21 additions, 14 deletions
core_tools/GUI/virt_gate_matrix/virt_gate_matrix_main.py
with
21 additions
and
14 deletions
core_tools/GUI/virt_gate_matrix/virt_gate_matrix_main.py
+
21
−
14
View file @
0cda90e5
from
typing
import
List
from
core_tools.GUI.virt_gate_matrix.virt_gate_matrix_window
import
Ui_MainWindow
from
PyQt5
import
QtCore
,
QtGui
,
QtWidgets
from
functools
import
partial
...
...
@@ -18,7 +19,7 @@ class virt_gate_matrix_GUI(QtWidgets.QMainWindow, Ui_MainWindow):
self
.
gates_object
.
hardware
.
AWG_to_dac_conversion
=
pulse_lib
.
AWG_to_dac_ratio
# reassigning since python pointers do not really work in python :( (<3<3<3 c++)
pulse_lib
.
AWG_to_dac_ratio
=
self
.
gates_object
.
hardware
.
AWG_to_dac_conversion
# set graphical user interface
self
.
app
=
QtCore
.
QCoreApplication
.
instance
()
if
self
.
app
is
None
:
...
...
@@ -31,7 +32,7 @@ class virt_gate_matrix_GUI(QtWidgets.QMainWindow, Ui_MainWindow):
for
gate
in
pulse_lib
.
AWG_to_dac_ratio
:
if
gate
not
in
pulse_lib
.
awg_markers
:
self
.
add_gate
(
gate
)
self
.
add_spacer
()
...
...
@@ -80,13 +81,13 @@ class virt_gate_matrix_GUI(QtWidgets.QMainWindow, Ui_MainWindow):
db_ratio
.
setValue
(
20
*
np
.
log10
(
self
.
pulse_lib
.
AWG_to_dac_ratio
[
gate_name
]))
db_ratio
.
valueChanged
.
connect
(
partial
(
self
.
update_db_ratio
,
gate_name
))
self
.
verticalLayout_3
.
addWidget
(
db_ratio
)
self
.
AWG_attentuation_local_data
[
gate_name
]
=
(
v_ratio
,
db_ratio
)
def
update_db_ratio
(
self
,
gate_name
):
'''
On change of the db ratio, update the voltage ratio to the corresponding value + update in the virtual gate matrixes.
Args:
gate_name (str) : name of the gate the is being updated
'''
...
...
@@ -100,7 +101,7 @@ class virt_gate_matrix_GUI(QtWidgets.QMainWindow, Ui_MainWindow):
def
update_v_ratio
(
self
,
gate_name
):
'''
On change of the voltage ratio, update the db ratio to the corresponding value + update in the virtual gate matrixes.
Args:
gate_name (str) : name of the gate the is being updated
'''
...
...
@@ -156,19 +157,19 @@ class virt_gate_matrix_GUI(QtWidgets.QMainWindow, Ui_MainWindow):
tableWidget
.
setRowCount
(
len
(
virtual_gate_set
))
for
i
in
range
(
len
(
virtual_gate_set
)):
item
=
QtWidgets
.
QTableWidgetItem
()
tableWidget
.
set
Vertic
alHeaderItem
(
i
,
item
)
tableWidget
.
set
Horizont
alHeaderItem
(
i
,
item
)
item
.
setText
(
_translate
(
"
MainWindow
"
,
virtual_gate_set
.
real_gate_names
[
i
]))
item
=
QtWidgets
.
QTableWidgetItem
()
tableWidget
.
set
Horizont
alHeaderItem
(
i
,
item
)
tableWidget
.
set
Vertic
alHeaderItem
(
i
,
item
)
item
.
setText
(
_translate
(
"
MainWindow
"
,
virtual_gate_set
.
virtual_gate_names
[
i
]))
tableWidget
.
horizontalHeader
().
setDefaultSectionSize
(
65
)
tableWidget
.
horizontalHeader
().
setMaximumSectionSize
(
100
)
tableWidget
.
horizontalHeader
().
setMinimumSectionSize
(
30
)
tableWidget
.
verticalHeader
().
setDefaultSectionSize
(
37
)
gridLayout
.
addWidget
(
tableWidget
,
0
,
0
,
1
,
1
)
update_list
=
[]
for
i
in
range
(
len
(
virtual_gate_set
)):
for
j
in
range
(
len
(
virtual_gate_set
)):
...
...
@@ -192,7 +193,7 @@ class virt_gate_matrix_GUI(QtWidgets.QMainWindow, Ui_MainWindow):
doubleSpinBox
.
setSingleStep
(
0.01
)
doubleSpinBox
.
setDecimals
(
3
)
doubleSpinBox
.
setValue
(
virtual_gate_set
.
virtual_gate_matrix
[
i
,
j
])
doubleSpinBox
.
setObjectName
(
"
doubleSpinBox
"
)
doubleSpinBox
.
setObjectName
(
f
'
doubleSpinBox
-
{
i
}
-
{
j
}
'
)
doubleSpinBox
.
valueChanged
.
connect
(
partial
(
self
.
linked_result
,
virtual_gate_set
.
virtual_gate_matrix
,
i
,
j
,
doubleSpinBox
))
update_list
.
append
((
i
,
j
,
doubleSpinBox
))
tableWidget
.
setCellWidget
(
i
,
j
,
doubleSpinBox
)
...
...
@@ -207,16 +208,22 @@ class virt_gate_matrix_GUI(QtWidgets.QMainWindow, Ui_MainWindow):
matrix
[
i
,
j
]
=
spin_box
.
value
()
self
.
gates_object
.
hardware
.
sync_data
()
def
update_v_gates
(
self
,
matrix
,
update_list
):
for
i
,
j
,
spin_box
in
update_list
:
def
update_v_gates
(
self
,
matrix
:
np
.
ndarray
,
update_list
:
List
[
QtWidgets
.
QDoubleSpinBox
]):
"""
Update the virtual gate matrix elements
Args:
matrix: Array with new values
update_list: List with GUI boxes
"""
for
row
,
column
,
spin_box
in
update_list
:
if
not
spin_box
.
hasFocus
():
spin_box
.
setValue
(
matrix
[
i
,
j
])
spin_box
.
setValue
(
matrix
[
row
,
column
])
if
__name__
==
"
__main__
"
:
import
sys
from
V2_software.pulse_lib_config.Init_pulse_lib_debug
import
return_pulse_lib
import
qcodes
as
qc
from
V2_software.drivers.virtual_gates.examples.hardware_example
import
hardware_example
from
V2_software.drivers.virtual_gates.examples.hardware_example
import
hardware_example
from
V2_software.drivers.virtual_gates.instrument_drivers.virtual_dac
import
virtual_dac
from
V2_software.drivers.virtual_gates.instrument_drivers.gates
import
gates
...
...
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