I am learning how to use Nilearn for MRI analysis, and I am running into the following error when trying to run a first-level GLM using first_level_from_bids:
ValueError: 2 events.tsv files found for 0 bold files. Same number of event files as the number of runs is expected
I have been following the User Guide: First level analysis of a complete BIDS dataset from openneuro - Nilearn
Here is my command:
from nilearn.glm.first_level import first_level_from_bids data_dir = '/Volumes/Pegasus/nilearn/rawdata' task_label = 'card' space_label = 'MNI152NLin2009cAsym' derivatives_folder = '/Volumes/Pegasus/nilearn/derivatives/fmriprep' models, models_run_imgs, models_events, models_confounds = \ first_level_from_bids(data_dir, task_label, space_label, smoothing_fwhm=6, img_filters=[('desc','preproc'),('dir','AP'),('dir','PA')], derivatives_folder=derivatives_folder)
The data I am trying to analyze consists of two runs of task data, one run in AP and one run in PA. The full paths to my fmriprep preprocessed data files are:
If anybody has any insight into what might be causing this error, I’d greatly appreciate it.