Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
wela
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
wela
Commits
977ffc4c
Commit
977ffc4c
authored
10 months ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
fix(kymograph): error in using sort_order
parent
8178f935
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/wela/plotting.py
+2
-2
2 additions, 2 deletions
src/wela/plotting.py
src/wela/sorting.py
+11
-10
11 additions, 10 deletions
src/wela/sorting.py
with
13 additions
and
12 deletions
src/wela/plotting.py
+
2
−
2
View file @
977ffc4c
...
...
@@ -105,7 +105,7 @@ def kymograph(
dt
=
np
.
min
(
np
.
diff
(
np
.
sort
(
df
.
time
.
unique
())))
data
=
wdf
.
to_numpy
()
if
sort_order
is
not
None
:
data
=
data
[
np
.
argsort
(
sort_order
)
,
:]
data
=
data
[
sort_order
,
:]
if
filterfunc
is
not
None
:
data
=
filterfunc
(
data
)
if
standardscale
:
...
...
@@ -146,7 +146,7 @@ def kymograph(
if
buddings
:
buddings
=
df
.
pivot
(
index
=
y
,
columns
=
x
,
values
=
"
buddings
"
).
to_numpy
()
if
sort_order
is
not
None
:
buddings
=
buddings
[
np
.
argsort
(
sort_order
)
,
:]
buddings
=
buddings
[
sort_order
,
:]
bud_mask
=
np
.
ma
.
masked_where
(
buddings
==
0
,
buddings
)
ax
.
imshow
(
bud_mask
,
interpolation
=
"
none
"
)
ax
.
figure
.
colorbar
(
...
...
This diff is collapsed.
Click to expand it.
src/wela/sorting.py
+
11
−
10
View file @
977ffc4c
...
...
@@ -11,20 +11,21 @@ def sort_by_budding(buddings, bud_number=0):
sort_order
.
append
(
cell_buds
[
bud_number
][
1
])
else
:
sort_order
.
append
(
np
.
nan
)
sort_order
=
np
.
ar
ray
(
sort_order
)
sort_order
=
np
.
ar
gsort
(
sort_order
)
return
sort_order
def
sort_by_maximum
(
data
,
byfunction
=
None
):
"""
Return indices of cells sorted by largest value.
"""
sort_order
=
np
.
nan
*
np
.
ones
(
data
.
shape
[
0
])
sdata
=
data
[
not_all_nan
(
data
),
:]
if
byfunction
is
not
None
:
sorted_indices
=
np
.
argsort
(
byfunction
(
sdata
,
axis
=
1
))
def
sort_by_maximum
(
data
,
byfunction
,
reverse
=
False
):
"""
Return indices of cells sorted by largest value.
Any cells that have all NaN values are placed last.
"""
sort_order
=
np
.
argsort
(
byfunction
(
data
,
axis
=
1
))
if
reverse
:
return
sort_order
[::
-
1
]
else
:
sorted_indices
=
np
.
nanargmax
(
sdata
,
axis
=
1
)
sort_order
[
not_all_nan
(
data
)]
=
sorted_indices
return
sort_order
return
sort_order
def
not_all_nan
(
data
):
...
...
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