meeg_utils.process#

meeg_utils.process(pipeline, sources, root, *, desc='preproc', n_jobs=1, on_error='raise', skip_existing=False, overwrite=False)[source]#

Process each recording with its own copy of a pipeline and save the results.

Every recording is processed independently (the pipeline is cloned and fitted per recording, see the multi-run policy in the design notes) and written with save_derivative(), so each output has a sidecar with the pipeline configuration, provenance and QC metrics.

Parameters:
  • pipeline (Pipeline) – The (unfitted) pipeline; it is not modified.

  • sources (sequence of str | Path | BIDSPath) – The recordings.

  • root (str | Path) – Root of the derivatives dataset.

  • desc (str) – Value of the BIDS desc entity of the outputs.

  • n_jobs (int) – Recordings processed in parallel (joblib); -1 uses all cores.

  • on_error ({"raise", "warn"}) – What to do once all recordings are processed and some failed: raise a RuntimeError listing them, or emit a warning. Failures never stop the other recordings.

  • skip_existing (bool) – Skip recordings whose output already exists.

  • overwrite (bool) – Replace existing outputs (otherwise an existing output is a failure).

Returns:

One record per recording: source, status ("ok", "skipped" or "failed"), output, error and duration_s.

Return type:

list of dict

Raises:

RuntimeError – If on_error="raise" and at least one recording failed.