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):
reduction: str to be passed to a dataframe for collapsing across columns
"""
def __init__(self, reduction):
def __init__(self, reductions):
super().__init__()
self.reduction = reduction
self.reductions = reductions
@classmethod
def default(cls):
return cls.from_dict({"reduction": "mean"})
return cls.from_dict({"reductions": ["mean", "median", "max"]})
class aggregate(ProcessABC):
......@@ -31,13 +31,14 @@ class aggregate(ProcessABC):
def run(self, signals):
names = np.array([signal.index.names for signal in signals])
if not np.all(names == names[0]):
"Not all indices are the same, selecting smallest set"
index = signals[0].index
for s in signals[0:]:
index = index.intersection(s.index)
index = signals[0].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"
......@@ -54,9 +55,17 @@ class aggregate(ProcessABC):
for ind in item.split("/")
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(
[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,
axis=1,
)
......
......@@ -10,7 +10,7 @@ from utils_find_1st import find_1st, cmp_equal
import numpy as np
import pandas as pd
from core.cells import CellsHDF
from pcore.cells import CellsHDF
from agora.base import ParametersABC, ProcessABC
from postprocessor.core.functions.tracks import max_ntps, max_nonstop_ntps
......
......@@ -8,10 +8,10 @@ import pandas as pd
from tqdm import tqdm
from agora.base import ParametersABC
from core.io.writer import Writer
from core.io.signal import Signal
from pcore.io.writer import Writer
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.picker import pickerParameters, picker
......@@ -82,15 +82,13 @@ class PostProcessorParameters(ParametersABC):
"/extraction/em_ratio_bgsub/np_max/median",
"/extraction/gsum/np_max/median",
"/extraction/gsum/np_max/mean",
"/postprocessing/bud_metric/extraction_general_None_volume",
"/postprocessing/bud_metric/extraction_em_ratio_np_max_mean",
"/postprocessing/bud_metric/extraction_em_ratio_np_max_median",
"postprocessing/bud_metric/extraction_general_None_volume",
"postprocessing/bud_metric/extraction_em_ratio_np_max_mean",
"postprocessing/bud_metric/extraction_em_ratio_np_max_median",
"postprocessing/dsignal/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_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