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
0feb0543
Commit
0feb0543
authored
1 year ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
tidying: deleted phlourin bits from processor
parent
572b1787
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/aliby/pipeline.py
+4
-1
4 additions, 1 deletion
src/aliby/pipeline.py
src/postprocessor/core/abc.py
+1
-3
1 addition, 3 deletions
src/postprocessor/core/abc.py
src/postprocessor/core/processor.py
+13
-43
13 additions, 43 deletions
src/postprocessor/core/processor.py
with
18 additions
and
47 deletions
src/aliby/pipeline.py
+
4
−
1
View file @
0feb0543
...
@@ -324,6 +324,9 @@ class Pipeline(ProcessABC):
...
@@ -324,6 +324,9 @@ class Pipeline(ProcessABC):
directory
.
mkdir
(
parents
=
True
)
directory
.
mkdir
(
parents
=
True
)
# download logs to use for metadata
# download logs to use for metadata
conn
.
cache_logs
(
directory
)
conn
.
cache_logs
(
directory
)
print
(
"
Positions available:
"
)
for
i
,
pos
in
enumerate
(
position_ids
.
keys
()):
print
(
"
\t
"
+
f
"
{
i
}
:
"
+
pos
.
split
(
"
.
"
)[
0
])
# update configuration
# update configuration
self
.
parameters
.
general
[
"
directory
"
]
=
str
(
directory
)
self
.
parameters
.
general
[
"
directory
"
]
=
str
(
directory
)
config
[
"
general
"
][
"
directory
"
]
=
directory
config
[
"
general
"
][
"
directory
"
]
=
directory
...
@@ -341,7 +344,7 @@ class Pipeline(ProcessABC):
...
@@ -341,7 +344,7 @@ class Pipeline(ProcessABC):
if
not
len
(
position_ids
):
if
not
len
(
position_ids
):
raise
Exception
(
"
No images to segment.
"
)
raise
Exception
(
"
No images to segment.
"
)
else
:
else
:
print
(
"
Positions:
"
)
print
(
"
\n
Positions
selected
:
"
)
for
pos
in
position_ids
:
for
pos
in
position_ids
:
print
(
"
\t
"
+
pos
.
split
(
"
.
"
)[
0
])
print
(
"
\t
"
+
pos
.
split
(
"
.
"
)[
0
])
# create and run pipelines
# create and run pipelines
...
...
This diff is collapsed.
Click to expand it.
src/postprocessor/core/abc.py
+
1
−
3
View file @
0feb0543
...
@@ -46,18 +46,16 @@ def get_process(process, suffix="") -> PostProcessABC or ParametersABC or None:
...
@@ -46,18 +46,16 @@ def get_process(process, suffix="") -> PostProcessABC or ParametersABC or None:
_to_snake_case
(
process
),
_to_snake_case
(
process
),
_to_pascal_case
(
_to_snake_case
(
process
)),
_to_pascal_case
(
_to_snake_case
(
process
)),
)
)
found
=
None
found
=
None
for
possible_location
,
process_syntax
in
product
(
for
possible_location
,
process_syntax
in
product
(
possible_locations
,
valid_syntaxes
possible_locations
,
valid_syntaxes
):
):
location
=
f
"
{
base_location
}
.
{
possible_location
}
.
{
_to_snake_case
(
process
)
}
.
{
process_syntax
}{
suffix
}
"
location
=
f
"
{
base_location
}
.
{
possible_location
}
.
{
_to_snake_case
(
process
)
}
.
{
process_syntax
}{
suffix
}
"
# instantiate class but not a class object
found
=
locate
(
location
)
found
=
locate
(
location
)
if
found
is
not
None
:
if
found
is
not
None
:
break
break
else
:
else
:
raise
Exception
(
raise
Exception
(
f
"
{
process
}
not found in locations
{
possible_locations
}
at
{
base_location
}
"
f
"
{
process
}
not found in locations
{
possible_locations
}
at
{
base_location
}
"
)
)
...
...
This diff is collapsed.
Click to expand it.
src/postprocessor/core/processor.py
+
13
−
43
View file @
0feb0543
...
@@ -72,14 +72,7 @@ class PostProcessorParameters(ParametersABC):
...
@@ -72,14 +72,7 @@ class PostProcessorParameters(ParametersABC):
},
},
"
processes
"
:
[
"
processes
"
:
[
[
"
buddings
"
,
[
"
/extraction/general/None/volume
"
]],
[
"
buddings
"
,
[
"
/extraction/general/None/volume
"
]],
# ["dsignal", ["/extraction/general/None/volume"]],
[
"
bud_metric
"
,
[
"
/extraction/general/None/volume
"
]],
[
"
bud_metric
"
,
[
"
/extraction/general/None/volume
"
]],
# [
# "dsignal",
# [
# "/postprocessing/bud_metric/extraction_general_None_volume"
# ],
# ],
],
],
}
}
param_sets
=
{
param_sets
=
{
...
@@ -89,29 +82,6 @@ class PostProcessorParameters(ParametersABC):
...
@@ -89,29 +82,6 @@ class PostProcessorParameters(ParametersABC):
}
}
}
}
outpaths
=
{}
outpaths
=
{}
outpaths
[
"
aggregate
"
]
=
"
/postprocessing/experiment_wide/aggregated/
"
# pHlourin experiments are special
if
"
ph_batman
"
in
kind
:
targets
[
"
processes
"
][
"
dsignal
"
].
append
(
[
"
/extraction/em_ratio/np_max/mean
"
,
"
/extraction/em_ratio/np_max/median
"
,
"
/extraction/em_ratio_bgsub/np_max/mean
"
,
"
/extraction/em_ratio_bgsub/np_max/median
"
,
]
)
targets
[
"
processes
"
][
"
aggregate
"
].
append
(
[
[
"
/extraction/em_ratio/np_max/mean
"
,
"
/extraction/em_ratio/np_max/median
"
,
"
/extraction/em_ratio_bgsub/np_max/mean
"
,
"
/extraction/em_ratio_bgsub/np_max/median
"
,
"
/extraction/gsum/np_max/median
"
,
"
/extraction/gsum/np_max/mean
"
,
]
],
)
return
cls
(
targets
=
targets
,
param_sets
=
param_sets
,
outpaths
=
outpaths
)
return
cls
(
targets
=
targets
,
param_sets
=
param_sets
,
outpaths
=
outpaths
)
...
@@ -128,9 +98,9 @@ class PostProcessor(ProcessABC):
...
@@ -128,9 +98,9 @@ class PostProcessor(ProcessABC):
An instance of PostProcessorParameters.
An instance of PostProcessorParameters.
"""
"""
super
().
__init__
(
parameters
)
super
().
__init__
(
parameters
)
self
.
_
filename
=
filename
self
.
filename
=
filename
self
.
_
signal
=
Signal
(
filename
)
self
.
signal
=
Signal
(
filename
)
self
.
_
writer
=
Writer
(
filename
)
self
.
writer
=
Writer
(
filename
)
# parameters for merger and picker
# parameters for merger and picker
dicted_params
=
{
dicted_params
=
{
i
:
parameters
[
"
param_sets
"
][
"
prepost
"
][
i
]
i
:
parameters
[
"
param_sets
"
][
"
prepost
"
][
i
]
...
@@ -167,7 +137,7 @@ class PostProcessor(ProcessABC):
...
@@ -167,7 +137,7 @@ class PostProcessor(ProcessABC):
Necessary before any processes can run.
Necessary before any processes can run.
"""
"""
# run merger
# run merger
record
=
self
.
_
signal
.
get_raw
(
self
.
targets
[
"
prepost
"
][
"
merger
"
])
record
=
self
.
signal
.
get_raw
(
self
.
targets
[
"
prepost
"
][
"
merger
"
])
merges
=
self
.
merger
.
run
(
record
)
merges
=
self
.
merger
.
run
(
record
)
# get lineages from picker
# get lineages from picker
lineage
=
_assoc_indices_to_3d
(
self
.
picker
.
cells
.
mothers_daughters
)
lineage
=
_assoc_indices_to_3d
(
self
.
picker
.
cells
.
mothers_daughters
)
...
@@ -178,18 +148,18 @@ class PostProcessor(ProcessABC):
...
@@ -178,18 +148,18 @@ class PostProcessor(ProcessABC):
new_lineage
=
lineage
new_lineage
=
lineage
new_merges
=
merges
new_merges
=
merges
self
.
lineage
=
_3d_index_to_2d
(
new_lineage
)
self
.
lineage
=
_3d_index_to_2d
(
new_lineage
)
self
.
_
writer
.
write
(
self
.
writer
.
write
(
"
modifiers/merges
"
,
data
=
[
np
.
array
(
x
)
for
x
in
new_merges
]
"
modifiers/merges
"
,
data
=
[
np
.
array
(
x
)
for
x
in
new_merges
]
)
)
self
.
_
writer
.
write
(
self
.
writer
.
write
(
"
modifiers/lineage_merged
"
,
_3d_index_to_2d
(
new_lineage
)
"
modifiers/lineage_merged
"
,
_3d_index_to_2d
(
new_lineage
)
)
)
# run picker
# run picker
picked_indices
=
self
.
picker
.
run
(
picked_indices
=
self
.
picker
.
run
(
self
.
_
signal
[
self
.
targets
[
"
prepost
"
][
"
picker
"
][
0
]]
self
.
signal
[
self
.
targets
[
"
prepost
"
][
"
picker
"
][
0
]]
)
)
if
picked_indices
.
any
():
if
picked_indices
.
any
():
self
.
_
writer
.
write
(
self
.
writer
.
write
(
"
modifiers/picks
"
,
"
modifiers/picks
"
,
data
=
pd
.
MultiIndex
.
from_arrays
(
data
=
pd
.
MultiIndex
.
from_arrays
(
picked_indices
.
T
,
names
=
[
"
trap
"
,
"
cell_label
"
]
picked_indices
.
T
,
names
=
[
"
trap
"
,
"
cell_label
"
]
...
@@ -213,9 +183,9 @@ class PostProcessor(ProcessABC):
...
@@ -213,9 +183,9 @@ class PostProcessor(ProcessABC):
self
.
parameters
[
process
]
self
.
parameters
[
process
]
)
)
else
:
else
:
# assign parameters
# assign
default
parameters
parameters
=
self
.
parameters_classfun
[
process
].
default
()
parameters
=
self
.
parameters_classfun
[
process
].
default
()
# load process
# load process
- instantiate an object in the class
loaded_process
=
self
.
classfun
[
process
](
parameters
)
loaded_process
=
self
.
classfun
[
process
](
parameters
)
if
isinstance
(
parameters
,
LineageProcessParameters
):
if
isinstance
(
parameters
,
LineageProcessParameters
):
loaded_process
.
lineage
=
self
.
lineage
loaded_process
.
lineage
=
self
.
lineage
...
@@ -227,9 +197,9 @@ class PostProcessor(ProcessABC):
...
@@ -227,9 +197,9 @@ class PostProcessor(ProcessABC):
"""
Run process to obtain a single dataset and write the result.
"""
"""
Run process to obtain a single dataset and write the result.
"""
# get pre-processed data
# get pre-processed data
if
isinstance
(
dataset
,
list
):
if
isinstance
(
dataset
,
list
):
signal
=
[
self
.
_
signal
[
d
]
for
d
in
dataset
]
signal
=
[
self
.
signal
[
d
]
for
d
in
dataset
]
elif
isinstance
(
dataset
,
str
):
elif
isinstance
(
dataset
,
str
):
signal
=
self
.
_
signal
[
dataset
]
signal
=
self
.
signal
[
dataset
]
else
:
else
:
raise
(
"
Incorrect dataset
"
)
raise
(
"
Incorrect dataset
"
)
# run process on signal
# run process on signal
...
@@ -292,7 +262,7 @@ class PostProcessor(ProcessABC):
...
@@ -292,7 +262,7 @@ class PostProcessor(ProcessABC):
result
:
t
.
Union
[
t
.
List
,
pd
.
DataFrame
,
np
.
ndarray
],
result
:
t
.
Union
[
t
.
List
,
pd
.
DataFrame
,
np
.
ndarray
],
metadata
:
t
.
Dict
,
metadata
:
t
.
Dict
,
):
):
self
.
_
writer
.
write
(
path
,
result
,
meta
=
metadata
,
overwrite
=
"
overwrite
"
)
self
.
writer
.
write
(
path
,
result
,
meta
=
metadata
,
overwrite
=
"
overwrite
"
)
@staticmethod
@staticmethod
def
pick_mother
(
a
,
b
):
def
pick_mother
(
a
,
b
):
...
...
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