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
c696b4aa
Commit
c696b4aa
authored
1 year ago
by
pswain
Browse files
Options
Downloads
Patches
Plain Diff
refactor(run_gr): renamed batch to multiprocess
parent
be617ffb
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
examples/run_gr.py
+4
-4
4 additions, 4 deletions
examples/run_gr.py
growth_rate.py
+8
-8
8 additions, 8 deletions
growth_rate.py
with
12 additions
and
12 deletions
examples/run_gr.py
+
4
−
4
View file @
c696b4aa
...
@@ -14,11 +14,11 @@ datasets = [
...
@@ -14,11 +14,11 @@ datasets = [
# 1. It is better to run dataloader first to generate a tsv file.
# 1. It is better to run dataloader first to generate a tsv file.
# Alternatively, to run directly on h5 files, add use_tsv=False.
# Alternatively, to run directly on h5 files, add use_tsv=False.
# 2. First run with run_GP = True,
batch
=False, and max_no_cells = 20
# 2. First run with run_GP = True,
multiprocess
=False, and max_no_cells = 20
# to check visually the results.
# to check visually the results.
# 3. Then run with max_no_cells=None and
batch
=True for multiprocessing.
# 3. Then run with max_no_cells=None and
multiprocess
=True for multiprocessing.
# The results are saved in a pkl file.
# The results are saved in a pkl file.
# No figures are produced unless
batch
=False.
# No figures are produced unless
multiprocess
=False.
# Any figures are saved in a pdf file.
# Any figures are saved in a pdf file.
# 4. Finally run with run_GP = False.
# 4. Finally run with run_GP = False.
# This load the pkl file and integrates into dataloader's data frame.
# This load the pkl file and integrates into dataloader's data frame.
...
@@ -32,7 +32,7 @@ for dataname in datasets:
...
@@ -32,7 +32,7 @@ for dataname in datasets:
dataname
,
dataname
,
max_no_cells
=
20
,
max_no_cells
=
20
,
wdir
=
wdir
,
wdir
=
wdir
,
batch
=
False
,
multiprocess
=
False
,
convert_to_hours
=
False
,
convert_to_hours
=
False
,
mother_bounds
=
{
1
:
(
1
,
6
),
2
:
(
-
1
,
4
)},
mother_bounds
=
{
1
:
(
1
,
6
),
2
:
(
-
1
,
4
)},
)
)
...
...
This diff is collapsed.
Click to expand it.
growth_rate.py
+
8
−
8
View file @
c696b4aa
...
@@ -20,7 +20,7 @@ def find_all_grs(
...
@@ -20,7 +20,7 @@ def find_all_grs(
use_tsv
=
True
,
use_tsv
=
True
,
bud_bounds
=
None
,
bud_bounds
=
None
,
mother_bounds
=
None
,
mother_bounds
=
None
,
batch
=
False
,
multiprocess
=
False
,
convert_to_hours
=
True
,
convert_to_hours
=
True
,
):
):
"""
"""
...
@@ -45,7 +45,7 @@ def find_all_grs(
...
@@ -45,7 +45,7 @@ def find_all_grs(
mother_bounds: dict, optional
mother_bounds: dict, optional
To change bounds on the hyperparameters for the Gaussian process
To change bounds on the hyperparameters for the Gaussian process
applied to mothers.
applied to mothers.
batch
: boolean, optional
multiprocess
: boolean, optional
If True, use multiprocessing, but no plots are then produced.
If True, use multiprocessing, but no plots are then produced.
convert_to_hours: boolean
convert_to_hours: boolean
If True, divide time values by 60.
If True, divide time values by 60.
...
@@ -78,7 +78,7 @@ def find_all_grs(
...
@@ -78,7 +78,7 @@ def find_all_grs(
buddings
,
buddings
,
max_no_cells
=
max_no_cells
,
max_no_cells
=
max_no_cells
,
bounds
=
bud_bounds
,
bounds
=
bud_bounds
,
batch
=
batch
,
multiprocess
=
multiprocess
,
convert_to_hours
=
convert_to_hours
,
convert_to_hours
=
convert_to_hours
,
)
)
if
save
:
if
save
:
...
@@ -91,7 +91,7 @@ def find_all_grs(
...
@@ -91,7 +91,7 @@ def find_all_grs(
m_vol
,
m_vol
,
max_no_cells
=
max_no_cells
,
max_no_cells
=
max_no_cells
,
bounds
=
mother_bounds
,
bounds
=
mother_bounds
,
batch
=
batch
,
multiprocess
=
multiprocess
,
convert_to_hours
=
convert_to_hours
,
convert_to_hours
=
convert_to_hours
,
)
)
if
save
:
if
save
:
...
@@ -107,7 +107,7 @@ def find_gr(
...
@@ -107,7 +107,7 @@ def find_gr(
bounds
=
None
,
bounds
=
None
,
noruns
=
10
,
noruns
=
10
,
verbose
=
True
,
verbose
=
True
,
batch
=
False
,
multiprocess
=
False
,
max_no_cells
=
None
,
max_no_cells
=
None
,
convert_to_hours
=
True
,
convert_to_hours
=
True
,
):
):
...
@@ -158,9 +158,9 @@ def find_gr(
...
@@ -158,9 +158,9 @@ def find_gr(
else
:
else
:
no_cells
=
volume
.
shape
[
0
]
no_cells
=
volume
.
shape
[
0
]
# loop over cells
# loop over cells
if
batch
:
if
multiprocess
:
config
[
"
verbose
"
]
=
False
config
[
"
verbose
"
]
=
False
res
=
run_
batch
(
t
,
volume
,
buddings_df
,
buddings
,
no_cells
,
config
)
res
=
run_
parallel
(
t
,
volume
,
buddings_df
,
buddings
,
no_cells
,
config
)
else
:
else
:
res
=
run_series
(
t
,
volume
,
buddings_df
,
buddings
,
no_cells
,
config
)
res
=
run_series
(
t
,
volume
,
buddings_df
,
buddings
,
no_cells
,
config
)
# convert results into dataframes
# convert results into dataframes
...
@@ -215,7 +215,7 @@ def run_series(t, volume, buddings_df, buddings, no_cells, config):
...
@@ -215,7 +215,7 @@ def run_series(t, volume, buddings_df, buddings, no_cells, config):
return
res
return
res
def
run_
batch
(
t
,
volume
,
buddings_df
,
buddings
,
no_cells
,
config
):
def
run_
parallel
(
t
,
volume
,
buddings_df
,
buddings
,
no_cells
,
config
):
"""
"""
Use multiprocessing to speed GPs.
Use multiprocessing to speed GPs.
...
...
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