Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pulse_lib
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
pulse_lib
Commits
833b2e09
Commit
833b2e09
authored
7 months ago
by
Sander de Snoo
Browse files
Options
Downloads
Patches
Plain Diff
Added update_snapshot() to MeasurementParameter to allow custom snapshot data
parent
6f3eca7b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pulse_lib/acquisition/iq_modes.py
+1
-1
1 addition, 1 deletion
pulse_lib/acquisition/iq_modes.py
pulse_lib/acquisition/measurement_converter.py
+18
-2
18 additions, 2 deletions
pulse_lib/acquisition/measurement_converter.py
with
19 additions
and
3 deletions
pulse_lib/acquisition/iq_modes.py
+
1
−
1
View file @
833b2e09
...
@@ -6,7 +6,7 @@ def iq_mode2func(iq_mode):
...
@@ -6,7 +6,7 @@ def iq_mode2func(iq_mode):
list[Tuple[str, func[np.array]->np.array], str]
list[Tuple[str, func[np.array]->np.array], str]
'''
'''
func_map
=
{
func_map
=
{
'
Complex
'
:
[(
''
,
lambda
x
:
x
,
'
mV
'
)],
'
Complex
'
:
[(
''
,
None
,
'
mV
'
)],
'
I
'
:
[(
''
,
np
.
real
,
'
mV
'
)],
'
I
'
:
[(
''
,
np
.
real
,
'
mV
'
)],
'
Q
'
:
[(
''
,
np
.
imag
,
'
mV
'
)],
'
Q
'
:
[(
''
,
np
.
imag
,
'
mV
'
)],
'
amplitude
'
:
[(
''
,
np
.
abs
,
'
mV
'
)],
'
amplitude
'
:
[(
''
,
np
.
abs
,
'
mV
'
)],
...
...
This diff is collapsed.
Click to expand it.
pulse_lib/acquisition/measurement_converter.py
+
18
−
2
View file @
833b2e09
from
collections.abc
import
Sequence
from
dataclasses
import
dataclass
,
field
from
dataclasses
import
dataclass
,
field
from
typing
import
Tuple
,
List
from
typing
import
Any
,
Dict
,
List
,
Optional
,
Tuple
from
numbers
import
Number
from
numbers
import
Number
import
logging
import
logging
import
numpy
as
np
import
numpy
as
np
...
@@ -89,6 +90,10 @@ class MeasurementParameter(MultiParameter):
...
@@ -89,6 +90,10 @@ class MeasurementParameter(MultiParameter):
self
.
_mc
=
mc
self
.
_mc
=
mc
self
.
_data_selection
=
data_selection
self
.
_data_selection
=
data_selection
self
.
_derived_params
=
{}
self
.
_derived_params
=
{}
self
.
_snapshot_extra
=
{}
def
update_snapshot
(
self
,
snapshot_extra
:
Dict
[
str
,
Any
]):
self
.
_snapshot_extra
.
update
(
snapshot_extra
)
def
add_derived_param
(
self
,
name
,
func
,
label
=
None
,
unit
=
'
mV
'
,
def
add_derived_param
(
self
,
name
,
func
,
label
=
None
,
unit
=
'
mV
'
,
time_trace
=
False
,
time_trace
=
False
,
...
@@ -236,6 +241,14 @@ class MeasurementParameter(MultiParameter):
...
@@ -236,6 +241,14 @@ class MeasurementParameter(MultiParameter):
return
data
return
data
def
snapshot_base
(
self
,
update
:
Optional
[
bool
]
=
True
,
params_to_skip_update
:
Optional
[
Sequence
[
str
]]
=
None
)
->
Dict
[
Any
,
Any
]:
snapshot
=
super
().
snapshot_base
(
update
,
params_to_skip_update
)
snapshot
.
update
(
self
.
_snapshot_extra
)
return
snapshot
class
MeasurementConverter
:
class
MeasurementConverter
:
ALLOWED_RELATIVE_THRESHOLD_DEVIATION
=
0.01
ALLOWED_RELATIVE_THRESHOLD_DEVIATION
=
0.01
...
@@ -489,7 +502,10 @@ class MeasurementConverter:
...
@@ -489,7 +502,10 @@ class MeasurementConverter:
else
:
else
:
funcs
=
iq_mode2func
(
selection
.
iq_mode
)
funcs
=
iq_mode2func
(
selection
.
iq_mode
)
for
_
,
func
,
_
in
funcs
:
for
_
,
func
,
_
in
funcs
:
data
.
append
(
func
(
raw
))
if
func
is
not
None
:
data
.
append
(
func
(
raw
))
else
:
data
.
append
(
raw
)
if
selection
.
states
:
if
selection
.
states
:
data
+=
self
.
_states
data
+=
self
.
_states
if
selection
.
values
:
if
selection
.
values
:
...
...
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