mne_bids.make_bids_basename

mne_bids.make_bids_basename(subject=None, session=None, task=None, acquisition=None, run=None, processing=None, recording=None, space=None, prefix=None, suffix=None)[source]

Create a partial/full BIDS filename from its component parts.

BIDS filename prefixes have one or more pieces of metadata in them. They must follow a particular order, which is followed by this function. This will generate the prefix for a BIDS filename that can be used with many subsequent files, or you may also give a suffix that will then complete the file name.

Note that all parameters are not applicable to each kind of data. For example, electrode location TSV files do not need a task field.

Parameters
subjectstr | None

The subject ID. Corresponds to “sub”.

sessionstr | None

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

taskstr | None

The task for a item. Corresponds to “task”.

acquisition: str | None

The acquisition parameters for the item. Corresponds to “acq”.

runint | None

The run number for this item. Corresponds to “run”.

processingstr | None

The processing label for this item. Corresponds to “proc”.

recordingstr | None

The recording name for this item. Corresponds to “recording”.

spacestr | None

The coordinate space for an anatomical file. Corresponds to “space”.

prefixstr | None

The prefix for the filename to be created. E.g., a path to the folder in which you wish to create a file with this name.

suffixstr | None

The suffix of a file that begins with this prefix. E.g., ‘audio.wav’.

Returns
filenamestr

The BIDS filename you wish to create.

Examples

>>> print(make_bids_basename(subject='test', session='two', task='mytask', suffix='data.csv')) # noqa
sub-test_ses-two_task-mytask_data.csv