Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
artiq_experiments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nicolas Nunez Barreto
artiq_experiments
Commits
6d0bdd38
Commit
6d0bdd38
authored
Jun 02, 2021
by
Lucas Giardino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug c/artiq + agrego la carga de JSON preexistente
parent
c55d7e6a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
dds_control_interface.py
dds_control_interface.py
+15
-10
No files found.
dds_control_interface.py
View file @
6d0bdd38
...
@@ -17,8 +17,9 @@ from artiq.experiment import *
...
@@ -17,8 +17,9 @@ from artiq.experiment import *
# TODO:
# TODO:
# [ ] Check why amplitude fails to update
# [ ] Check why amplitude fails to update
# [~] Set initial values of inputs to correct ones based on dict
# [✓] Set initial values of inputs to correct ones based on dict
# [~] └ Look for a saved json at start to get initial values
# [✓] └ Look for a saved json at start to get initial values
# [ ] └ Make use of the initial 'state' variable
# [ ] Check inputs
# [ ] Check inputs
# [ ] Add options to specify datafiles
# [ ] Add options to specify datafiles
# [ ] Catch errors and send according popups
# [ ] Catch errors and send according popups
...
@@ -48,6 +49,7 @@ class SingleChannel(QWidget): #{{{
...
@@ -48,6 +49,7 @@ class SingleChannel(QWidget): #{{{
else
:
else
:
self
.
state_params
=
initial_pars
self
.
state_params
=
initial_pars
print
(
self
.
state_params
)
# Each DDS will have each own enablable group
# Each DDS will have each own enablable group
self
.
groupbox
=
QGroupBox
(
name
)
self
.
groupbox
=
QGroupBox
(
name
)
self
.
groupbox
.
setCheckable
(
True
)
self
.
groupbox
.
setCheckable
(
True
)
...
@@ -70,8 +72,9 @@ class SingleChannel(QWidget): #{{{
...
@@ -70,8 +72,9 @@ class SingleChannel(QWidget): #{{{
# Frecuency input {{{
# Frecuency input {{{
self
.
freq_input
=
QDoubleSpinBox
()
self
.
freq_input
=
QDoubleSpinBox
()
self
.
freq_input
.
setPrefix
(
"Frequency: "
)
self
.
freq_input
.
setPrefix
(
"Frequency: "
)
self
.
freq_input
.
setRange
(
1.
,
400.
,
0.1
)
self
.
freq_input
.
setRange
(
1.
,
400.
)
self
.
freq_input
.
setValue
(
self
.
state_params
[
'freq'
])
self
.
freq_input
.
setSingleStep
(
0.1
)
self
.
freq_input
.
setValue
(
self
.
state_params
[
'freq'
]
/
MHz
)
self
.
freq_input
.
setSuffix
(
" MHz"
)
self
.
freq_input
.
setSuffix
(
" MHz"
)
self
.
freq_input
.
valueChanged
.
connect
(
self
.
freq_change
)
self
.
freq_input
.
valueChanged
.
connect
(
self
.
freq_change
)
vbox
.
addWidget
(
self
.
freq_input
)
vbox
.
addWidget
(
self
.
freq_input
)
...
@@ -80,8 +83,9 @@ class SingleChannel(QWidget): #{{{
...
@@ -80,8 +83,9 @@ class SingleChannel(QWidget): #{{{
# Amplitude input {{{
# Amplitude input {{{
self
.
amp_input
=
QDoubleSpinBox
()
self
.
amp_input
=
QDoubleSpinBox
()
self
.
amp_input
.
setPrefix
(
"Amplitude: "
)
self
.
amp_input
.
setPrefix
(
"Amplitude: "
)
self
.
amp_input
.
setRange
(
0.
,
1.
,
0.1
)
self
.
amp_input
.
setRange
(
0.
,
1.
)
self
.
amp_input
.
setValue
(
self
.
state_params
[
'att'
])
self
.
amp_input
.
setSingleStep
(
0.1
)
self
.
amp_input
.
setValue
(
self
.
state_params
[
'amp'
])
self
.
amp_input
.
valueChanged
.
connect
(
self
.
amp_change
)
self
.
amp_input
.
valueChanged
.
connect
(
self
.
amp_change
)
vbox
.
addWidget
(
self
.
amp_input
)
vbox
.
addWidget
(
self
.
amp_input
)
# }}}
# }}}
...
@@ -89,7 +93,8 @@ class SingleChannel(QWidget): #{{{
...
@@ -89,7 +93,8 @@ class SingleChannel(QWidget): #{{{
# Attenuation input {{{
# Attenuation input {{{
self
.
att_input
=
QDoubleSpinBox
()
self
.
att_input
=
QDoubleSpinBox
()
self
.
att_input
.
setPrefix
(
"Attenuation: "
)
self
.
att_input
.
setPrefix
(
"Attenuation: "
)
self
.
att_input
.
setRange
(
0.
,
31.
,
0.1
)
self
.
att_input
.
setRange
(
0.
,
31.
)
self
.
att_input
.
setSingleStep
(
0.1
)
self
.
att_input
.
setValue
(
self
.
state_params
[
'att'
])
self
.
att_input
.
setValue
(
self
.
state_params
[
'att'
])
self
.
att_input
.
setSuffix
(
" dB"
)
self
.
att_input
.
setSuffix
(
" dB"
)
self
.
att_input
.
valueChanged
.
connect
(
self
.
att_change
)
self
.
att_input
.
valueChanged
.
connect
(
self
.
att_change
)
...
@@ -185,7 +190,7 @@ class DDSManager(QWidget): #{{{
...
@@ -185,7 +190,7 @@ class DDSManager(QWidget): #{{{
# Make a default initial parameter dictionary to pass to the channels
# Make a default initial parameter dictionary to pass to the channels
# in case a real one is found, this gets stepped on with the real values
# in case a real one is found, this gets stepped on with the real values
initial_params
=
{
'ch0'
:
None
,
'ch1'
:
None
}
initial_params
=
{
'ch0'
:
None
,
'ch1'
:
None
}
loaded
_params
.
update
(
self
.
load_state
())
initial
_params
.
update
(
self
.
load_state
())
self
.
setWindowTitle
(
"DDS Manager GUI"
)
self
.
setWindowTitle
(
"DDS Manager GUI"
)
layout
=
QGridLayout
()
layout
=
QGridLayout
()
...
@@ -201,7 +206,7 @@ class DDSManager(QWidget): #{{{
...
@@ -201,7 +206,7 @@ class DDSManager(QWidget): #{{{
layout
.
addWidget
(
self
.
laser_2
.
get_widget
(),
0
,
1
)
layout
.
addWidget
(
self
.
laser_2
.
get_widget
(),
0
,
1
)
save_btn
=
QPushButton
(
"Save state"
)
save_btn
=
QPushButton
(
"Save state"
)
save_btn
.
clicked
.
connect
(
self
.
save
)
save_btn
.
clicked
.
connect
(
self
.
save
_state
)
layout
.
addWidget
(
save_btn
,
1
,
0
)
layout
.
addWidget
(
save_btn
,
1
,
0
)
start_btn
=
QPushButton
(
"Start"
)
start_btn
=
QPushButton
(
"Start"
)
...
@@ -210,7 +215,7 @@ class DDSManager(QWidget): #{{{
...
@@ -210,7 +215,7 @@ class DDSManager(QWidget): #{{{
def
load_state
(
self
):
def
load_state
(
self
):
"""Load the JSON parameter dictionary if existent"""
"""Load the JSON parameter dictionary if existent"""
if
!
os
.
path
.
isfile
(
JSON_DATAFILE
):
if
not
os
.
path
.
isfile
(
JSON_DATAFILE
):
return
False
return
False
with
open
(
JSON_DATAFILE
,
"r"
)
as
in_json
:
with
open
(
JSON_DATAFILE
,
"r"
)
as
in_json
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment