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
18d7db60
Commit
18d7db60
authored
1 year ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
change(dataloader): remove buds from Signals
parent
b0361500
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
dataloader.py
+24
-3
24 additions, 3 deletions
dataloader.py
with
24 additions
and
3 deletions
dataloader.py
+
24
−
3
View file @
18d7db60
...
@@ -267,6 +267,8 @@ class dataloader:
...
@@ -267,6 +267,8 @@ class dataloader:
self
.
update_dictionaries
(
extra_g2a_dict
,
overwrite_dict
)
self
.
update_dictionaries
(
extra_g2a_dict
,
overwrite_dict
)
# create instance of grouper
# create instance of grouper
grouper
=
self
.
get_grouper
(
dataname
)
grouper
=
self
.
get_grouper
(
dataname
)
# find time interval between images
self
.
dt
=
grouper
.
tinterval
print
(
"
\n
---
\n
"
+
dataname
+
"
\n
---
"
)
print
(
"
\n
---
\n
"
+
dataname
+
"
\n
---
"
)
if
bud_fluorescence
:
if
bud_fluorescence
:
# call postprocessor to add bud fluorescence to h5 files
# call postprocessor to add bud fluorescence to h5 files
...
@@ -275,12 +277,13 @@ class dataloader:
...
@@ -275,12 +277,13 @@ class dataloader:
for
signal
in
grouper
.
available
:
for
signal
in
grouper
.
available
:
print
(
"
"
,
signal
)
print
(
"
"
,
signal
)
print
()
print
()
#
find time interval between image
s
#
get indices for all bud
s
self
.
dt
=
grouper
.
tinterval
bud_indices
=
self
.
get_bud_indices
(
grouper
,
key_index
)
# get key_index data
# get key_index data
r_df
=
self
.
get_key_index_data
(
r_df
=
self
.
get_key_index_data
(
grouper
=
grouper
,
grouper
=
grouper
,
key_index
=
key_index
,
key_index
=
key_index
,
bud_indices
=
bud_indices
,
cutoff
=
cutoff
,
cutoff
=
cutoff
,
tmax_in_mins_dict
=
tmax_in_mins_dict
,
tmax_in_mins_dict
=
tmax_in_mins_dict
,
)
)
...
@@ -288,6 +291,7 @@ class dataloader:
...
@@ -288,6 +291,7 @@ class dataloader:
r_df
=
self
.
load_h5
(
r_df
=
self
.
load_h5
(
grouper
=
grouper
,
grouper
=
grouper
,
key_index
=
key_index
,
key_index
=
key_index
,
bud_indices
=
bud_indices
,
r_df
=
r_df
,
r_df
=
r_df
,
interpolate_list
=
interpolate_list
,
interpolate_list
=
interpolate_list
,
tmax_in_mins_dict
=
tmax_in_mins_dict
,
tmax_in_mins_dict
=
tmax_in_mins_dict
,
...
@@ -314,6 +318,7 @@ class dataloader:
...
@@ -314,6 +318,7 @@ class dataloader:
self
,
self
,
grouper
,
grouper
,
key_index
,
key_index
,
bud_indices
,
r_df
,
r_df
,
interpolate_list
,
interpolate_list
,
tmax_in_mins_dict
,
tmax_in_mins_dict
,
...
@@ -332,6 +337,7 @@ class dataloader:
...
@@ -332,6 +337,7 @@ class dataloader:
cutoff
=
0
,
cutoff
=
0
,
tmax_in_mins_dict
=
tmax_in_mins_dict
,
tmax_in_mins_dict
=
tmax_in_mins_dict
,
)
)
record
=
self
.
remove_buds
(
record
,
bud_indices
)
# interpolate to remove internal NaNs for signals from mothers
# interpolate to remove internal NaNs for signals from mothers
if
(
if
(
interpolate_list
interpolate_list
...
@@ -355,7 +361,7 @@ class dataloader:
...
@@ -355,7 +361,7 @@ class dataloader:
return
r_df
return
r_df
def
get_key_index_data
(
def
get_key_index_data
(
self
,
grouper
,
key_index
,
cutoff
,
tmax_in_mins_dict
self
,
grouper
,
key_index
,
bud_indices
,
cutoff
,
tmax_in_mins_dict
):
):
"""
"""
Find data for the key record.
Find data for the key record.
...
@@ -367,12 +373,25 @@ class dataloader:
...
@@ -367,12 +373,25 @@ class dataloader:
record
=
grouper
.
concat_signal
(
record
=
grouper
.
concat_signal
(
key_index_path
,
cutoff
=
cutoff
,
tmax_in_mins_dict
=
tmax_in_mins_dict
key_index_path
,
cutoff
=
cutoff
,
tmax_in_mins_dict
=
tmax_in_mins_dict
)
)
record
=
self
.
remove_buds
(
record
,
bud_indices
)
if
record
is
not
None
:
if
record
is
not
None
:
r_df
=
self
.
long_df_with_id
(
record
,
key_index
)
r_df
=
self
.
long_df_with_id
(
record
,
key_index
)
return
r_df
return
r_df
else
:
else
:
raise
Exception
(
f
"
{
key_index_path
}
cannot be found.
"
)
raise
Exception
(
f
"
{
key_index_path
}
cannot be found.
"
)
def
get_bud_indices
(
self
,
grouper
,
key_index
):
"""
Use key_index to get a multi-index for all buds.
"""
key_index_path
=
self
.
a2g_dict
[
key_index
]
record
=
grouper
.
concat_signal
(
key_index_path
,
mode
=
"
raw_daughters
"
)
bud_indices
=
record
.
droplevel
(
"
mother_label
"
).
index
return
bud_indices
def
remove_buds
(
self
,
df
,
bud_indices
):
"""
Remove rows that are buds from a data frame.
"""
new_index
=
df
.
index
.
difference
(
bud_indices
)
return
df
.
loc
[
new_index
]
def
load_bud_data
(
def
load_bud_data
(
self
,
self
,
grouper
,
grouper
,
...
@@ -383,6 +402,8 @@ class dataloader:
...
@@ -383,6 +402,8 @@ class dataloader:
"""
"""
Load buddings, bud volume, and any other bud signals.
Load buddings, bud volume, and any other bud signals.
Bud signals are indexed by their mother cells.
Drop adjacent buddings and interpolate specified bus signals
Drop adjacent buddings and interpolate specified bus signals
to remove NaNs.
to remove NaNs.
"""
"""
...
...
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