Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aliby-mirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Swain Lab
aliby
aliby-mirror
Commits
0856b9dd
Commit
0856b9dd
authored
3 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Patches
Plain Diff
rearrange smooth and non-smooth joinable fun
Former-commit-id: 93a2788481655d1ec7e703d05ce82f76408affd3
parent
f2efb3fb
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
core/functions/tracks.py
+11
-5
11 additions, 5 deletions
core/functions/tracks.py
with
11 additions
and
5 deletions
core/functions/tracks.py
+
11
−
5
View file @
0856b9dd
...
@@ -217,19 +217,25 @@ def get_joinable(tracks, smooth=False, tol=0.1, window=5, degree=3) -> dict:
...
@@ -217,19 +217,25 @@ def get_joinable(tracks, smooth=False, tol=0.1, window=5, degree=3) -> dict:
"""
"""
clean
=
clean_tracks
(
tracks
,
min_len
=
window
+
1
,
min_gr
=
0.9
)
# get useful tracks
# Commented because we are not smoothing in this step yet
contig
=
clean
.
groupby
([
"
trap
"
]).
apply
(
get_contiguous_pairs
)
contig
=
contig
.
loc
[
contig
.
apply
(
len
)
>
0
]
# candict = {k:v for d in contig.values for k,v in d.items()}
# candict = {k:v for d in contig.values for k,v in d.items()}
# smooth all relevant tracks
# smooth all relevant tracks
linear
=
set
([
k
for
v
in
contig
.
values
for
i
in
v
for
j
in
i
for
k
in
j
])
if
smooth
:
# Apply savgol filter TODO fix nans affecting edge placing
if
smooth
:
# Apply savgol filter TODO fix nans affecting edge placing
clean
=
clean_tracks
(
tracks
,
min_len
=
window
+
1
,
min_gr
=
0.9
)
# get useful tracks
savgol_on_srs
=
lambda
x
:
non_uniform_savgol
(
x
.
index
,
x
.
values
,
window
,
degree
)
savgol_on_srs
=
lambda
x
:
non_uniform_savgol
(
x
.
index
,
x
.
values
,
window
,
degree
)
contig
=
clean
.
groupby
([
"
trap
"
]).
apply
(
get_contiguous_pairs
)
contig
=
contig
.
loc
[
contig
.
apply
(
len
)
>
0
]
linear
=
set
([
k
for
v
in
contig
.
values
for
i
in
v
for
j
in
i
for
k
in
j
])
smoothed_tracks
=
clean
.
loc
[
linear
].
apply
(
savgol_on_srs
,
1
)
smoothed_tracks
=
clean
.
loc
[
linear
].
apply
(
savgol_on_srs
,
1
)
else
:
else
:
smoothed_tracks
=
clean
.
loc
[
linear
].
apply
(
lambda
x
:
np
.
array
(
x
.
values
),
axis
=
1
)
contig
=
tracks
.
groupby
([
"
trap
"
]).
apply
(
get_contiguous_pairs
)
contig
=
contig
.
loc
[
contig
.
apply
(
len
)
>
0
]
linear
=
set
([
k
for
v
in
contig
.
values
for
i
in
v
for
j
in
i
for
k
in
j
])
smoothed_tracks
=
tracks
.
loc
[
linear
].
apply
(
lambda
x
:
np
.
array
(
x
.
values
),
axis
=
1
)
# fetch edges from ids TODO (IF necessary, here we can compare growth rates)
# fetch edges from ids TODO (IF necessary, here we can compare growth rates)
idx_to_edge
=
lambda
preposts
:
[
idx_to_edge
=
lambda
preposts
:
[
...
...
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