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
9bb8981b
Commit
9bb8981b
authored
3 years ago
by
Alán Muñoz
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/improve_tiling' into improve_tiling
parents
bcc28311
cc949da9
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/grouper.py
+17
-37
17 additions, 37 deletions
pcore/grouper.py
setup.py
+2
-1
2 additions, 1 deletion
setup.py
with
19 additions
and
38 deletions
pcore/grouper.py
+
17
−
37
View file @
9bb8981b
...
...
@@ -2,6 +2,7 @@
from
abc
import
ABC
,
abstractmethod
,
abstractproperty
from
pathlib
import
Path
from
pathos.multiprocessing
import
Pool
import
h5py
import
numpy
as
np
...
...
@@ -9,9 +10,6 @@ import pandas as pd
from
pcore.io.signal
import
Signal
# fname = "/shared_libs/pipeline-core/data/2021_04_19_pH_calibration_dual_phl__ura8__by4741_Alan4_00"
fname
=
"
/shared_libs/pydask/pipeline-core/data/2021_08_21_KCl_pH_00/
"
class
Grouper
(
ABC
):
"""
...
...
@@ -40,15 +38,13 @@ class Grouper(ABC):
pass
def
concat_signal
(
self
,
path
,
reduce_cols
=
None
,
axis
=
0
):
signals
=
[]
for
group
,
signal
in
self
.
signals
.
items
():
print
(
"
looking at
"
,
signal
.
filename
)
combined
=
signal
[
path
]
combined
[
"
position
"
]
=
group
combined
[
"
group
"
]
=
self
.
group_names
[
group
]
combined
.
set_index
([
"
group
"
,
"
position
"
],
inplace
=
True
,
append
=
True
)
combined
.
index
=
combined
.
index
.
swaplevel
(
-
2
,
0
).
swaplevel
(
-
1
,
1
)
signals
.
append
(
combined
)
group_names
=
self
.
group_names
sitems
=
self
.
signals
.
items
()
with
Pool
(
8
)
as
p
:
signals
=
p
.
map
(
lambda
x
:
concat_signal_ind
(
path
,
group_names
,
x
[
0
],
x
[
1
]),
sitems
,
)
sorted
=
pd
.
concat
(
signals
,
axis
=
axis
).
sort_index
()
if
reduce_cols
:
...
...
@@ -154,28 +150,12 @@ class phGrouper(NameGrouper):
return
aggregated
# g = NameGrouper(fname)
# signame = "/extraction/em_ratio/np_max/mean"
# shortname = "_".join((signame.split("/")[2], signame.split("/")[4]))
# c = g.concat_signal(signame)
# d = c[c.notna().sum(axis=1) > c.shape[1] * 0.8]
# e = d.melt(var_name="tp", ignore_index=False, value_name=shortname).reset_index()
# e[shortname] = 1 / e[shortname]
# Plot comparable to Ivan's
# sns.lineplot(
# data=e,
# x="tp",
# y=shortname,
# hue="group",
# palette=["blue", "orange", "yellow", "purple", "green"],
# )
# plt.title(signame)
# plt.ylabel(shortname)
# plt.show()
# Check if traplocs make sense
# for traplocs in tlocs.values():
# x, y = list(zip(*traplocs))
# plt.scatter(x, y)
# plt.show()
def
concat_signal_ind
(
path
,
group_names
,
group
,
signal
):
print
(
"
Looking at
"
,
group
)
combined
=
signal
[
path
]
combined
[
"
position
"
]
=
group
combined
[
"
group
"
]
=
group_names
[
group
]
combined
.
set_index
([
"
group
"
,
"
position
"
],
inplace
=
True
,
append
=
True
)
combined
.
index
=
combined
.
index
.
swaplevel
(
-
2
,
0
).
swaplevel
(
-
1
,
1
)
return
combined
This diff is collapsed.
Click to expand it.
setup.py
+
2
−
1
View file @
9bb8981b
from
setuptools
import
setup
,
find_packages
print
(
"
find_packages outputs
"
,
find_packages
(
'
pcore
'
))
print
(
"
find_packages outputs
"
,
find_packages
(
"
pcore
"
))
setup
(
name
=
"
pipeline-core
"
,
version
=
"
0.1.1-dev
"
,
...
...
@@ -27,6 +27,7 @@ setup(
"
tables
"
,
"
imageio==2.8.0
"
,
"
omero-py>=5.6.2
"
,
"
pathos
"
,
"
zeroc-ice==3.6.5
"
,
"
tensorflow>=1.15,<=2.3
"
,
"
baby@git+ssh://git@git.ecdf.ed.ac.uk/swain-lab/python-pipeline/baby.git@master
"
,
...
...
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