Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AWG control
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
whuie2
AWG control
Commits
f9f1502b
Commit
f9f1502b
authored
2 years ago
by
camera computer
Browse files
Options
Downloads
Patches
Plain Diff
QOL improvements
parent
632c7216
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Python/control.py
+13
-6
13 additions, 6 deletions
Python/control.py
with
13 additions
and
6 deletions
Python/control.py
+
13
−
6
View file @
f9f1502b
...
...
@@ -16,7 +16,6 @@ def trigger():
global
awg
# step = get_step()
awg
.
force_trigger
()
# step = int32(0)
print
(
"
triggering...
"
)
# print("current step:", step)
...
...
@@ -54,9 +53,10 @@ def load(fpath):
data
=
np
.
load
(
fpath
,
allow_pickle
=
True
)
sig
=
data
[
'
signal
'
]
step
=
get_step
()
segment
=
(
step
+
1
)
%
2
segment
=
1
awg
.
write_segment
(
sig
,
segment
)
print
(
f
"
currently playing step
{
step
}
, loaded data onto step
{
segment
}
"
)
print
(
f
"
currently step
{
step
}
, loaded step
{
segment
}
"
)
data
.
close
()
# argument parsing, more functionalities to be added later...
...
...
@@ -87,10 +87,15 @@ sig0 = data0['signal']
data1
=
np
.
load
(
"
data/wfm_5.npz
"
,
allow_pickle
=
True
)
sig1
=
data1
[
"
signal
"
]
# empty = np.zeros(
static_sig.shape
)
# empty = np.zeros(
512
)
# AWG stuff
# condition for awg step sequence.
# 0 for infinite loop until trigger
# 1 for finite loop, then goto nextstep afterwards.
condition
=
[
SPCSEQ_ENDLOOPONTRIG
,
SPCSEQ_ENDLOOPALWAYS
]
awg
=
AWG
()
awg
.
open
(
id
=
awg_id
)
# change this to b'/dev/spcm0' for top AWG
awg
.
set_sampling_rate
(
sampling_rate
)
...
...
@@ -99,8 +104,10 @@ awg.set_trigger(EXT0=SPC_TM_POS)
awg
.
set_sequence_mode
(
2
)
# partition AWG memory into 2 segments
awg
.
write_segment
(
sig0
,
segment
=
0
)
awg
.
write_segment
(
sig1
,
segment
=
1
)
awg
.
configure_step
(
step
=
0
,
segment
=
0
,
nextstep
=
1
,
loop
=
1
,
condition
=
SPCSEQ_ENDLOOPONTRIG
)
awg
.
configure_step
(
step
=
1
,
segment
=
1
,
nextstep
=
0
,
loop
=
1
,
condition
=
SPCSEQ_ENDLOOPONTRIG
)
# awg.write_segment(empty, segment=1)
awg
.
configure_step
(
step
=
0
,
segment
=
0
,
nextstep
=
1
,
loop
=
1
,
condition
=
condition
[
0
])
awg
.
configure_step
(
step
=
1
,
segment
=
1
,
nextstep
=
0
,
loop
=
1
,
condition
=
contition
[
0
])
# awg.configure_step(step=1, segment=1, nextstep=0, loop=1, condition=SPCSEQ_ENDLOOPONTRIG)
start
()
# console
...
...
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