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
6feda8b3
Commit
6feda8b3
authored
4 months ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
feature(get_time_series): returns dataloader IDs
parent
7df7e659
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
src/wela/dataloader.py
+17
-7
17 additions, 7 deletions
src/wela/dataloader.py
with
17 additions
and
7 deletions
src/wela/dataloader.py
+
17
−
7
View file @
6feda8b3
...
...
@@ -80,6 +80,7 @@ class dataloader:
"""
def
__init__
(
self
,
h5dir
=
None
,
wdir
=
"
.
"
,
ls
=
True
,
projection
=
"
max
"
):
"""
Initialise by defining possible signals.
"""
# method to collapse Z stacks to one image
self
.
projection
=
projection
# from grouper.signals to abbreviations
...
...
@@ -96,7 +97,7 @@ class dataloader:
self
.
ls
def
define_g2a_dict
(
self
,
fl_channels
=
[
"
GFP
"
,
"
mCherry
"
]):
"""
Dict to convert names of grouper.signals to short forms.
"""
"""
D
efine d
ict to convert names of grouper.signals to short forms.
"""
projection
=
self
.
projection
g2a_dict
=
{
f
"
extraction/cy5/
{
projection
}
/median
"
:
"
cy5
"
,
...
...
@@ -729,7 +730,7 @@ class dataloader:
sdf
=
sdf
[
sdf
.
time
<=
tmax
]
return
sdf
def
get_time_series
(
self
,
signal
,
group
=
None
,
df
=
None
):
def
get_time_series
(
self
,
signal
,
group
=
None
,
df
=
None
,
return_ids
=
False
):
"""
Extract a signal as a 2D array with each row a time series.
...
...
@@ -737,6 +738,13 @@ class dataloader:
----------
signal: string
The signal to be extracted
group: string (optional)
Selected data only for a particular group
df: pd.DataFrame (optional)
If specified, use this dataframe not dataloader
'
s.
return_ids: boolean (optional)
If True, return too the dataloader IDs for the cells.
Returns
-------
...
...
@@ -745,10 +753,8 @@ class dataloader:
values: 2D array
The values of the signal with each row a separate time
series
group: string (optional)
Selected data only for a particular group
df: pd.DataFrame (optional)
If specified, use this dataframe not dataloader
'
s.
ids: 1D array (optional)
The dataloader IDs for the cells in each row.
"""
if
df
is
None
:
if
group
is
None
:
...
...
@@ -770,7 +776,11 @@ class dataloader:
time
=
wdf
.
columns
.
to_numpy
()
# each column is a time series
values
=
wdf
.
to_numpy
()
return
time
,
values
if
return_ids
:
ids
=
np
.
array
(
wdf
.
index
)
return
time
,
values
,
ids
else
:
return
time
,
values
def
put_time_series
(
self
,
values
,
signal
):
"""
...
...
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