rename: tea-modulo / tea_modulo -> tea (distribution, package, entry-point groups, MLflow names, image paths)

This commit is contained in:
AlbertoPMDM
2026-11-19 08:26:43 -06:00
parent fe36d5d859
commit e8e5b96755
320 changed files with 360 additions and 360 deletions
+9 -9
View File
@@ -1,14 +1,14 @@
# tea_modulo
# tea
EEG library for the TEA project: EDF in; validation, preprocessing, processes
and biomarkers out. Every biomarker and every process is its own module, and
modules talk only through `tea_modulo.contracts`, so any module can be replaced
modules talk only through `tea.contracts`, so any module can be replaced
without touching the others. Architecture plan:
https://claude.ai/artifact/H9Rh19Lv79dVeikeVD9KFZ
## Two implementations
| | `tea_modulo` (modern) | `tea_modulo.legacy` |
| | `tea` (modern) | `tea.legacy` |
|---|---|---|
| Code | the director's methods on MNE, SciPy, scikit-learn, antropy, fooof, meegkit | the director's code (biomarcadores-tea @ 7dfc641, codigo @ c7a4736) copied unchanged except imports |
| Batches | Dask (`cluster="auto"/"remote"/"local"/"sync"`) | plain single-threaded loop |
@@ -37,11 +37,11 @@ https://claude.ai/artifact/H9Rh19Lv79dVeikeVD9KFZ
## Use
```python
from tea_modulo.validation import validate
from tea.validation import validate
bundle, valid = validate("study.edf") # R4B FHIR Bundle, 1 valid / 0 not valid
from tea_modulo.pipeline import Pipeline
from tea_modulo.preprocessing import DIRECTOR_CLUSTER
from tea.pipeline import Pipeline
from tea.preprocessing import DIRECTOR_CLUSTER
pipe = Pipeline.default() # or Pipeline.default(impl="legacy")
study = pipe.study("study.edf", plan=DIRECTOR_CLUSTER, age_months=27.5)
pipe.biomarker("posterior_rhythm").measure(study)
@@ -51,12 +51,12 @@ table = pipe.map(paths, plan=DIRECTOR_CLUSTER, ages_months=ages,
rhythm = pipe.biomarker("posterior_rhythm").train(table) # baseline: curves or age_blocks
rhythm.predict(table.iloc[[0]]) # outside -1/0/+1, z
from tea_modulo.serving import log_plan, log_biomarker # MLflow models, privacy guard
from tea.serving import log_plan, log_biomarker # MLflow models, privacy guard
```
Replace a module: `pipe.replace("spindle_detection", MyDetector())`, or register
it under the same name in the `tea_modulo.modules` entry-point group. Check it
with `tea_modulo.contracts.testing`.
it under the same name in the `tea.modules` entry-point group. Check it
with `tea.contracts.testing`.
## Tests and cluster verification
+7 -7
View File
@@ -1,19 +1,19 @@
# tea-verify: the team's dask image plus what the tea_modulo verification needs.
# tea-verify: the team's dask image plus what the tea verification needs.
# Built from the local checkout (submodules included) by deploy/verify.sh.
FROM 192.168.20.18:5000/dask:1.1
# missing from dask:1.1; versions as checked locally
RUN pip install --no-cache-dir "antropy==0.2.3" "fhir.resources==8.3.0" "meegkit==0.2.0" pytest
# tea-modulo from the local checkout (biomarcadores-tea @ 7dfc641, codigo @ c7a4736:
# tea from the local checkout (biomarcadores-tea @ 7dfc641, codigo @ c7a4736:
# the legacy = submodule tests need them). .dockerignore keeps .venv, eeg/ and any
# signal or patient file out of the build context.
COPY . /opt/tea-modulo
COPY . /opt/tea
ARG TEA_COMMIT=unknown
ENV TEA_COMMIT=$TEA_COMMIT
LABEL tea_modulo.commit=$TEA_COMMIT
RUN pip install --no-cache-dir --no-deps -e /opt/tea-modulo
WORKDIR /opt/tea-modulo
LABEL tea.commit=$TEA_COMMIT
RUN pip install --no-cache-dir --no-deps -e /opt/tea
WORKDIR /opt/tea
# verification/ (cluster checks) is not in the package: import it from the checkout,
# on the runner and on the workers
ENV PYTHONPATH=/opt/tea-modulo
ENV PYTHONPATH=/opt/tea
+2 -2
View File
@@ -1,4 +1,4 @@
# tea-verify: a cluster check of tea_modulo in its own Dask cluster, 9 pods.
# tea-verify: a cluster check of tea in its own Dask cluster, 9 pods.
# hk1k: test suite + HK1K check; 4 workers per pod x 4.25 GiB
# issste: ISSSTELEÓN check on processed/eeg-edf-2025|2026 (group summaries
# only); 3 workers per pod x 6 GiB (long recordings)
@@ -15,7 +15,7 @@ spec:
containers:
- name: job
image: 192.168.20.18:5000/tea-verify:COMMIT
workingDir: /opt/tea-modulo
workingDir: /opt/tea
command: [sh, -c]
args:
- |
+38 -38
View File
@@ -1,5 +1,5 @@
[project]
name = "tea-modulo"
name = "tea"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
@@ -28,47 +28,47 @@ dependencies = [
export = ["edfio>=0.4.18"]
s3 = ["s3fs"]
[project.entry-points."tea_modulo.legacy_modules"]
validation = "tea_modulo.legacy.validation:MODULE"
preprocessing = "tea_modulo.legacy.preprocessing:MODULE"
annotation_mask = "tea_modulo.legacy.processes.annotation_mask:MODULE"
sleep_state = "tea_modulo.legacy.processes.sleep_state:MODULE"
posterior_rhythm = "tea_modulo.legacy.biomarkers.posterior_rhythm:MODULE"
spindle_detection = "tea_modulo.legacy.processes.spindle_detection:MODULE"
spindles = "tea_modulo.legacy.biomarkers.spindles:MODULE"
gradient = "tea_modulo.legacy.biomarkers.gradient:MODULE"
slow_wave_staging = "tea_modulo.legacy.processes.slow_wave_staging:MODULE"
slow_waves = "tea_modulo.legacy.biomarkers.slow_waves:MODULE"
aperiodic = "tea_modulo.legacy.biomarkers.aperiodic:MODULE"
mse = "tea_modulo.legacy.biomarkers.mse:MODULE"
coupling = "tea_modulo.legacy.biomarkers.coupling:MODULE"
spindle_topography = "tea_modulo.legacy.biomarkers.spindle_topography:MODULE"
spikes = "tea_modulo.legacy.biomarkers.spikes:MODULE"
window_selection = "tea_modulo.legacy.processes.window_selection:MODULE"
[project.entry-points."tea.legacy_modules"]
validation = "tea.legacy.validation:MODULE"
preprocessing = "tea.legacy.preprocessing:MODULE"
annotation_mask = "tea.legacy.processes.annotation_mask:MODULE"
sleep_state = "tea.legacy.processes.sleep_state:MODULE"
posterior_rhythm = "tea.legacy.biomarkers.posterior_rhythm:MODULE"
spindle_detection = "tea.legacy.processes.spindle_detection:MODULE"
spindles = "tea.legacy.biomarkers.spindles:MODULE"
gradient = "tea.legacy.biomarkers.gradient:MODULE"
slow_wave_staging = "tea.legacy.processes.slow_wave_staging:MODULE"
slow_waves = "tea.legacy.biomarkers.slow_waves:MODULE"
aperiodic = "tea.legacy.biomarkers.aperiodic:MODULE"
mse = "tea.legacy.biomarkers.mse:MODULE"
coupling = "tea.legacy.biomarkers.coupling:MODULE"
spindle_topography = "tea.legacy.biomarkers.spindle_topography:MODULE"
spikes = "tea.legacy.biomarkers.spikes:MODULE"
window_selection = "tea.legacy.processes.window_selection:MODULE"
[project.entry-points."tea_modulo.modules"]
validation = "tea_modulo.validation:MODULE"
preprocessing = "tea_modulo.preprocessing:MODULE"
annotation_mask = "tea_modulo.processes.annotation_mask:MODULE"
sleep_state = "tea_modulo.processes.sleep_state:MODULE"
posterior_rhythm = "tea_modulo.biomarkers.posterior_rhythm:MODULE"
spindle_detection = "tea_modulo.processes.spindle_detection:MODULE"
spindles = "tea_modulo.biomarkers.spindles:MODULE"
gradient = "tea_modulo.biomarkers.gradient:MODULE"
slow_wave_staging = "tea_modulo.processes.slow_wave_staging:MODULE"
slow_waves = "tea_modulo.biomarkers.slow_waves:MODULE"
aperiodic = "tea_modulo.biomarkers.aperiodic:MODULE"
mse = "tea_modulo.biomarkers.mse:MODULE"
coupling = "tea_modulo.biomarkers.coupling:MODULE"
spindle_topography = "tea_modulo.biomarkers.spindle_topography:MODULE"
spikes = "tea_modulo.biomarkers.spikes:MODULE"
window_selection = "tea_modulo.processes.window_selection:MODULE"
[project.entry-points."tea.modules"]
validation = "tea.validation:MODULE"
preprocessing = "tea.preprocessing:MODULE"
annotation_mask = "tea.processes.annotation_mask:MODULE"
sleep_state = "tea.processes.sleep_state:MODULE"
posterior_rhythm = "tea.biomarkers.posterior_rhythm:MODULE"
spindle_detection = "tea.processes.spindle_detection:MODULE"
spindles = "tea.biomarkers.spindles:MODULE"
gradient = "tea.biomarkers.gradient:MODULE"
slow_wave_staging = "tea.processes.slow_wave_staging:MODULE"
slow_waves = "tea.biomarkers.slow_waves:MODULE"
aperiodic = "tea.biomarkers.aperiodic:MODULE"
mse = "tea.biomarkers.mse:MODULE"
coupling = "tea.biomarkers.coupling:MODULE"
spindle_topography = "tea.biomarkers.spindle_topography:MODULE"
spikes = "tea.biomarkers.spikes:MODULE"
window_selection = "tea.processes.window_selection:MODULE"
[project.entry-points."tea_modulo.executors"]
legacy = "tea_modulo.legacy.executor:run_serial"
[project.entry-points."tea.executors"]
legacy = "tea.legacy.executor:run_serial"
[project.scripts]
ktlx2edf = "tea_modulo.export.cli:main"
ktlx2edf = "tea.export.cli:main"
[build-system]
requires = ["uv_build>=0.13.1,<0.14.0"]
@@ -1,9 +1,9 @@
"""
tea_modulo: modular EEG library (EDF in, validation, preprocessing,
tea: modular EEG library (EDF in, validation, preprocessing,
processes and biomarkers out).
Every biomarker and every process is its own module. Modules talk only
through `tea_modulo.contracts`; see the architecture plan.
through `tea.contracts`; see the architecture plan.
"""
__version__ = "0.1.0"
+3
View File
@@ -0,0 +1,3 @@
from tea.biomarkers.aperiodic.api import MODULE, Aperiodic
__all__ = ["MODULE", "Aperiodic"]
@@ -23,7 +23,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _baseline, _windows2s
+3
View File
@@ -0,0 +1,3 @@
from tea.biomarkers.coupling.api import MODULE, Coupling
__all__ = ["MODULE", "Coupling"]
@@ -15,7 +15,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _baseline, _signal
+3
View File
@@ -0,0 +1,3 @@
from tea.biomarkers.gradient.api import MODULE, Gradient
__all__ = ["MODULE", "Gradient"]
@@ -18,7 +18,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _baseline
+3
View File
@@ -0,0 +1,3 @@
from tea.biomarkers.mse.api import MODULE, MSE
__all__ = ["MODULE", "MSE"]
@@ -20,7 +20,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _baseline, _windows2s
@@ -0,0 +1,3 @@
from tea.biomarkers.posterior_rhythm.api import MODULE, PosteriorRhythm
__all__ = ["MODULE", "PosteriorRhythm"]
@@ -17,7 +17,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _baseline
@@ -0,0 +1,3 @@
from tea.biomarkers.slow_waves.api import MODULE, SlowWaves
__all__ = ["MODULE", "SlowWaves"]
@@ -12,7 +12,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _baseline
+3
View File
@@ -0,0 +1,3 @@
from tea.biomarkers.spikes.api import MODULE, Spikes
__all__ = ["MODULE", "Spikes"]
@@ -13,7 +13,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _baseline, _detector
FEATURES = {"spike_rate_awake": "tasa_despierto", "spike_rate_nrem": "tasa_NREM",
@@ -0,0 +1,3 @@
from tea.biomarkers.spindle_topography.api import MODULE, SpindleTopography
__all__ = ["MODULE", "SpindleTopography"]
@@ -15,7 +15,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _baseline, _signal
+3
View File
@@ -0,0 +1,3 @@
from tea.biomarkers.spindles.api import MODULE, Spindles
__all__ = ["MODULE", "Spindles"]
@@ -13,7 +13,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _baseline
@@ -1,11 +1,11 @@
"""
The shared API of `tea_modulo`: the only code every module may import.
The shared API of `tea`: the only code every module may import.
from tea_modulo.contracts import Recording, Preprocessed, Study, Labels
from tea_modulo.contracts import check_module, CONTRACT_VERSION
from tea.contracts import Recording, Preprocessed, Study, Labels
from tea.contracts import check_module, CONTRACT_VERSION
"""
from tea_modulo.contracts.data import (
from tea.contracts.data import (
CONTRACT_VERSION,
DEVIATION_COLUMNS,
SPAN_COLUMNS,
@@ -18,7 +18,7 @@ from tea_modulo.contracts.data import (
empty_spans,
sha256_of,
)
from tea_modulo.contracts.protocols import (
from tea.contracts.protocols import (
KINDS,
Biomarker,
ContractError,
@@ -1,7 +1,7 @@
"""
Data that crosses module boundaries.
Every module in `tea_modulo` talks to the others only through these frozen
Every module in `tea` talks to the others only through these frozen
dataclasses and the protocols in `contracts.protocols`. A module may be
replaced completely by any code that consumes and produces these objects.
@@ -13,7 +13,7 @@ from typing import Any, Protocol, runtime_checkable
import pandas as pd
from tea_modulo.contracts.data import (
from tea.contracts.data import (
CONTRACT_VERSION,
Labels,
Preprocessed,
@@ -2,7 +2,7 @@
Contract test suites: run them against any implementation of a module,
including a replacement written outside this package.
from tea_modulo.contracts.testing import check_process, check_biomarker
from tea.contracts.testing import check_process, check_biomarker
check_process(MyDetector(), study)
check_biomarker(MyBiomarker(), studies, ages_months)
@@ -19,14 +19,14 @@ from pathlib import Path
import pandas as pd
from tea_modulo.contracts.data import (
from tea.contracts.data import (
DEVIATION_COLUMNS,
Labels,
Preprocessed,
Study,
ValidationSummary,
)
from tea_modulo.contracts.protocols import check_module
from tea.contracts.protocols import check_module
def check_process(module, study: Study):
@@ -2,13 +2,13 @@
Optional KTLX (Natus/Xltek) -> EDF+ exporter, vendored from the `eeg` library
(Gitea alberto/eeg @ 92bc2a0, src/eeg/utils). Only the imports were changed.
Outside the pipeline: everything else in tea_modulo takes EDF. Install with
Outside the pipeline: everything else in tea takes EDF. Install with
the `export` extra (needs edfio).
from tea_modulo.export import ktlx_to_edf
from tea.export import ktlx_to_edf
ktlx_to_edf("natus/STUDY_FOLDER", "study.edf")
"""
from tea_modulo.export.edf_export import ktlx_to_edf
from tea.export.edf_export import ktlx_to_edf
__all__ = ["ktlx_to_edf"]
@@ -9,7 +9,7 @@ from __future__ import annotations
import argparse
import logging
from tea_modulo.export.edf_export import ktlx_to_edf
from tea.export.edf_export import ktlx_to_edf
LOG = logging.getLogger(__name__)
@@ -29,10 +29,10 @@ from pathlib import Path
import numpy as np
from edfio import Edf, EdfAnnotation
from tea_modulo.export import ktlx, patient
from tea_modulo.export.edf_annotations import event_annotations, gap_annotations, runs
from tea_modulo.export.edf_header import patient_header, recording_header
from tea_modulo.export.edf_signals import build_signals
from tea.export import ktlx, patient
from tea.export.edf_annotations import event_annotations, gap_annotations, runs
from tea.export.edf_header import patient_header, recording_header
from tea.export.edf_signals import build_signals
LOG = logging.getLogger(__name__)
@@ -13,7 +13,7 @@ from datetime import date
from edfio import Patient, Recording
from tea_modulo.export.text import to_ascii
from tea.export.text import to_ascii
LOG = logging.getLogger(__name__)
@@ -20,7 +20,7 @@ import numpy as np
from edfio import EdfSignal
from edfio.edf_signal import _round_float_to_8_characters
from tea_modulo.export.text import to_ascii
from tea.export.text import to_ascii
LOG = logging.getLogger(__name__)
@@ -24,7 +24,7 @@ from pathlib import Path
import numpy as np
from tea_modulo.export import text as _txt
from tea.export import text as _txt
LOG = logging.getLogger(__name__)
@@ -21,7 +21,7 @@ from collections.abc import Sequence
from datetime import date, datetime, timedelta
from pathlib import Path
from tea_modulo.export import text as _txt
from tea.export import text as _txt
LOG = logging.getLogger(__name__)
@@ -0,0 +1,3 @@
from tea.legacy.biomarkers.aperiodic.api import MODULE, LegacyAperiodic
__all__ = ["MODULE", "LegacyAperiodic"]
@@ -17,7 +17,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _baseline, _windows2s
from ._bio import aperiodico, espectro
@@ -0,0 +1,3 @@
from tea.legacy.biomarkers.coupling.api import MODULE, LegacyCoupling
__all__ = ["MODULE", "LegacyCoupling"]
@@ -17,7 +17,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _adapter, _baseline
@@ -0,0 +1,3 @@
from tea.legacy.biomarkers.gradient.api import MODULE, LegacyGradient
__all__ = ["MODULE", "LegacyGradient"]
@@ -16,7 +16,7 @@ from pathlib import Path
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _adapter, _baseline
@@ -0,0 +1,3 @@
from tea.legacy.biomarkers.mse.api import MODULE, LegacyMSE
__all__ = ["MODULE", "LegacyMSE"]
@@ -16,7 +16,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _baseline, _windows2s
from ._bio import complejidad
@@ -0,0 +1,3 @@
from tea.legacy.biomarkers.posterior_rhythm.api import MODULE, LegacyPosteriorRhythm
__all__ = ["MODULE", "LegacyPosteriorRhythm"]
@@ -19,7 +19,7 @@ from pathlib import Path
import numpy as np
import pandas as pd
from tea_modulo.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from tea.contracts import CONTRACT_VERSION, DEVIATION_COLUMNS
from . import _adapter, _baseline
@@ -0,0 +1,3 @@
from tea.legacy.biomarkers.slow_waves.api import MODULE, LegacySlowWaves
__all__ = ["MODULE", "LegacySlowWaves"]

Some files were not shown because too many files have changed in this diff Show More