spindle phases (N2/N3), README, registry test for the full module set
- spindle_detection (legacy and modern): phase='N2'|'N3' searches only the sleep windows of that stage (husos --fase); requires slow_wave_staging then. - README: modules, requirements, use, tests and cluster verification. - test_pipeline: both implementations register the same 5 processes and 9 biomarkers.
This commit is contained in:
@@ -101,3 +101,19 @@ def test_biomarker_contract(tmp_path):
|
||||
age_months=20 + 4 * i) for i in range(3)]
|
||||
from tea_modulo.biomarkers.spindles import Spindles
|
||||
check_biomarker(Spindles(baseline="age_blocks"), sts, [20, 24, 28])
|
||||
|
||||
|
||||
@pytest.mark.parametrize("impl", ["modern", "legacy"])
|
||||
def test_phase_restricts_the_search(studies, impl):
|
||||
"""phase='N3' searches only N3 sleep windows (none in this study: no spindles, no minutes)."""
|
||||
s = studies[0] if impl == "modern" else studies[1]
|
||||
pipe = Pipeline.default(impl)
|
||||
det = type(pipe.module("spindle_detection"))(phase="N3")
|
||||
assert det.requires == ("sleep_state", "slow_wave_staging")
|
||||
ev = det.predict(s).events
|
||||
n3 = (s.label("slow_wave_staging").per_window == "N3").sum()
|
||||
assert n3 == 0 and len(ev) == 0 and ev.attrs["minutes"] == 0
|
||||
det2 = type(pipe.module("spindle_detection"))(phase="N2")
|
||||
assert len(det2.predict(s).events) == len(s.label("spindle_detection").events) # all sleep is N2 here
|
||||
with pytest.raises(ValueError, match="phase"):
|
||||
type(pipe.module("spindle_detection"))(phase="REM")
|
||||
|
||||
Reference in New Issue
Block a user