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 identifier. Corresponds to “ses”. Must be a date in format “YYYYMMDD” if subject is “emptyroom”.

taskstr | None

The task identifier. Corresponds to “task”. Must be “noise” if subject is “emptyroom”.

acquisition: str | None

The acquisition parameters. Corresponds to “acq”.

runint | None

The run number. Corresponds to “run”.

processingstr | None

The processing label. Corresponds to “proc”.

recordingstr | None

The recording name. 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 for the filename to be created. 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: E501
sub-test_ses-two_task-mytask_data.csv