[pymvpa] Mapping event structure from text file to fMRI dataset

Lyam Bailey Lyam.Bailey at Dal.Ca
Thu Aug 15 18:34:20 BST 2019


Dear users


I have an fMRI dataset comprising 113 volumes (from a single run). I would like to map information about events during the fMRI run - experimental condition and onset time - to the dataset. The events structure is stored in a .txt file with four columns: run#, experimental condition, unique stimulus, and onset time. It looks something like this

0    Y    porch    12.030224
0    Y    victory    15.530834
0    P    kingdom    19.031396
0    Y    evening    22.531978

I've tried to map this info to the fMRI dataset in the following way:

bold_fname = 'path_to_fMRI_dataset'
exp_data = pd.read_csv("path_to_txt", delimiter='\t', header = None)
exp_data.columns = ['run','condition','word','onset']

ds = fmri_dataset(bold_fname, targets = None)
ds.sa.time_coords = exp_data.onset
ds.sa.targets = exp_data.condition


The problem with this is that there are more fMRI volumes than rows in the conditions.txt fie, hence I get the following error:

Name: onset, dtype: float64` (Value length [45] does not match the required length [113] of attribute 'time_coords'.)

Can anyone suggest a workaround? Thanks in advance for any advice!


---------------------------------------------------------

Lyam Bailey, B.Sc., M.Sc.

Doctoral Student

Department of Psychology & Neuroscience
Dalhousie University

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-exppsy-pymvpa/attachments/20190815/0718a659/attachment.html>


More information about the Pkg-ExpPsy-PyMVPA mailing list