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
533f2619
Commit
533f2619
authored
1 year ago
by
Sander Snoo
Browse files
Options
Downloads
Patches
Plain Diff
Validate channel names
parent
0a50df7b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pulse_lib/base_pulse.py
+12
-1
12 additions, 1 deletion
pulse_lib/base_pulse.py
with
12 additions
and
1 deletion
pulse_lib/base_pulse.py
+
12
−
1
View file @
533f2619
import
logging
import
numpy
as
np
import
re
from
typing
import
Dict
,
Union
from
qcodes
import
Parameter
...
...
@@ -152,6 +153,7 @@ class pulselib:
Keysight channel number 0 is trigger out, 1..4: use AWG analogue channel
Tektronix: tuple, e.g. (1,2), defines marker output, integer uses analogue output channel
'''
self
.
_check_uniqueness_of_channel_name
(
marker_name
)
self
.
marker_channels
[
marker_name
]
=
marker_channel
(
marker_name
,
AWG_name
,
channel_number
,
setup_ns
,
hold_ns
,
amplitude
,
invert
)
...
...
@@ -629,8 +631,17 @@ class pulselib:
hardware
.
sync_data
()
def
_check_uniqueness_of_channel_name
(
self
,
channel_name
):
if
len
(
channel_name
)
<
2
:
raise
Exception
(
f
"
Channel name
'
{
channel_name
}
'
is too short
"
)
if
len
(
channel_name
)
>
10
:
raise
Exception
(
f
"
Channel name
'
{
channel_name
}
'
is too long
"
)
if
'
{
'
in
channel_name
:
raise
Exception
(
f
"
Illegal channel name
'
{
channel_name
}
'
. Did you forget the f in front of the string?
"
)
if
not
re
.
match
(
r
"
^[A-Za-z][A-Za-z0-9_]*$
"
,
channel_name
):
raise
Exception
(
f
"
Invalid channel name
'
{
channel_name
}
'"
)
if
(
channel_name
in
self
.
awg_channels
or
channel_name
in
self
.
marker_channels
or
channel_name
in
self
.
digitizer_channels
or
channel_name
in
self
.
qubit_channels
):
raise
ValueError
(
f
"
d
oubl
e declaration of the a channel/marker name
(
{
channel_name
}
)
.
"
)
raise
ValueError
(
f
"
d
uplicat
e declaration of the a channel/marker name
'
{
channel_name
}
'
.
"
)
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