API Reference#
This reference is generated automatically from the physioex docstrings, so it
always mirrors the installed code (the physioex-dev API). For the high-level
picture of how these pieces fit together, see the
library architecture pages.
physioex.data#
The raw-EDF, lazy-loading dataset layer, the preprocessing pipeline, the on-disk cache, EDF/annotation readers and sleep-event helpers.
Abstract base class for lazy-loading EDF-based sleep datasets. |
|
Wraps multiple BasePhysioDataset instances into a single unified dataset. |
|
Metadata describing how to locate a single subject's raw data. |
|
Base class for all preprocessing operations. |
|
Result of compiling a PreprocessingStep against a specific input fs. |
|
Passthrough; does nothing. |
|
IIR Butterworth bandpass filter (zero-phase via sosfiltfilt). |
|
IIR notch filter (powerline removal). |
|
Resample to target sampling rate. |
|
Per-subject per-channel z-score normalization. |
|
STFT spectrogram with power-dB scaling, matching Huy Phan's SeqSleepNet / XSleepNet / SleepTransformer preprocessing. |
|
Instantiate a preset by name. |
|
Return sorted list of available preset names. |
|
Collate a list of dict-returning dataset items. |
|
Convert a collated dict batch to a (B, L, C, ...) tensor for model input. |
|
Return True if batch looks like a dict-style PhysioEx batch. |
|
Read the EDF structural header only (no signal data). |
|
Resolve user channel requests against the EDF's available channels. |
|
Map a flat list of events to per-epoch event lists. |
|
Convert a list of |
|
Reconstruct |
Datasets are resolved by name from the registry:
physioex.models#
Foundation encoders (a uniform (B, L, C, T) -> (B, L, D) wrapper around
heterogeneous pretrained backbones), embedding/pretrained helpers, and the
classic sleep-staging architectures.
Abstract adapter: frozen encoder that returns embeddings. |
|
CBraMod accepts any number of EEG channels, pools over them. |
|
BENDR maps input channels to a fixed 20-channel 10-20 layout. |
|
LaBraM with channel-aware position embeddings; lazy model build. |
|
BIOT with 16-channel double-banana layout + q95 normalization. |
|
SleepFM pads input to 10 channel slots and masks unused ones. |
|
TF-C: single-channel time + frequency transformer. |
|
REVE with position bank for channel-aware embeddings. |
|
Signal-JEPA with fixed 19-channel 10-20 layout. |
|
NeuroLM with patch-based tokenization and VQ channel vocabulary. |
|
Load a pretrained model from HuggingFace Hub. |
|
Extract and cache contextualized embeddings for all subjects. |
|
Load cached embeddings, downloading from HuggingFace if needed. |
|
5-fold subject-wise cross-validated linear probe on cached embeddings. |
Classic architectures:
Chambon et al. (2018) sleep staging network. |
|
SleepTransformer (Phan et al. 2022). |
physioex.train#
A hand-written PyTorch training/evaluation loop (not Lightning), with metric and statistics helpers, pluggable logging, and the three console-script entry points.
Seed all relevant RNGs for reproducibility. |
|
Backend-agnostic experiment logger. |
|
A logger that discards everything. |
|
Instantiate a logger backend. |
|
Load a model with dual-format checkpoint support. |
Metrics, statistics and progress helpers are documented at module level:
Per-subject metric aggregation (mean / std / confidence interval). |
|
physioex.explain#
Post-hoc attribution, the foundational Conceptual Spectral Decomposition (CSD), and prototype discovery.
Explainability methods for foundation model embeddings. |
|