Skip to content
Snippets Groups Projects
Commit 5c298b49 authored by Alán Muñoz's avatar Alán Muñoz
Browse files

change names

Former-commit-id: 20564313baff9451f0f8f86dc5300f4cfd8ffb3b
parent 6d46ec2d
No related branches found
No related tags found
No related merge requests found
...@@ -12,13 +12,13 @@ class aggregateParameters(ParametersABC): ...@@ -12,13 +12,13 @@ class aggregateParameters(ParametersABC):
reduction: str to be passed to a dataframe for collapsing across columns reduction: str to be passed to a dataframe for collapsing across columns
""" """
def __init__(self, reduction): def __init__(self, reductions):
super().__init__() super().__init__()
self.reduction = reduction self.reductions = reductions
@classmethod @classmethod
def default(cls): def default(cls):
return cls.from_dict({"reduction": "mean"}) return cls.from_dict({"reductions": ["mean", "median", "max"]})
class aggregate(ProcessABC): class aggregate(ProcessABC):
...@@ -31,13 +31,14 @@ class aggregate(ProcessABC): ...@@ -31,13 +31,14 @@ class aggregate(ProcessABC):
def run(self, signals): def run(self, signals):
names = np.array([signal.index.names for signal in signals]) names = np.array([signal.index.names for signal in signals])
if not np.all(names == names[0]): index = signals[0].index
"Not all indices are the same, selecting smallest set" for s in signals[0:]:
index = signals[0].index index = index.intersection(s.index)
for s in signals[0:]:
index = index.intersection(s.index)
signals = [s.loc[index] for s in signals] tmp_signals = [s.loc[index] for s in signals]
for i, s in enumerate(signals):
tmp_signals[i].name = s.name
signals = tmp_signals
assert len(signals), "Signals is empty" assert len(signals), "Signals is empty"
...@@ -54,9 +55,17 @@ class aggregate(ProcessABC): ...@@ -54,9 +55,17 @@ class aggregate(ProcessABC):
for ind in item.split("/") for ind in item.split("/")
if ind not in bad_words if ind not in bad_words
] ]
colnames = ["_".join(get_keywords(s)) for s in signals] colnames = [
"_".join(get_keywords(s) + [red])
for s in signals
for red in self.parameters.reductions
]
concat = pd.concat( concat = pd.concat(
[getattr(signal, self.parameters.reduction)(axis=1) for signal in signals], [
getattr(signal, red)(axis=1)
for signal in signals
for red in self.parameters.reductions
],
names=signals[0].index.names, names=signals[0].index.names,
axis=1, axis=1,
) )
......
...@@ -10,7 +10,7 @@ from utils_find_1st import find_1st, cmp_equal ...@@ -10,7 +10,7 @@ from utils_find_1st import find_1st, cmp_equal
import numpy as np import numpy as np
import pandas as pd import pandas as pd
from core.cells import CellsHDF from pcore.cells import CellsHDF
from agora.base import ParametersABC, ProcessABC from agora.base import ParametersABC, ProcessABC
from postprocessor.core.functions.tracks import max_ntps, max_nonstop_ntps from postprocessor.core.functions.tracks import max_ntps, max_nonstop_ntps
......
...@@ -8,10 +8,10 @@ import pandas as pd ...@@ -8,10 +8,10 @@ import pandas as pd
from tqdm import tqdm from tqdm import tqdm
from agora.base import ParametersABC from agora.base import ParametersABC
from core.io.writer import Writer from pcore.io.writer import Writer
from core.io.signal import Signal from pcore.io.signal import Signal
from core.cells import Cells from pcore.cells import Cells
from postprocessor.core.processes.merger import mergerParameters, merger from postprocessor.core.processes.merger import mergerParameters, merger
from postprocessor.core.processes.picker import pickerParameters, picker from postprocessor.core.processes.picker import pickerParameters, picker
...@@ -82,15 +82,13 @@ class PostProcessorParameters(ParametersABC): ...@@ -82,15 +82,13 @@ class PostProcessorParameters(ParametersABC):
"/extraction/em_ratio_bgsub/np_max/median", "/extraction/em_ratio_bgsub/np_max/median",
"/extraction/gsum/np_max/median", "/extraction/gsum/np_max/median",
"/extraction/gsum/np_max/mean", "/extraction/gsum/np_max/mean",
"/postprocessing/bud_metric/extraction_general_None_volume", "postprocessing/bud_metric/extraction_general_None_volume",
"/postprocessing/bud_metric/extraction_em_ratio_np_max_mean", "postprocessing/bud_metric/extraction_em_ratio_np_max_mean",
"/postprocessing/bud_metric/extraction_em_ratio_np_max_median", "postprocessing/bud_metric/extraction_em_ratio_np_max_median",
"postprocessing/dsignal/extraction_general_None_volume", "postprocessing/dsignal/extraction_general_None_volume",
"postprocessing/dsignal/postprocessing_bud_metric_extraction_general_None_volume", "postprocessing/dsignal/postprocessing_bud_metric_extraction_general_None_volume",
"postprocessing/dsignal/postprocessing_bud_metric_extraction_em_ratio_np_max_median", "postprocessing/dsignal/postprocessing_bud_metric_extraction_em_ratio_np_max_median",
"postprocessing/dsignal/postprocessing_bud_metric_extraction_em_ratio_np_max_mean", "postprocessing/dsignal/postprocessing_bud_metric_extraction_em_ratio_np_max_mean",
"postprocessing/dsignal/postprocessing_bud_metric_extraction_em_ratio_bgsub_np_max_median",
"postprocessing/dsignal/postprocessing_bud_metric_extraction_em_ratio_bgsub_np_max_mean",
] ]
], ],
), ),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment