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
d36659dc
Commit
d36659dc
authored
2 years ago
by
xiyehu2
Browse files
Options
Downloads
Patches
Plain Diff
switched to JV algorithm for path finding.
parent
fc6b2954
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/waveform.py
+4
-20
4 additions, 20 deletions
Python/waveform.py
with
4 additions
and
20 deletions
Python/waveform.py
+
4
−
20
View file @
d36659dc
...
@@ -4,6 +4,7 @@ import numpy as np
...
@@ -4,6 +4,7 @@ import numpy as np
from
scipy.interpolate
import
interp1d
from
scipy.interpolate
import
interp1d
from
AWG
import
*
from
AWG
import
*
import
cupy
as
cp
import
cupy
as
cp
import
scipy.optimize
as
spopt
class
Waveform
:
class
Waveform
:
...
@@ -318,26 +319,9 @@ def get_rearrange_paths(
...
@@ -318,26 +319,9 @@ def get_rearrange_paths(
:param t_idx: indices of tweezer positions in target pattern.
:param t_idx: indices of tweezer positions in target pattern.
:returns: 2d numpy array containing moving path trajectories
:returns: 2d numpy array containing moving path trajectories
"""
"""
if
len
(
f_idx
)
<
len
(
t_idx
):
cm
=
abs
(
np
.
subtract
.
outer
(
f_idx
,
t_idx
))
return
np
.
array
([])
row
,
col
=
spopt
.
linear_sum_assignment
(
cm
)
l_ptr
=
np
.
searchsorted
(
f_idx
,
t_idx
[
0
])
return
np
.
stack
([
f_idx
[
row
],
t_idx
]).
T
r_ptr
=
np
.
searchsorted
(
f_idx
,
t_idx
[
-
1
],
side
=
'
right
'
)
-
1
n_unpaired
=
len
(
t_idx
)
-
len
(
f_idx
[
l_ptr
:
r_ptr
+
1
])
while
n_unpaired
>
0
:
if
l_ptr
==
0
:
r_ptr
+=
n_unpaired
break
if
r_ptr
==
len
(
f_idx
)
-
1
:
l_ptr
-=
n_unpaired
break
l_dist
=
abs
(
t_idx
[
0
]
-
f_idx
[
l_ptr
-
1
])
r_dist
=
abs
(
f_idx
[
r_ptr
+
1
]
-
t_idx
[
-
1
])
if
l_dist
<
r_dist
:
l_ptr
-=
1
else
:
r_ptr
+=
1
n_unpaired
-=
1
return
np
.
vstack
((
f_idx
[
l_ptr
:
r_ptr
+
1
],
t_idx
)).
T
def
create_moving_array_old
(
path_table
:
np
.
ndarray
,
paths
:
np
.
ndarray
)
->
np
.
ndarray
:
def
create_moving_array_old
(
path_table
:
np
.
ndarray
,
paths
:
np
.
ndarray
)
->
np
.
ndarray
:
...
...
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