This repository contains code used in the paper "Rapid cortical mapping with cross-participant encoding models" by Jerry Tang and Alexander G. Huth.
- Install dependencies
conda create -n rcm python=3.12.12
pip install numpy==1.26.4 scipy==1.16.3 pycortex==1.2.11 tables==3.10.2-
Download data into new
data/directory. -
Download features into new
feature/directory. The cross-participant modeling approach is agnostic to the specific feature space so custom features extracted from the story stimuli should be stored here as well. -
Download fMRI data into new
mri/directory. Instructions for downloading the fMRI data from Tang and Huth 2026 are provided in the demo. -
The
train_referencefunction trains a reference encoding model. Thekeyparameter determines where the model is saved. Thereferencesparameter determines the reference participants used to train the model. Thefeatureparameter determines the feature space used to train the model. Thestimuliparameter determines the stimuli used to train the model. Theem_alphaandcm_alphaparameters determine the L2 regularization constants used to estimate encoding models and cross-participant converters for the given feature space. The L2 regularization constants are optimized using the reference participant data if arguments are not provided. -
The
train_crossfunction transfers a reference encoding model to a new goal participant. Thekeyparameter determines which reference encoding model to use. Thegoalparameter determines the goal participant. Thestimuliparameter determines the stimuli used to perform functional alignment.