mne_bids.make_bids_folders

mne_bids.make_bids_folders(subject, session=None, kind=None, bids_root=None, make_dir=True, overwrite=False, verbose=False)[source]

Create a BIDS folder hierarchy.

This creates a hierarchy of folders within a BIDS dataset. You should plan to create these folders inside the bids_root folder of the dataset.

Parameters
subjectstr

The subject ID. Corresponds to “sub”.

kindstr

The kind of folder being created at the end of the hierarchy. E.g., “anat”, “func”, etc.

sessionstr | None

The session for a item. Corresponds to “ses”.

bids_rootstr | pathlib.Path | None

The bids_root for the folders to be created. If None, folders will be created in the current working directory.

make_dirbool

Whether to actually create the folders specified. If False, only a path will be generated but no folders will be created.

overwritebool

How to handle overwriting previously generated data. If overwrite == False then no existing folders will be removed, however if overwrite == True then any existing folders at the session level or lower will be removed, including any contained data.

verbosebool

If verbose is True, print status updates as folders are created.

Returns
pathstr

The (relative) path to the folder that was created.

Examples

>>> print(make_bids_folders('sub_01', session='my_session',
                            kind='meg', bids_root='path/to/project',
                            make_dir=False))  # noqa
path/to/project/sub-sub_01/ses-my_session/meg