spindle_detection and spindles, legacy and modern

- legacy: husos.detectar / husos.resumen vendored unchanged, run on the
  'sueno' windows as medidas_director does; the wake rhythm that sets the
  'rhythm near sigma' flag is computed inside the process (no biomarker
  dependency).
- modern: the same detector on MNE (sigma band-pass) and SciPy (Hilbert,
  Welch narrowness, phase stability); summary with the director's
  definitions; one baseline per feature.
- privacy.group_size understands per-feature baseline dicts.

Legacy equals the submodule's cluster route exactly (spindle count and the
six summary measures); modern equals legacy on the synthetic study.
This commit is contained in:
AlbertoPMDM
2026-11-18 20:57:24 -06:00
parent 1f8793aacb
commit f870ee9f14
27 changed files with 9923 additions and 0 deletions
+4
View File
@@ -43,6 +43,10 @@ def group_size(baseline: dict | None) -> float | None:
"""Reference group size of a baseline dict, if its format is known."""
if not baseline:
return None
if all(isinstance(v, dict) and "name" in v for v in baseline.values()): # one per feature
sizes = [group_size(v) for v in baseline.values()]
sizes = [s for s in sizes if s is not None]
return min(sizes) if sizes else None
st = baseline.get("state")
if isinstance(st, dict) and "n" in st:
return float(st["n"])