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
16f92b89
Commit
16f92b89
authored
1 year ago
by
camera computer
Browse files
Options
Downloads
Patches
Plain Diff
Sync commit
parent
0c1de386
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/lib/waveform.py
+13
-8
13 additions, 8 deletions
Python/lib/waveform.py
with
13 additions
and
8 deletions
Python/lib/waveform.py
+
13
−
8
View file @
16f92b89
...
...
@@ -38,7 +38,7 @@ class Waveform:
# formula for minimum sample length
# sample_len_min = 512 * m
# m * 512 * freq_resolution / sampling_rate = k, k % 2 == 0
self
.
sample_len_min
=
2
*
sample_rate
/
freq_res
/
10
# !!! this only works for sample_rate = 614.4e6 !!!
self
.
sample_len_min
=
2
*
sample_rate
/
freq_res
# !!! this only works for sample_rate = 614.4e6 !!!
def
set_amplitudes
(
self
,
amps
:
np
.
ndarray
)
->
bool
:
...
...
@@ -72,8 +72,13 @@ def create_static_array(wfm: Waveform, full=False) -> np.ndarray:
:return: either a 1D or 2D np array
:rtype: np.ndarray
"""
# wfm.sample_len_min *= 10
length_check
=
wfm
.
sample_len_min
*
512
*
50e3
/
wfm
.
sample_rate
%
2
==
0
if
not
length_check
:
raise
Exception
(
"
static waveform length requirement not met.
"
)
# construct time axis, t_total(s) = sample_len / sample_rate, dt = t_total / sample_len
t
=
np
.
arange
(
wfm
.
sample_len_min
)
/
wfm
.
sample_rate
t
=
np
.
arange
(
wfm
.
sample_len_min
*
10
)
/
wfm
.
sample_rate
# calculate individual sin waves, sig_mat[i] corresponds to data for ith tweezer
# sin_mat = wfm.amplitude * np.sin(np.outer(wfm.omega,t) + np.expand_dims(wfm.phi, axis=1)) # shape=(number of tweezers x sample_len)
...
...
@@ -448,19 +453,19 @@ def create_moving_signal_single(
def
create_static_signal_single
(
omega
,
sample_rate
,
s
ignal_time
,
amp
=
2
**
12
,
phi
=
0
omega
,
sample_rate
,
s
ample_len
,
amp
=
2
**
12
,
phi
=
0
):
min_len
=
2
*
sample_rate
/
(
1e3
)
sample_len
=
sample_rate
*
signal_time
sample_len
+=
min_len
-
sample_len
%
min_len
sample_len
=
int
(
sample_len
)
#
min_len = 2 * sample_rate / (1e3)
#
sample_len = sample_rate * signal_time
#
sample_len += min_len - sample_len % min_len
#
sample_len = int(sample_len)
t
=
np
.
arange
(
sample_len
)
/
sample_rate
t
+=
t
[
1
]
signal
=
phi
+
omega
*
t
phi_end
=
signal
[
-
1
]
signal
=
amp
*
np
.
sin
(
signal
)
return
signal
.
astype
(
np
.
int16
)
,
phi_end
return
signal
.
astype
(
np
.
int16
)
def
create_move_then_back
(
omega_i
,
omega_f
,
sample_rate
,
move_time
,
stay_time
):
...
...
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