diff --git a/core/io/base.py b/core/io/base.py index 6812bd537afc4f442c79cb471d2343c8326bfe12..a05aa0354697d4a3a4a81f8edcf0a6091ea72a8a 100644 --- a/core/io/base.py +++ b/core/io/base.py @@ -13,6 +13,7 @@ class BridgeH5: """ def __init__(self, file): + self.filename = file self._hdf = h5py.File(file, "r") self._filecheck() diff --git a/core/io/signal.py b/core/io/signal.py index 5ae9e5058653695106074a49032b746452853b3f..da5f73f9dc9cd13fe7cf32fe5240edc35b50d1b9 100644 --- a/core/io/signal.py +++ b/core/io/signal.py @@ -10,12 +10,16 @@ class Signal(BridgeH5): def __init__(self, file): super().__init__(file) - self._hdf.close() # Close the file to use pandas hdf functions - # hdf = pd.HDFStore(file) - # self.file = file def __getitem__(self, dataset): - return pd.read_hdf(self.file, dataset) + dset = self._hdf[dataset] + index = pd.MultiIndex.from_arrays( + [dset[lbl][()] for lbl in dset.keys() if "axis1_label" in lbl] + ) + + columns = dset["axis0"][()] + + return pd.DataFrame(dset[("block0_values")][()], index=index, columns=columns) @staticmethod def _if_ext_or_post(name): diff --git a/core/processor.py b/core/processor.py index be751b0970598627cadbd1ef30721bd61fcb5fc1..eeb3cf9af24ab0ebedb215cfef740c553e9edde4 100644 --- a/core/processor.py +++ b/core/processor.py @@ -10,7 +10,7 @@ from postprocessor.core.io.signal import Signal from core.cells import Cells -class PostProParameters(ParametersABC): +class PostProcessorParameters(ParametersABC): """ Anthology of parameters used for postprocessing :merger: diff --git a/examples/basic_processes.py b/examples/basic_processes.py new file mode 100644 index 0000000000000000000000000000000000000000..8dd85d5fc83c54c112a67a324ff3e55c5d264cba --- /dev/null +++ b/examples/basic_processes.py @@ -0,0 +1,8 @@ +from postprocessor.core.processor import PostProcessor, PostProcessorParameters + +params = PostProcessorParameters.default() +pp = PostProcessor( + "/shared_libs/pipeline-core/scripts/data/ph_calibration_dual_phl_ura8_5_04_5_83_7_69_7_13_6_59__01/ph_5_04_005store.h5", + params, +) +tmp = pp.run() diff --git a/examples/signals.py b/examples/signals.py index 2008c8fdb1dbd5fa689c28913a37605db57fe525..98bdc941eaedaf9b650b13ed17634927fc731ac0 100644 --- a/examples/signals.py +++ b/examples/signals.py @@ -1,4 +1,4 @@ -from postprocessor.core.io.signals import Signal +from postprocessor.core.io.signal import Signal signal = Signal( "/shared_libs/pipeline-core/scripts/data/ph_calibration_dual_phl_ura8_5_04_5_83_7_69_7_13_6_59__01/ph_5_04_001store.h5"