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
9d3f4620
Commit
9d3f4620
authored
3 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Patches
Plain Diff
bugfix and clean
parent
e10e1209
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pcore/pipeline.py
+30
-17
30 additions, 17 deletions
pcore/pipeline.py
scripts/run.py
+7
-0
7 additions, 0 deletions
scripts/run.py
with
37 additions
and
17 deletions
pcore/pipeline.py
+
30
−
17
View file @
9d3f4620
...
...
@@ -14,6 +14,7 @@ from tqdm import tqdm
from
time
import
perf_counter
import
pandas
as
pd
from
pathos.multiprocessing
import
Pool
from
agora.base
import
ParametersABC
,
ProcessABC
from
pcore.experiment
import
MetaData
...
...
@@ -24,11 +25,9 @@ from pcore.segment import Tiler, TilerParameters
from
pcore.io.writer
import
TilerWriter
,
BabyWriter
from
pcore.io.signal
import
Signal
from
extraction.core.extractor
import
Extractor
,
ExtractorParameters
from
extraction.core.functions.defaults
import
exparams_from_meta
from
postprocessor.core.processor
import
PostProcessor
,
PostProcessorParameters
# from pcore.experiment import ExperimentOMERO, ExperimentLocal
# from pcore.utils import timed
class
PipelineParameters
(
ParametersABC
):
def
__init__
(
self
,
general
,
tiler
,
baby
,
extraction
,
postprocessing
):
...
...
@@ -39,12 +38,24 @@ class PipelineParameters(ParametersABC):
self
.
postprocessing
=
postprocessing
@classmethod
def
default
(
cls
):
def
default
(
cls
,
general
=
{},
tiler
=
{},
baby
=
{},
extraction
=
{},
postprocessing
=
{},
):
"""
Load unit test experiment
:expt_id: Experiment id
:directory: Output directory
Provides default parameters for the entire pipeline. This downloads the logfiles and sets the default
timepoints and extraction parameters from there.
"""
expt_id
=
19993
directory
=
Path
(
"
../data
"
)
expt_id
=
general
.
get
(
"
expt_id
"
,
19993
)
directory
=
Path
(
general
.
get
(
"
directory
"
,
"
../data
"
)
)
with
Dataset
(
int
(
expt_id
))
as
conn
:
directory
=
directory
/
conn
.
unique_name
if
not
directory
.
exists
():
...
...
@@ -52,27 +63,29 @@ class PipelineParameters(ParametersABC):
# Download logs to use for metadata
conn
.
cache_logs
(
directory
)
meta
=
MetaData
(
directory
,
None
).
load_logs
()
return
cls
(
general
=
dict
(
tps
=
meta
[
"
time_settings/ntimepoints
"
][
0
]
defaults
=
{
"
general
"
:
dict
(
id
=
expt_id
,
distributed
=
0
,
tps
=
2
,
tps
=
tps
,
directory
=
directory
,
strain
=
""
,
tile_size
=
96
,
earlystop
=
dict
(
min_tp
=
50
,
thresh_pos_clogged
=
0.3
,
thresh_trap_clogged
=
7
,
ntps_to_eval
=
5
,
),
),
tiler
=
TilerParameters
.
default
(),
baby
=
BabyParameters
.
default
(),
extraction
=
ExtractorParameters
.
from_meta
(
meta
),
postprocessing
=
PostProcessorParameters
.
default
(),
)
)
}
defaults
[
"
tiler
"
]
=
TilerParameters
.
default
().
to_dict
()
defaults
[
"
baby
"
]
=
BabyParameters
.
default
().
to_dict
()
defaults
[
"
extraction
"
]
=
exparams_from_meta
(
meta
)
defaults
[
"
postprocessing
"
]
=
PostProcessorParameters
.
default
().
to_dict
()
for
k
in
defaults
.
keys
():
exec
(
"
defaults[k].update(
"
+
k
+
"
)
"
)
return
cls
(
**
{
k
:
v
for
k
,
v
in
defaults
.
items
()})
def
load_logs
(
self
):
parsed_flattened
=
parse_logfiles
(
self
.
log_dir
)
...
...
This diff is collapsed.
Click to expand it.
scripts/run.py
0 → 100644
+
7
−
0
View file @
9d3f4620
#!/usr/bin/env python3
from
pcore.pipeline
import
PipelineParameters
,
Pipeline
params
=
PipelineParameters
.
default
(
general
=
{
"
expt_id
"
:
19995
,
"
distributed
"
:
5
})
p
=
Pipeline
(
params
)
p
.
run
()
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