diff --git a/pcore/io/signal.py b/pcore/io/signal.py index 8fd157208cea3e98ad617e08e5d3c274403a408e..d2816a5acefccd86638f868287e7c25c601edd5f 100644 --- a/pcore/io/signal.py +++ b/pcore/io/signal.py @@ -28,6 +28,14 @@ class Signal(BridgeH5): df.name = name return df + def mothers(self, signal, cutoff=0.8): + df = self[signal] + get_mothers = lambda df: df.loc[df.notna().sum(axis=1) > df.shape[1] * cutoff] + if isinstance(df, pd.DataFrame): + return get_mothers(df) + elif isinstance(df, list): + return [get_mothers(d) for d in df] + def __getitem__(self, dsets): if isinstance(dsets, str) and (