Functions for extracting relevant BOLD and stimulus data and metadata of a BIDS dataset and for running voxel-wise encoding models.

run_model_for_subject[source]

run_model_for_subject(subject_label, bids_dir, mask=None, bold_prep_kwargs=None, preprocess_kwargs=None, estimator=None, encoding_kwargs=None, **kwargs)

Runs voxel-wise encoding model for a single subject and returns Ridges and scores

Parameters

subject_label : the BIDS subject label
bids_dir : the path to the BIDS directory
mask : path to mask file or 'epi' if an epi mask should be computed from the first BOLD run
bold_prep_kwargs : None or dict containing the parameters for preprocessing the BOLD files
                   everything that is accepted by nilearn's clean function is an acceptable parameter
preprocess_kwargs : None or dict containing the parameters for lagging and aligning fMRI and stimulus
                    acceptable parameters are ones used by preprocessing.make_X_Y
estimator : None or sklearn-like estimator to use as an encoding model
            default uses RidgeCV with individual alpha per target when possible
encoding_kwargs : None or dict containing the parameters for evaluating the encoding model
                  Valid parameters are the ones accepted by encoding.get_model_plus_scores

kwargs : additional BIDS specific arguments such as task, ses, desc, and recording

Returns list of Ridge regressions, scores per voxel per fold

process_bids_subject[source]

process_bids_subject(subject_label, bids_dir, ses=None, task=None, desc=None, recording=None, **kwargs)

Localizes BOLD files and stimulus files for subject_label in BIDS folder structure

Parameters

subject_label : the BIDS subject label
bids_dir : the path to the BIDS directory
ses : session indicator, optional
task : task indicator, optional
desc : description indicatr, optional
recording : recording indicator, optional
kwargs : additional arguments

Returns tuple of (list of bold files, path to task meta data, list of stimulus tsv files, list of stimulus json files)

get_func_bold_directory[source]

get_func_bold_directory(subject_label, bids_dir, **kwargs)

Returns a path to the directory in which the bold files of the given subject reside

Parameters

subject_label : the BIDS subject label
bids_dir : the path to the BIDS directory
ses : session indicator, optional
kwargs : additional arguments

Returns bold_folder_name