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
6fa60b81
Commit
6fa60b81
authored
4 years ago
by
Stephan Philips
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' of github.com:stephanlphilips/core_tools
parents
c99dfa18
8b5efb1b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core_tools/GUI/param_viewer/param_viewer_GUI_main.py
+33
-41
33 additions, 41 deletions
core_tools/GUI/param_viewer/param_viewer_GUI_main.py
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
54 additions
and
55 deletions
core_tools/GUI/param_viewer/param_viewer_GUI_main.py
+
33
−
41
View file @
6fa60b81
# -*- coding: utf-8 -*-
from
typing
import
Optional
from
core_tools.GUI.param_viewer.param_viewer_GUI_window
import
Ui_MainWindow
from
PyQt5
import
QtCore
,
QtGui
,
QtWidgets
from
functools
import
partial
import
qcodes
as
qc
from
qcodes
import
Station
import
numpy
as
np
from
dataclasses
import
dataclass
...
...
@@ -15,7 +17,7 @@ class param_data_obj:
class
param_viewer
(
QtWidgets
.
QMainWindow
,
Ui_MainWindow
):
"""
docstring for virt_gate_matrix_GUI
"""
def
__init__
(
self
,
station
,
gates_object
=
None
):
def
__init__
(
self
,
station
:
Station
,
gates_object
:
Optional
[
object
]
=
None
):
if
type
(
station
)
is
not
Station
:
raise
Exception
(
'
Syntax changed, to support RF_settings now supply station
'
)
self
.
real_gates
=
list
()
...
...
@@ -28,10 +30,10 @@ class param_viewer(QtWidgets.QMainWindow, Ui_MainWindow):
try
:
self
.
gates_object
=
self
.
station
.
gates
except
:
raise
ValueError
(
'
Default guess for gates object wrong, please supply manually
'
)
raise
ValueError
(
'
Default guess for gates object wrong, please supply manually
'
)
self
.
_step_size
=
1
#mV
instance_ready
=
True
# set graphical user interface
self
.
app
=
QtCore
.
QCoreApplication
.
instance
()
if
self
.
app
is
None
:
...
...
@@ -40,7 +42,7 @@ class param_viewer(QtWidgets.QMainWindow, Ui_MainWindow):
super
(
QtWidgets
.
QMainWindow
,
self
).
__init__
()
self
.
setupUi
(
self
)
# add RF parameters
for
src_name
in
self
.
gates_object
.
hardware
.
RF_source_names
:
inst
=
getattr
(
station
,
src_name
)
...
...
@@ -69,11 +71,12 @@ class param_viewer(QtWidgets.QMainWindow, Ui_MainWindow):
self
.
show
()
if
instance_ready
==
False
:
self
.
app
.
exec
()
def
_update_step
(
self
,
value
):
self
.
update_step
(
value
())
def
update_step
(
self
,
value
):
def
update_step
(
self
,
value
:
float
):
"""
Update step size of the parameter GUI elements with the specified value
"""
self
.
_step_size
=
value
for
gate
in
self
.
real_gates
:
gate
.
gui_input_param
.
setSingleStep
(
value
)
...
...
@@ -82,23 +85,21 @@ class param_viewer(QtWidgets.QMainWindow, Ui_MainWindow):
self
.
step_size
.
setValue
(
value
)
def
_add_RFset
(
self
,
parameter
):
'''
add a new gate.
def
_add_RFset
(
self
,
parameter
:
qc
.
Parameter
):
'''
Add a new RF.
Args:
parameter (QCoDeS parameter object) : parameter to add.
virtual (bool) : True in case this is a virtual gate.
'''
i
=
len
(
self
.
rf_settings
)
layout
=
self
.
layout_RF
name
=
parameter
.
full_name
unit
=
parameter
.
unit
step_size
=
0.5
division
=
1
if
parameter
.
name
[
0
:
10
]
==
'
frequency
'
:
division
=
1e6
step_size
=
0.1
...
...
@@ -115,13 +116,13 @@ class param_viewer(QtWidgets.QMainWindow, Ui_MainWindow):
set_input
=
QtWidgets
.
QDoubleSpinBox
(
self
.
RFsettings
)
set_input
.
setObjectName
(
name
+
"
_input
"
)
set_input
.
setMinimumSize
(
QtCore
.
QSize
(
100
,
0
))
# TODO collect boundaries out of the harware
set_input
.
setRange
(
-
1e9
,
1e9
)
set_input
.
valueChanged
.
connect
(
partial
(
self
.
_set_set
,
parameter
,
set_input
.
value
,
division
))
set_input
.
setKeyboardTracking
(
False
)
set_input
.
setSingleStep
(
step_size
)
layout
.
addWidget
(
set_input
,
i
,
1
,
1
,
1
)
set_unit
=
QtWidgets
.
QLabel
(
self
.
RFsettings
)
...
...
@@ -130,7 +131,7 @@ class param_viewer(QtWidgets.QMainWindow, Ui_MainWindow):
layout
.
addWidget
(
set_unit
,
i
,
2
,
1
,
1
)
self
.
rf_settings
.
append
(
param_data_obj
(
parameter
,
set_input
,
division
))
def
_add_gate
(
self
,
parameter
,
virtual
):
def
_add_gate
(
self
,
parameter
:
qc
.
Parameter
,
virtual
:
bool
):
'''
add a new gate.
...
...
@@ -145,7 +146,7 @@ class param_viewer(QtWidgets.QMainWindow, Ui_MainWindow):
if
virtual
==
True
:
i
=
len
(
self
.
virtual_gates
)
layout
=
self
.
layout_virtual
name
=
parameter
.
name
unit
=
parameter
.
unit
...
...
@@ -160,7 +161,7 @@ class param_viewer(QtWidgets.QMainWindow, Ui_MainWindow):
voltage_input
=
QtWidgets
.
QDoubleSpinBox
(
self
.
virtualgates
)
voltage_input
.
setObjectName
(
name
+
"
_input
"
)
voltage_input
.
setMinimumSize
(
QtCore
.
QSize
(
100
,
0
))
# TODO collect boundaries out of the harware
voltage_input
.
setRange
(
-
4000
,
4000.0
)
voltage_input
.
valueChanged
.
connect
(
partial
(
self
.
_set_gate
,
parameter
,
voltage_input
.
value
))
...
...
@@ -187,36 +188,24 @@ class param_viewer(QtWidgets.QMainWindow, Ui_MainWindow):
self
.
gates_object
.
hardware
.
sync_data
()
def
_finish_gates_GUI
(
self
):
# MAKE THIS INTO A FOR LOOP
i
=
len
(
self
.
real_gates
)
+
1
spacerItem
=
QtWidgets
.
QSpacerItem
(
20
,
40
,
QtWidgets
.
QSizePolicy
.
Minimum
,
QtWidgets
.
QSizePolicy
.
Expanding
)
self
.
layout_real
.
addItem
(
spacerItem
,
i
,
0
,
1
,
1
)
spacerItem1
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
layout_real
.
addItem
(
spacerItem1
,
0
,
3
,
1
,
1
)
for
items
,
layout_widget
in
[
(
self
.
real_gates
,
self
.
layout_real
),
(
self
.
virtual_gates
,
self
.
layout_virtual
),
(
self
.
rf_settings
,
self
.
layout_RF
)]:
i
=
len
(
items
)
+
1
i
=
len
(
self
.
virtual_gates
)
+
1
spacerItem
=
QtWidgets
.
QSpacerItem
(
20
,
40
,
QtWidgets
.
QSizePolicy
.
Minimum
,
QtWidgets
.
QSizePolicy
.
Expanding
)
layout_widget
.
addItem
(
spacerItem
,
i
,
0
,
1
,
1
)
spacerItem
=
QtWidgets
.
QSpacerItem
(
2
0
,
4
0
,
QtWidgets
.
QSizePolicy
.
Minimum
,
QtWidgets
.
QSizePolicy
.
Expanding
)
self
.
layout_
virtual
.
addItem
(
spacerItem
,
i
,
0
,
1
,
1
)
spacerItem
1
=
QtWidgets
.
QSpacerItem
(
4
0
,
2
0
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
layout_
widget
.
addItem
(
spacerItem
1
,
0
,
3
,
1
,
1
)
spacerItem1
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
layout_virtual
.
addItem
(
spacerItem1
,
0
,
3
,
1
,
1
)
i
=
len
(
self
.
rf_settings
)
+
1
spacerItem
=
QtWidgets
.
QSpacerItem
(
20
,
40
,
QtWidgets
.
QSizePolicy
.
Minimum
,
QtWidgets
.
QSizePolicy
.
Expanding
)
self
.
layout_RF
.
addItem
(
spacerItem
,
i
,
0
,
1
,
1
)
spacerItem1
=
QtWidgets
.
QSpacerItem
(
40
,
20
,
QtWidgets
.
QSizePolicy
.
Expanding
,
QtWidgets
.
QSizePolicy
.
Minimum
)
self
.
layout_RF
.
addItem
(
spacerItem1
,
0
,
3
,
1
,
1
)
self
.
setWindowTitle
(
f
'
Viewer for
{
self
.
gates_object
}
'
)
def
_update_parameters
(
self
):
'''
updates the values of all the gates in the parameterviewer periodically
'''
idx
=
self
.
tab_menu
.
currentIndex
()
idx
=
self
.
tab_menu
.
currentIndex
()
if
idx
==
0
:
params
=
self
.
real_gates
...
...
@@ -232,12 +221,12 @@ class param_viewer(QtWidgets.QMainWindow, Ui_MainWindow):
if
not
param
.
gui_input_param
.
hasFocus
():
param
.
gui_input_param
.
setValue
(
param
.
param_parameter
()
/
param
.
division
)
if
__name__
==
"
__main__
"
:
import
sys
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
...
...
@@ -247,10 +236,13 @@ if __name__ == "__main__":
my_dac_4
=
virtual_dac
(
"
dac_d
"
,
"
virtual
"
)
hw
=
hardware_example
(
"
hw
"
)
hw
.
RF_source_names
=
[]
my_gates
=
gates
(
"
my_gates
"
,
hw
,
[
my_dac_1
,
my_dac_2
,
my_dac_3
,
my_dac_4
])
# app = QtWidgets.QApplication(sys.argv)
# MainWindow = QtWidgets.QMainWindow()
ui
=
param_viewer
(
my_gates
)
station
=
qc
.
Station
(
my_gates
)
ui
=
param_viewer
(
station
,
my_gates
)
# MainWindow.show()
# sys.exit(app.exec_())
\ No newline at end of file
This diff is collapsed.
Click to expand it.
core_tools/GUI/virt_gate_matrix/virt_gate_matrix_main.py
+
21
−
14
View file @
6fa60b81
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