mne_bids.find_inherited_sidecars#

mne_bids.find_inherited_sidecars(fname, candidates, *, root=None, extension='.json')[source]#

Choose the sidecar files that apply to a recording from a list of files.

Under the BIDS inheritance principle, a sidecar file applies to a recording if it has the same suffix, every entity in its name is in the recording’s name with the same value, and it is stored in the recording’s directory or in one above it, up to the dataset root.

Parameters:
fnamestr

The path of the recording.

candidatesiterable of str

The files to choose from, for example the files of a dataset listing.

rootstr | None

The root of the dataset, spelled as at the start of fname and of candidates. If None, the directory above the sub-* directory of fname is used.

extensionstr

The extension of the sidecar files.

Returns:
sidecarslist of str

The candidates that apply, ordered from the dataset root down, so that merging JSON sidecars in this order lets lower files override higher ones.

Notes

Added in version 0.21.