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
8b5efb1b
Unverified
Commit
8b5efb1b
authored
4 years ago
by
Stephan Philips
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #1 from peendebak/master
Cleanup of param_viewer
parents
0cda90e5
f039a242
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/param_viewer/param_viewer_GUI_main.py
+33
-41
33 additions, 41 deletions
core_tools/GUI/param_viewer/param_viewer_GUI_main.py
with
33 additions
and
41 deletions
core_tools/GUI/param_viewer/param_viewer_GUI_main.py
+
33
−
41
View file @
8b5efb1b
# -*- 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.
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