diff --git a/src/agora/io/signal.py b/src/agora/io/signal.py index 1da5ab1015f436d6c1e2e99c8fc3cc217a7d8021..42b5c9d5876b9d13a4380d95e6e48e4f17c8739c 100644 --- a/src/agora/io/signal.py +++ b/src/agora/io/signal.py @@ -139,7 +139,7 @@ class Signal(BridgeH5): # if lineage_location not in f: # lineage_location = lineage_location.split("_")[0] if lineage_location not in f: - lineage_location = "postprocessor/lineage" + lineage_location = "postprocessing/lineage" tile_mo_da = f[lineage_location] if isinstance(tile_mo_da, h5py.Dataset): diff --git a/src/agora/utils/indexing.py b/src/agora/utils/indexing.py index 5ca4494d59b27fc751b7a8044929d1d6d555ba41..789ca5a0423fd84733f7721ff6c35a411b2c5aaa 100644 --- a/src/agora/utils/indexing.py +++ b/src/agora/utils/indexing.py @@ -114,10 +114,21 @@ def _assoc_indices_to_3d(ndarray: np.ndarray): """ result = ndarray if len(ndarray) and ndarray.ndim > 1: - result = np.transpose( - np.hstack((ndarray[:, [0]], ndarray)).reshape(-1, 2, 2), - axes=[0, 2, 1], - ) + if ndarray.shape[1] == 3: # Faster indexing for single positions + result = np.transpose( + np.hstack((ndarray[:, [0]], ndarray)).reshape(-1, 2, 2), + axes=[0, 2, 1], + ) + else: # 20% slower but more general indexing + columns = np.arange(ndarray.shape[1]) + + result = np.stack( + ( + ndarray[:, np.delete(columns, -1)], + ndarray[:, np.delete(columns, -2)], + ), + axis=1, + ) return result diff --git a/src/postprocessor/core/lineageprocess.py b/src/postprocessor/core/lineageprocess.py index 8c2874e24c48e81257612b0c536b27e299070a5a..ff332faba7cca8bbe26aaa969964b7a78ff704bf 100644 --- a/src/postprocessor/core/lineageprocess.py +++ b/src/postprocessor/core/lineageprocess.py @@ -60,7 +60,7 @@ class LineageProcess(PostProcessABC): elif hasattr(self, "lineage"): lineage = self.lineage elif hasattr(self, "cells"): - with h5py.File(self.cells.filename, "a") as f: + with h5py.File(self.cells.filename, "r") as f: if (lineage_loc := "modifiers/lineage_merged") in f and merged: lineage = f.get(lineage_loc)[()] elif (lineage_loc := "modifiers/lineage)") in f: