Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aliby-mirror
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
aliby-mirror
Commits
0bb1854e
Commit
0bb1854e
authored
3 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Patches
Plain Diff
update setup.py
Former-commit-id: 11d322c1681aeecfc8a2b9b086fb73374b5720f2
parent
7172de26
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/cell.py
+1
-0
1 addition, 0 deletions
core/cell.py
examples/testing.py
+48
-31
48 additions, 31 deletions
examples/testing.py
with
49 additions
and
31 deletions
core/cell.py
+
1
−
0
View file @
0bb1854e
...
@@ -18,5 +18,6 @@ def growth_rate(data:Series, alg=None, filt = 'savgol'):
...
@@ -18,5 +18,6 @@ def growth_rate(data:Series, alg=None, filt = 'savgol'):
if
alg
is
None
:
if
alg
is
None
:
alg
=
'
standard
'
alg
=
'
standard
'
This diff is collapsed.
Click to expand it.
examples/testing.py
+
48
−
31
View file @
0bb1854e
...
@@ -7,53 +7,67 @@ from pandas import Series
...
@@ -7,53 +7,67 @@ from pandas import Series
from
postprocessor.core.postprocessor
import
PostProcessor
from
postprocessor.core.postprocessor
import
PostProcessor
from
postprocessor.core.tracks
import
non_uniform_savgol
from
postprocessor.core.tracks
import
non_uniform_savgol
pp
=
PostProcessor
(
source
=
19
831
)
pp
=
PostProcessor
(
source
=
19
916
)
# 19916
pp
.
load_tiler_cells
()
pp
.
load_tiler_cells
()
f
=
'
/home/alan/Documents/libs/extraction/extraction/examples/gluStarv_2_0_x2_dual_phl_ura8_00/extraction
'
# f = '/home/alan/Documents/libs/extraction/extraction/examples/gluStarv_2_0_x2_dual_phl_ura8_00/extraction'
pp
.
load_extraction
(
'
/home/alan/Documents/libs/extraction/extraction/examples/
'
+
pp
.
expt
.
name
+
'
/extraction/
'
)
f
=
"
/home/alan/Documents/libs/extraction/extraction/examples/pH_calibration_dual_phl__ura8__by4741__01
"
pp
.
load_extraction
(
"
/home/alan/Documents/libs/extraction/extraction/examples/
"
+
pp
.
expt
.
name
+
"
/extraction/
"
)
tmp
=
pp
.
extraction
[
'
phl_ura8_002
'
]
tmp
=
pp
.
extraction
[
pp
.
expt
.
positions
[
0
]
]
# prepare data
# prepare data
test
=
tmp
[(
'
GFPFast
'
,
np
.
maximum
,
'
mean
'
)]
test
=
tmp
[(
"
GFPFast
"
,
np
.
maximum
,
"
mean
"
)]
clean
=
test
.
loc
[
test
.
notna
().
sum
(
axis
=
1
)
>
30
]
clean
=
test
.
loc
[
test
.
notna
().
sum
(
axis
=
1
)
>
30
]
window
=
9
window
=
9
degree
=
3
degree
=
3
savgol_on_srs
=
lambda
x
:
Series
(
non_uniform_savgol
(
x
.
dropna
().
index
,
x
.
dropna
().
values
,
savgol_on_srs
=
lambda
x
:
Series
(
window
,
degree
),
index
=
x
.
dropna
().
index
)
non_uniform_savgol
(
x
.
dropna
().
index
,
x
.
dropna
().
values
,
window
,
degree
),
index
=
x
.
dropna
().
index
,
)
smooth
=
clean
.
apply
(
savgol_on_srs
,
axis
=
1
)
smooth
=
clean
.
apply
(
savgol_on_srs
,
axis
=
1
)
from
random
import
randint
from
random
import
randint
x
=
randint
(
0
,
len
(
smooth
))
x
=
randint
(
0
,
len
(
smooth
))
plt
.
plot
(
clean
.
iloc
[
x
],
'
b
'
)
plt
.
plot
(
clean
.
iloc
[
x
],
"
b
"
)
plt
.
plot
(
smooth
.
iloc
[
x
],
'
r
'
)
plt
.
plot
(
smooth
.
iloc
[
x
],
"
r
"
)
plt
.
show
()
plt
.
show
()
def
growth_rate
(
data
:
Series
,
alg
=
None
,
filt
=
{
'
kind
'
:
'
savgol
'
,
'
window
'
:
9
,
'
degree
'
:
3
}):
def
growth_rate
(
data
:
Series
,
alg
=
None
,
filt
=
{
"
kind
"
:
"
savgol
"
,
"
window
"
:
9
,
"
degree
"
:
3
}
):
if
alg
is
None
:
if
alg
is
None
:
alg
=
'
standard
'
alg
=
"
standard
"
if
filt
:
# TODO add support for multiple algorithms
data
=
Series
(
non_uniform_savgol
(
data
.
dropna
().
index
,
data
.
dropna
().
values
,
window
,
degree
),
index
=
data
.
dropna
().
index
,
)
if
filt
:
#TODO add support for multiple algorithms
return
Series
(
np
.
convolve
(
data
,
diff_kernel
,
"
same
"
),
index
=
data
.
dropna
().
index
)
data
=
Series
(
non_uniform_savgol
(
data
.
dropna
().
index
,
data
.
dropna
().
values
,
window
,
degree
),
index
=
data
.
dropna
().
index
)
return
Series
(
np
.
convolve
(
data
,
diff_kernel
,
'
same
'
),
index
=
data
.
dropna
().
index
)
import
numpy
as
np
import
numpy
as
np
diff_kernel
=
np
.
array
([
1
,
-
1
])
diff_kernel
=
np
.
array
([
1
,
-
1
])
gr
=
clean
.
apply
(
growth_rate
,
axis
=
1
)
gr
=
clean
.
apply
(
growth_rate
,
axis
=
1
)
def
sort_df
(
df
,
by
=
'
first
'
,
rev
=
True
):
def
sort_df
(
df
,
by
=
"
first
"
,
rev
=
True
):
nona
=
df
.
notna
()
nona
=
df
.
notna
()
if
by
==
'
len
'
:
if
by
==
"
len
"
:
idx
=
nona
.
sum
(
axis
=
1
)
idx
=
nona
.
sum
(
axis
=
1
)
elif
by
==
'
first
'
:
elif
by
==
"
first
"
:
idx
=
nona
.
idxmax
(
axis
=
1
)
idx
=
nona
.
idxmax
(
axis
=
1
)
idx
=
idx
.
sort_values
().
index
idx
=
idx
.
sort_values
().
index
...
@@ -62,23 +76,26 @@ def sort_df(df, by='first', rev=True):
...
@@ -62,23 +76,26 @@ def sort_df(df, by='first', rev=True):
return
df
.
loc
[
idx
]
return
df
.
loc
[
idx
]
test
=
tmp
[(
'
GFPFast
'
,
np
.
maximum
,
'
median
'
)]
test2
=
tmp
[(
'
pHluorin405
'
,
np
.
maximum
,
'
median
'
)]
test
=
tmp
[(
"
GFPFast
"
,
np
.
maximum
,
"
median
"
)]
ph
=
test
/
test2
test2
=
tmp
[(
"
pHluorin405
"
,
np
.
maximum
,
"
median
"
)]
ph
=
test
/
test2
ph
=
ph
.
stack
().
reset_index
(
1
)
ph
=
ph
.
stack
().
reset_index
(
1
)
ph
.
columns
=
[
'
tp
'
,
'
fl
'
]
ph
.
columns
=
[
"
tp
"
,
"
fl
"
]
def
m2p5_med
(
ext
,
ch
,
red
=
np
.
maximum
):
def
m2p5_med
(
ext
,
ch
,
red
=
np
.
maximum
):
m2p5pc
=
ext
[(
ch
,
red
,
'
max2p5pc
'
)]
m2p5pc
=
ext
[(
ch
,
red
,
"
max2p5pc
"
)]
med
=
ext
[(
ch
,
red
,
'
median
'
)]
med
=
ext
[(
ch
,
red
,
"
median
"
)]
result
=
m2p5pc
/
med
result
=
m2p5pc
/
med
return
result
return
result
def
plot_avg
(
df
):
def
plot_avg
(
df
):
df
=
df
.
stack
().
reset_index
(
1
)
df
=
df
.
stack
().
reset_index
(
1
)
df
.
columns
=
[
'
tp
'
,
'
val
'
]
df
.
columns
=
[
"
tp
"
,
"
val
"
]
sns
.
relplot
(
x
=
df
[
'
tp
'
],
y
=
df
[
'
val
'
],
kind
=
'
line
'
)
sns
.
relplot
(
x
=
df
[
"
tp
"
],
y
=
df
[
"
val
"
],
kind
=
"
line
"
)
plt
.
show
()
plt
.
show
()
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