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
06feb429
Commit
06feb429
authored
2 years ago
by
xiyehu2
Browse files
Options
Downloads
Patches
Plain Diff
get_rearrange_paths bug fixing
parent
6a62f2e9
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
Python/waveform.py
+36
-12
36 additions, 12 deletions
Python/waveform.py
with
36 additions
and
12 deletions
Python/waveform.py
+
36
−
12
View file @
06feb429
...
@@ -474,19 +474,16 @@ def create_path_table_reduced_gpu(
...
@@ -474,19 +474,16 @@ def create_path_table_reduced_gpu(
def
get_rearrange_paths
(
def
get_rearrange_paths
(
filled_idx
:
np
.
ndarray
,
filled_idx
:
np
.
ndarray
,
target_idx
:
np
.
ndarray
,
target_idx
:
np
.
ndarray
,
)
->
Tuple
[
List
[
Tuple
[
Any
,
Any
]],
List
[
Any
]]:
)
->
List
[
Tuple
[
Any
,
Any
]]:
"""
"""
Calculate rearranging paths.
Calculate rearranging paths.
:param filled_idx: indices of tweezer positions filled with atoms.
:param filled_idx: indices of tweezer positions filled with atoms.
:param target_idx: indices of tweezer positions in target pattern.
:param target_idx: indices of tweezer positions in target pattern.
:returns:
Tuple
containing moving paths
and turn-off paths.
:returns:
list
containing
tuples of
moving paths
"""
"""
n
=
0
t_size
=
target_idx
.
size
t_size
=
target_idx
.
size
f_size
=
filled_idx
.
size
f_size
=
filled_idx
.
size
reserve
=
f_size
-
t_size
reserve
=
f_size
-
t_size
# move_paths = []
# static_paths = []
paths
=
[]
paths
=
[]
i
=
0
i
=
0
j
=
0
j
=
0
...
@@ -495,21 +492,21 @@ def get_rearrange_paths(
...
@@ -495,21 +492,21 @@ def get_rearrange_paths(
if
filled_idx
[
i
]
==
target_idx
[
j
]:
if
filled_idx
[
i
]
==
target_idx
[
j
]:
# paths.append((filled_idx[i], filled_idx[i]))
# paths.append((filled_idx[i], filled_idx[i]))
j
+=
1
j
+=
1
i
=
j
i
+
=
1
elif
(
reserve
>
0
elif
(
reserve
>
0
and
filled_idx
[
i
]
<
target_idx
[
j
]
and
filled_idx
[
i
]
<
target_idx
[
j
]
and
abs
(
filled_idx
[
i
+
1
]
-
target_idx
[
j
])
<
abs
(
filled_idx
[
i
+
1
]
-
target_idx
[
j
])):
and
abs
(
filled_idx
[
i
+
1
]
-
target_idx
[
j
])
<
abs
(
filled_idx
[
i
]
-
target_idx
[
j
])):
i
+=
1
i
+=
1
reserve
-=
1
reserve
-=
1
else
:
else
:
paths
.
append
((
filled_idx
[
i
],
target_idx
[
j
]))
paths
.
append
((
filled_idx
[
i
],
target_idx
[
j
]))
i
+=
1
i
+=
1
j
+=
1
j
+=
1
off
=
[]
#
off = []
if
reserve
<
0
:
#
if reserve < 0:
for
i
in
range
(
abs
(
reserve
)):
#
for i in range(abs(reserve)):
off
.
append
(
target_idx
[
-
1
-
i
])
#
off.append(target_idx[-1 - i])
return
paths
,
off
return
paths
def
create_moving_array
(
path_table
:
np
.
ndarray
,
paths
:
np
.
ndarray
)
->
np
.
ndarray
:
def
create_moving_array
(
path_table
:
np
.
ndarray
,
paths
:
np
.
ndarray
)
->
np
.
ndarray
:
...
@@ -611,3 +608,30 @@ def create_moving_signal_single(omega_i, omega_f, sample_rate, signal_time):
...
@@ -611,3 +608,30 @@ def create_moving_signal_single(omega_i, omega_f, sample_rate, signal_time):
signal
=
(
amps
*
np
.
sin
(
signal
)).
astype
(
np
.
int16
)
signal
=
(
amps
*
np
.
sin
(
signal
)).
astype
(
np
.
int16
)
return
signal
return
signal
def
create_move_then_back
(
omega_i
,
omega_f
,
sample_rate
,
move_time
,
stay_time
):
min_len
=
2
*
sample_rate
/
0.1e3
sample_len
=
sample_rate
*
(
move_time
*
2
+
stay_time
)
sample_len
+=
min_len
-
sample_len
%
min_len
sample_len
=
int
(
sample_len
)
t
=
np
.
arange
(
sample_len
)
/
sample_rate
t_tot
=
sample_len
/
sample_rate
a
=
4
*
(
omega_i
-
omega_f
)
/
(
t_tot
**
2
)
end
=
sample_len
half
=
int
(
end
/
2
)
+
1
t1
=
t
[:
half
]
t2
=
t
[
half
:
end
]
-
t_tot
/
2
amps
=
2
**
12
signal
=
np
.
zeros
(
sample_len
)
signal
[:
half
]
=
omega_i
*
t1
-
a
/
6
*
t1
**
3
# t<=T/2
# ph = wfm.phi[i] + omega_i * t_tot / 2 + a / 6 * (t_tot / 2) ** 3
signal
[
half
:
end
]
=
signal
[
half
-
1
]
+
\
(
omega_i
-
a
/
2
*
(
t_tot
/
2
)
**
2
)
*
t2
-
\
a
/
2
*
t_tot
/
2
*
t2
**
2
+
\
a
/
6
*
t2
**
3
# t>=T/2
signal
[
end
:]
=
signal
[
end
-
1
]
+
omega_f
*
(
t
[
end
:]
-
t
[
end
-
1
])
signal
=
(
amps
*
np
.
sin
(
signal
)).
astype
(
np
.
int16
)
return
signal
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