braindecode.preprocessing.preprocess#

braindecode.preprocessing.preprocess(concat_ds, preprocessors, save_dir=None, overwrite=False, n_jobs=None, offset=0, copy_data=None, parallel_kwargs=None, max_nbytes='1M')[source]#

Apply preprocessors to a concat dataset.

Parameters:
  • concat_ds (BaseConcatDataset) – A concat of RecordDataset to be preprocessed.

  • preprocessors (list of Preprocessor) – Preprocessor objects to apply to each dataset.

  • save_dir (str | None) – If provided, save preprocessed data under this directory and reload datasets in concat_ds with preload=False.

  • overwrite (bool) – When save_dir is provided, controls whether to delete the old subdirectories that will be written to under save_dir. If False and the corresponding subdirectories already exist, a FileExistsError is raised.

  • n_jobs (int | None) – Number of jobs for parallel execution. See joblib.Parallel for details.

  • offset (int) – Integer added to the dataset id in the concat. Useful when processing and saving very large datasets in chunks to preserve original positions.

  • copy_data (bool | None) – Whether the data passed to parallel jobs should be copied or passed by reference.

  • parallel_kwargs (dict | None) – Additional keyword arguments forwarded to joblib.Parallel. Defaults to None (equivalent to {}). See https://joblib.readthedocs.io/en/stable/generated/joblib.Parallel.html for details.

  • max_nbytes (int, str, or None) – Threshold (in bytes; or e.g. "1M") above which joblib memory-maps preloaded arrays as read-only when dispatching to worker processes. Effective only when n_jobs != 1. Pass None to disable memory mapping when a preprocessor resizes the underlying data (for example filterbank), which would otherwise fail with an mmap can't resize a readonly error. parallel_kwargs['max_nbytes'] takes precedence if both are provided.

Returns:

Preprocessed dataset.

Return type:

BaseConcatDataset

Examples using braindecode.preprocessing.preprocess#

Fingers flexion cropped decoding on BCIC IV 4 ECoG Dataset

Fingers flexion cropped decoding on BCIC IV 4 ECoG Dataset

Fingers flexion decoding on BCIC IV 4 ECoG Dataset

Fingers flexion decoding on BCIC IV 4 ECoG Dataset

Fixed-Length Windows Extraction

Fixed-Length Windows Extraction