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
cba3bf4f
Commit
cba3bf4f
authored
1 year ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
change(signal): remove __getitem__; get is clearer
parent
8a537cd9
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/agora/io/signal.py
+8
-22
8 additions, 22 deletions
src/agora/io/signal.py
src/postprocessor/core/postprocessing.py
+3
-3
3 additions, 3 deletions
src/postprocessor/core/postprocessing.py
with
11 additions
and
25 deletions
src/agora/io/signal.py
+
8
−
22
View file @
cba3bf4f
...
...
@@ -38,33 +38,19 @@ class Signal(BridgeH5):
)
self
.
candidate_channels
=
global_parameters
.
possible_imaging_channels
def
__getitem__
(
self
,
dsets
:
t
.
Union
[
str
,
t
.
Collection
]):
"""
Get and potentially pre-process data from h5 file and return as a data frame.
"""
if
isinstance
(
dsets
,
str
):
return
self
.
get
(
dsets
)
elif
isinstance
(
dsets
,
list
):
is_bgd
=
[
dset
.
endswith
(
"
imBackground
"
)
for
dset
in
dsets
]
# Check we are not comparing tile-indexed and cell-indexed data
assert
sum
(
is_bgd
)
==
0
or
sum
(
is_bgd
)
==
len
(
dsets
),
"
Tile data and cell data cannot be mixed.
"
return
[
self
.
get
(
dset
)
for
dset
in
dsets
]
else
:
raise
Exception
(
f
"
Invalid type
{
type
(
dsets
)
}
to get datasets
"
)
def
get
(
self
,
dset
_name
:
t
.
Union
[
str
,
t
.
Collection
],
dset
:
t
.
Union
[
str
,
t
.
Collection
],
tmax_in_mins
:
int
=
None
,
):
"""
Get Signal after merging and picking.
"""
if
isinstance
(
dset
_name
,
str
):
dsets
=
self
.
get_raw
(
dset
_name
,
tmax_in_mins
=
tmax_in_mins
)
if
dsets
is
not
None
:
picked_merged
=
self
.
apply_merging_picking
(
dsets
)
return
self
.
add_name
(
picked_merged
,
dset
_name
)
else
:
return
None
if
isinstance
(
dset
,
str
):
record
=
self
.
get_raw
(
dset
,
tmax_in_mins
=
tmax_in_mins
)
if
record
is
not
None
:
picked_merged
=
self
.
apply_merging_picking
(
record
)
return
self
.
add_name
(
picked_merged
,
dset
)
elif
isinstance
(
dset
,
list
)
:
return
[
self
.
get
(
d
)
for
d
in
dset
]
else
:
raise
Exception
(
"
Error in Signal.get
"
)
...
...
This diff is collapsed.
Click to expand it.
src/postprocessor/core/postprocessing.py
+
3
−
3
View file @
cba3bf4f
...
...
@@ -144,7 +144,7 @@ class PostProcessor(ProcessABC):
# run picker
picked_indices
=
np
.
array
(
self
.
picker
.
run
(
self
.
signal
[
self
.
targets
[
"
merging_picking
"
][
"
picker
"
]
]
self
.
signal
.
get
(
self
.
targets
[
"
merging_picking
"
][
"
picker
"
]
)
)
)
if
picked_indices
.
any
():
...
...
@@ -186,9 +186,9 @@ class PostProcessor(ProcessABC):
"""
Run processes to obtain single data sets and write the results.
"""
# get pre-processed data
if
isinstance
(
dataset
,
list
):
signal
=
[
self
.
signal
[
d
]
for
d
in
dataset
]
signal
=
[
self
.
signal
.
get
(
d
)
for
d
in
dataset
]
elif
isinstance
(
dataset
,
str
):
signal
=
self
.
signal
[
dataset
]
signal
=
self
.
signal
.
get
(
dataset
)
else
:
raise
(
"
Incorrect dataset
"
)
# run process on 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