Commit Graph

6 Commits

Author SHA1 Message Date
AlbertoPMDM acfd3a70d4 preprocessing: modern Preprocessor on MNE, agreeing with the director's output
Executes a PreprocessPlan with MNE: EDF read and label normalisation, plan
bads dropped, line removal on the raw signal (interpolated notch when the
line is >= min_db on the kept scalp channels, or ZapLine via meegkit),
Raw.filter (IIR Butterworth order 4, zero phase, run by run between
BAD_ACQ_SKIP), set_eeg_reference (average of kept scalp / linked ears),
EOG/ECG filtered only. Window grid and quality spans from a private copy of
the window QC.

Within 0.25 uV of legacy.preprocessing on every channel of both default
plans away from the filter edges (max(5 s, 3/highpass)).
2026-11-18 20:50:33 -06:00
AlbertoPMDM fcd0f76d76 validation: modern validation on MNE/SciPy, agreeing with the director's
The director's rules (validacion.validar, preproceso.canales_malos,
lote.qc_estudio window QC, triaje.triar, cluster gates) rebuilt on MNE
(EDF reading, IIR filtering run by run, Welch PSD), SciPy and antropy (DFA).
All thresholds in rules.ValidationConfig with their sources; edfio header
checks (no silent resampling); R4B FHIR Bundle (private copy of the builder).

Agrees with legacy.validation on dropped channels, triage level and verdict
in every synthetic case; accepted differences (gaps as NaN, one notch, MNE
filter edges, no set-up detection) are documented and tested.
2026-11-18 20:47:07 -06:00
AlbertoPMDM 038836a701 pipeline: module registry, run_study, Dask runner and legacy serial executor
- Modules are looked up by name through entry points (tea_modulo.modules,
  tea_modulo.legacy_modules) and checked against their protocol.
- run_study: one EDF to one small row (key, verdict, features, plan hash,
  module versions; failures become error rows with paths removed).
- Modern batches are Dask-native: a dask.delayed graph under
  annotate(priority=-10, retries=1), run on cluster='remote'|'local'|'sync'|
  'auto'. Remote: Client(direct_to_workers=False), get_versions(check=True),
  only close(). Local: processes, 1 thread, BLAS threads 1, closed by us.
- Legacy batches: tea_modulo.legacy.executor.run_serial, a plain loop.
- storage.local_copy fetches s3:// objects to a temp file inside the task.

Tests: legacy loop, Dask sync and a 2-worker LocalCluster give the same
table; error rows; positive priority refused; remote never shut down.
2026-11-18 20:18:07 -06:00
AlbertoPMDM 2b4bea0c7f export: optional KTLX -> EDF+ exporter vendored from eeg@92bc2a0
Step 2 of the plan. src/eeg/utils copied into tea_modulo.export with only the
imports changed; outside the EDF pipeline (extra `export`, script ktlx2edf).
Synthetic tests (ktlx_synth, edf export, patient) carried over: 43 pass.
2026-11-18 19:54:48 -06:00
AlbertoPMDM 449acf8b44 contracts: shared data classes, protocols and contract test suites
Step 1 of the tea_modulo plan: Recording (MNE Raw from EDF), ValidationSummary,
Preprocessed, Labels, Study, the Validator/Preprocessor/Process/Biomarker
protocols with check_module(), reusable contract suites in contracts.testing,
and an AST test that enforces the module boundary rule.
2026-11-18 19:54:15 -06:00
AlbertoPMDM fbfad83861 Initialize uv library project 2026-11-18 14:21:36 -06:00