Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
alibylite
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
alibylite
Commits
ad558e11
Commit
ad558e11
authored
1 year ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
stop grouper from exiting with assertion if cannot find data
parent
0feb0543
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
src/postprocessor/grouper.py
+31
-31
31 additions, 31 deletions
src/postprocessor/grouper.py
with
31 additions
and
31 deletions
src/postprocessor/grouper.py
+
31
−
31
View file @
ad558e11
...
...
@@ -107,35 +107,38 @@ class Grouper(ABC):
if
path
.
startswith
(
"
/
"
):
path
=
path
.
strip
(
"
/
"
)
good_chains
=
self
.
filter_chains
(
path
)
if
standard
:
fn_pos
=
concat_standard
else
:
fn_pos
=
concat_one_signal
kwargs
[
"
mode
"
]
=
mode
records
=
self
.
pool_function
(
path
=
path
,
f
=
fn_pos
,
pool
=
pool
,
chainers
=
good_chains
,
**
kwargs
,
)
# check for errors
errors
=
[
k
for
kymo
,
k
in
zip
(
records
,
self
.
chainers
.
keys
())
if
kymo
is
None
]
records
=
[
record
for
record
in
records
if
record
is
not
None
]
if
len
(
errors
):
print
(
"
Warning: Positions contain errors {errors}
"
)
assert
len
(
records
),
"
All data sets contain errors
"
# combine into one dataframe
concat
=
pd
.
concat
(
records
,
axis
=
0
)
if
len
(
concat
.
index
.
names
)
>
4
:
# reorder levels in the multi-index dataframe when mother_label is present
concat
=
concat
.
reorder_levels
(
(
"
group
"
,
"
position
"
,
"
trap
"
,
"
cell_label
"
,
"
mother_label
"
)
if
good_chains
:
if
standard
:
fn_pos
=
concat_standard
else
:
fn_pos
=
concat_one_signal
kwargs
[
"
mode
"
]
=
mode
records
=
self
.
pool_function
(
path
=
path
,
f
=
fn_pos
,
pool
=
pool
,
chainers
=
good_chains
,
**
kwargs
,
)
concat_sorted
=
concat
.
sort_index
()
return
concat_sorted
# check for errors
errors
=
[
k
for
kymo
,
k
in
zip
(
records
,
self
.
chainers
.
keys
())
if
kymo
is
None
]
records
=
[
record
for
record
in
records
if
record
is
not
None
]
if
len
(
errors
):
print
(
"
Warning: Positions contain errors {errors}
"
)
assert
len
(
records
),
"
All data sets contain errors
"
# combine into one dataframe
concat
=
pd
.
concat
(
records
,
axis
=
0
)
if
len
(
concat
.
index
.
names
)
>
4
:
# reorder levels in the multi-index dataframe when mother_label is present
concat
=
concat
.
reorder_levels
(
(
"
group
"
,
"
position
"
,
"
trap
"
,
"
cell_label
"
,
"
mother_label
"
)
)
concat_sorted
=
concat
.
sort_index
()
return
concat_sorted
def
filter_chains
(
self
,
path
:
str
)
->
t
.
Dict
[
str
,
Chainer
]:
"""
Filter chains to those whose data is available in the h5 file.
"""
...
...
@@ -150,9 +153,6 @@ class Grouper(ABC):
f
"
Grouper:Warning:
{
nchains_dif
}
chains do not contain
"
f
"
channel
{
path
}
"
)
assert
len
(
good_chains
),
f
"
No valid dataset to use. Valid datasets are
{
self
.
available
}
"
return
good_chains
def
pool_function
(
...
...
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