meeg_utils.process_dataset#
- meeg_utils.process_dataset(dataset, root, *, preprocessing, epochs=None, combine=True, align='average', desc='preproc', epochs_desc='epochs', n_jobs=1, skip_existing=True, on_error='warn')[source]#
Process a whole dataset: each run, then the epochs of each session.
Preprocessing: every recording is processed with its own copy of
preprocessing(meeg_utils.process()) and saved withdesc.Epochs (if
epochsis given), per group of runs (Dataset.groups()): for MEG withalign="average", the runs are first mapped to their average head position (meeg_utils.io.average_dev_head_t(); aHeadAlignstep inepochsgets it as destination, otherwise one is inserted before epoching). Each run is epoched with its own copy ofepochsand saved withepochs_desc.Combine (if
combine): the runs of each group are concatenated (meeg_utils.epochs.combine()) and saved without the run entity.
Work already done is skipped (
skip_existing), so an interrupted batch resumes where it stopped. Failures do not stop other recordings; they are collected in the result.- Parameters:
dataset (Dataset) – The recordings.
root (str | Path) – Root of the derivatives dataset.
preprocessing (Pipeline) – Per-run preprocessing (unfitted; not modified).
epochs (Pipeline | None) – Per-run epoching, applied to the preprocessed runs (Raw -> Epochs).
combine (bool) – Concatenate the epochs of each group’s runs.
align ({"average"} | None) – MEG head alignment of each group’s runs before epoching;
Noneleaves them (combinethen requires their head positions to differ by less than 2 mm).desc (str) – BIDS
descof the preprocessed runs and of the epochs.epochs_desc (str) – BIDS
descof the preprocessed runs and of the epochs.n_jobs (int) – Recordings (stage 1) or groups (stages 2-3) processed in parallel.
skip_existing (bool) – Skip outputs that already exist (default
True: resume).on_error ({"warn", "raise"}) – After all recordings are processed, warn about failures or raise a
RuntimeErrorlisting them.
- Returns:
The records of every run and group;
result.to_csv(...)saves them.- Return type: