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
012e23d3
Commit
012e23d3
authored
2 years ago
by
Sander Snoo
Browse files
Options
Downloads
Patches
Plain Diff
Addded get_last_upload utility to analyse upload after an exception
parent
c5f4ac3c
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
pulse_lib/tests/utils/last_upload.py
+68
-0
68 additions, 0 deletions
pulse_lib/tests/utils/last_upload.py
with
68 additions
and
0 deletions
pulse_lib/tests/utils/last_upload.py
0 → 100644
+
68
−
0
View file @
012e23d3
from
pulse_lib.segments.data_classes.data_pulse
import
OffsetRamp
,
PhaseShift
,
custom_pulse_element
from
pulse_lib.segments.data_classes.data_IQ
import
IQ_data_single
from
pulse_lib.segments.conditional_segment
import
conditional_segment
def
get_last_upload
(
pulse
):
jobs
=
pulse
.
uploader
.
jobs
if
len
(
jobs
)
==
0
:
print
(
"
No jobs... :-(
"
)
return
job
=
jobs
[
-
1
]
return
LastUpload
(
job
)
class
LastUpload
:
def
__init__
(
self
,
job
):
self
.
job
=
job
self
.
index
=
job
.
index
self
.
segments
=
job
.
sequence
self
.
segment_start
=
[]
print
(
f
'
job index:
{
job
.
index
}
'
)
print
(
f
'
sequence:
{
len
(
self
.
segments
)
}
segments
'
)
end
=
0
for
segment
in
self
.
segments
:
duration
=
segment
.
get_total_time
(
self
.
index
)
start
=
end
end
+=
duration
self
.
segment_start
.
append
(
start
)
print
(
f
'
{
start
:
8.1
f
}
-
{
end
:
8.1
f
}
, (
{
duration
:
8.1
f
}
), shape:
{
segment
.
shape
}
'
)
def
describe
(
self
,
segment
=
None
,
channels
=
None
):
if
segment
is
None
:
segments
=
self
.
segments
else
:
segments
=
[
self
.
segments
[
segment
]]
if
channels
is
None
:
channels
=
list
(
self
.
segments
[
0
].
channels
.
keys
())
for
channel
in
channels
:
print
(
f
'
Channel:
{
channel
}
'
)
for
i
,
seg
in
enumerate
(
segments
):
seg_offset
=
self
.
segment_start
[
i
]
if
isinstance
(
seg
,
conditional_segment
):
for
j
,
branch
in
enumerate
(
seg
.
branches
):
seg_ch
=
branch
[
channel
]
data
=
seg_ch
.
_get_data_all_at
(
self
.
index
).
get_data_elements
()
if
len
(
data
):
print
(
f
'
Segment:
{
i
}
- Branch:
{
j
}
'
)
self
.
_describe_segment
(
data
,
seg_offset
)
else
:
seg_ch
=
seg
[
channel
]
data
=
seg_ch
.
_get_data_all_at
(
self
.
index
).
get_data_elements
()
if
len
(
data
):
print
(
f
'
Segment:
{
i
}
'
)
self
.
_describe_segment
(
data
,
seg_offset
)
def
_describe_segment
(
self
,
data
,
seg_offset
):
for
e
in
data
:
print
(
f
'
{
e
.
start
+
seg_offset
:
8.1
f
}
-
{
e
.
stop
+
seg_offset
:
8.1
f
}
'
,
end
=
''
)
if
isinstance
(
e
,
OffsetRamp
):
print
(
f
'
ramp
{
e
.
v_start
:
6.2
f
}
,
{
e
.
v_stop
:
6.2
f
}
mV
'
)
elif
isinstance
(
e
,
custom_pulse_element
):
print
(
f
'
custom
{
e
.
amplitude
:
6.2
f
}
(*
{
e
.
scaling
:
5.3
f
}
),
{
e
.
kwargs
}
'
)
elif
isinstance
(
e
,
PhaseShift
):
print
(
f
'
shift phase
{
e
.
phase_shift
:
+
6.3
f
}
rad (
{
e
.
channel_name
}
)
'
)
elif
isinstance
(
e
,
IQ_data_single
):
print
(
f
'
MW pulse
{
e
.
amplitude
:
6.2
f
}
{
e
.
frequency
/
1e6
:
6.1
f
}
MHz
{
e
.
start_phase
:
+
6.3
f
}
rad (
{
e
.
ref_channel
}
)
'
)
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