eegproc.data.windowing module
Create model arrays without allowing windows to cross trial boundaries.
- class eegproc.data.windowing.WindowedArrays(features, labels, subject_ids, trial_ids, subject_lookup, trial_lookup)[source]
Bases:
objectAligned windows, labels, integer identifiers, and original key lookups.
- Parameters:
features (
ndarray)labels (
ndarray)subject_ids (
ndarray)trial_ids (
ndarray)subject_lookup (
dict[int,tuple])trial_lookup (
dict[int,tuple])
- features: ndarray
- labels: ndarray
- subject_ids: ndarray
- subject_lookup: dict[int, tuple]
- trial_ids: ndarray
- trial_lookup: dict[int, tuple]
- eegproc.data.windowing.to_supervised_arrays(frame, *, label_column=None, window_sec=None, window_samples=None, window_rows=1, overlap=0.0, normalize=None, label_transform=None, on_short_trial='error')[source]
Window each trial separately and return channels-last float32 arrays.
kind='features'treats each row as a precomputed feature window. For signals, specify eitherwindow_secorwindow_samples. Incomplete trailing windows are dropped. Trial identifiers are globally unique across subjects, including when subjects reuse the same trial names.Optional
subject_zscoreuses all unlabeled rows from each subject. This includes held-out subjects’ own signals; usenormalize=Noneand fold-specific preprocessing when the evaluation requires training-only normalization statistics.- Parameters:
frame (
EEGFrame)label_column (
str|None, default:None)window_sec (
float|None, default:None)window_samples (
int|None, default:None)window_rows (
int, default:1)overlap (
float, default:0.0)normalize (
str|None, default:None)label_transform (
Optional[Callable], default:None)on_short_trial (
str, default:'error')
- Return type: