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
28e73bbd
Commit
28e73bbd
authored
1 week ago
by
Sander Snoo
Browse files
Options
Downloads
Patches
Plain Diff
"gates" should use virtual matrix as shown in GUI and not the normalized matrix
parent
7b3816ec
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/drivers/gates.py
+5
-4
5 additions, 4 deletions
core_tools/drivers/gates.py
core_tools/drivers/hardware/virtual_gate_matrix.py
+10
-9
10 additions, 9 deletions
core_tools/drivers/hardware/virtual_gate_matrix.py
with
15 additions
and
13 deletions
core_tools/drivers/gates.py
+
5
−
4
View file @
28e73bbd
...
...
@@ -15,6 +15,7 @@ class gates(qc.Instrument):
gates class, generate qcodes parameters for the real gates and the virtual gates
It also manages the virtual gate matrix.
"""
def
__init__
(
self
,
name
,
hardware
,
dac_sources
,
dc_gain
=
{}):
'''
gates object
...
...
@@ -52,9 +53,9 @@ class gates(qc.Instrument):
self
.
_dac_params
[
gate_name
]
=
dac_sources
[
source_index
].
parameters
[
f
'
dac
{
int
(
ch_num
)
}
'
]
self
.
_all_gate_names
.
append
(
gate_name
)
self
.
_real_gates
.
append
(
gate_name
)
self
.
add_parameter
(
gate_name
,
set_cmd
=
partial
(
self
.
_set_voltage
,
gate_name
),
self
.
add_parameter
(
gate_name
,
set_cmd
=
partial
(
self
.
_set_voltage
,
gate_name
),
get_cmd
=
partial
(
self
.
_get_voltage
,
gate_name
),
unit
=
"
mV
"
)
unit
=
"
mV
"
)
# make virtual gates:
for
virt_gate_set
in
self
.
hardware
.
virtual_gates
:
...
...
@@ -135,7 +136,7 @@ class gates(qc.Instrument):
self
.
parameters
[
real_gate
].
set
(
old_voltages
[
real_gate
]
+
ratio
*
delta
)
except
Exception
as
ex
:
logger
.
warning
(
f
'
Failed to set virtual gate voltage to
{
voltage
:
.
1
f
}
mV; Reverting all voltages.
'
f
'
Exception:
{
ex
}
'
)
f
'
Exception:
{
ex
}
'
)
for
real_gate
,
ratio
in
projection
[
gate_name
].
items
():
self
.
set
(
real_gate
,
old_voltages
[
real_gate
])
raise
...
...
@@ -199,7 +200,7 @@ class gates(qc.Instrument):
for
virt_gate_convertor
in
self
.
_virt_gate_convertors
:
real_voltages
=
[
v
[
name
]
for
name
in
virt_gate_convertor
.
real_gates
]
virtual_voltages
=
np
.
matmul
(
virt_gate_convertor
.
r2v_matrix
,
real_voltages
)
virtual_voltages
=
np
.
matmul
(
virt_gate_convertor
.
r2v_matrix
,
real_voltages
)
for
vg_name
,
vg_voltage
in
zip
(
virt_gate_convertor
.
virtual_gates
,
virtual_voltages
):
v
[
vg_name
]
=
vg_voltage
self
.
parameters
[
vg_name
].
cache
.
set
(
vg_voltage
)
...
...
This diff is collapsed.
Click to expand it.
core_tools/drivers/hardware/virtual_gate_matrix.py
+
10
−
9
View file @
28e73bbd
import
numpy
as
np
class
VirtualGateMatrixView
:
'''
Data to convert real gate voltages to virtual gate voltages and v.v.
...
...
@@ -10,6 +11,7 @@ class VirtualGateMatrixView:
virtual_gates (list[str]): names of virtual gates
r2v_matrix (2D array-like): matrix to convert voltages of real gates to voltages of virtual gates.
'''
def
__init__
(
self
,
name
,
real_gates
,
virtual_gates
,
r2v_matrix
,
indices
):
self
.
name
=
name
self
.
_real_gates
=
real_gates
...
...
@@ -34,7 +36,7 @@ class VirtualGateMatrixView:
@property
def
r2v_matrix
(
self
):
# note: self._r2v_matrix may be changed externally. Create indexed copy here.
r2v_matrix
=
self
.
_r2v_matrix
[
self
.
_indices
][:,
self
.
_indices
]
r2v_matrix
=
self
.
_r2v_matrix
[
self
.
_indices
][:,
self
.
_indices
]
return
r2v_matrix
...
...
@@ -112,16 +114,16 @@ class VirtualGateMatrix:
def
get_element
(
self
,
i
,
j
,
v2r
=
True
):
if
v2r
:
return
self
.
_v2r_matrix
[
i
,
j
]
return
self
.
_v2r_matrix
[
i
,
j
]
else
:
return
self
.
_r2v_matrix
[
i
,
j
]
return
self
.
_r2v_matrix
[
i
,
j
]
def
set_element
(
self
,
i
,
j
,
value
,
v2r
=
True
):
if
v2r
:
self
.
_v2r_matrix
[
i
,
j
]
=
value
self
.
_v2r_matrix
[
i
,
j
]
=
value
self
.
_r2v_matrix
[:]
=
np
.
linalg
.
inv
(
self
.
_v2r_matrix
)
else
:
self
.
_r2v_matrix
[
i
,
j
]
=
value
self
.
_r2v_matrix
[
i
,
j
]
=
value
self
.
_v2r_matrix
[:]
=
np
.
linalg
.
inv
(
self
.
_r2v_matrix
)
self
.
_calc_normalized
()
...
...
@@ -145,7 +147,7 @@ class VirtualGateMatrix:
if
self
.
_normalization
:
# divide rows by diagonal value
norm
=
no_norm
/
np
.
diag
(
no_norm
)[:,
None
]
norm
=
no_norm
/
np
.
diag
(
no_norm
)[:,
None
]
else
:
norm
=
no_norm
...
...
@@ -156,7 +158,7 @@ class VirtualGateMatrix:
real_gate_names
=
[]
virtual_gate_names
=
[]
for
i
,
name
in
enumerate
(
self
.
real_gate_names
):
for
i
,
name
in
enumerate
(
self
.
real_gate_names
):
if
name
in
available_gates
:
gate_indices
.
append
(
i
)
real_gate_names
.
append
(
name
)
...
...
@@ -165,6 +167,5 @@ class VirtualGateMatrix:
return
VirtualGateMatrixView
(
self
.
name
,
real_gate_names
,
virtual_gate_names
,
self
.
_
norm_
r2v_matrix
,
self
.
_r2v_matrix
,
gate_indices
)
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