<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size: 12pt; color: rgb(0, 0, 0); font-family: Calibri, Helvetica, sans-serif, "EmojiFont", "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p style="margin-top:0; margin-bottom:0">Dear users</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">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</p>
<p style="margin-top:0; margin-bottom:0"></p>
<div><br>
</div>
<div><span style="font-family:Consolas,Courier,monospace">0    Y    porch    12.030224
</span><br>
<span style="font-family:Consolas,Courier,monospace">0    Y    victory    15.530834</span><br>
<span style="font-family:Consolas,Courier,monospace">0    P    kingdom    19.031396</span><br>
<span style="font-family:Consolas,Courier,monospace">0    Y    evening    22.531978</span></div>
<div><br>
</div>
<div>I've tried to map this info to the fMRI dataset in the following way:</div>
<div><br>
</div>
<div><span style="font-family:Consolas,Courier,monospace">bold_fname = 'path_to_fMRI_dataset'</span><br>
</div>
<div>
<div><span style="font-family:Consolas,Courier,monospace">exp_data = pd.read_csv("path_to_txt", delimiter='\t', header = None)</span></div>
<div><span style="font-family:Consolas,Courier,monospace"></span><span style="font-family:Consolas,Courier,monospace">exp_data.columns = ['run','condition</span><span style="font-family:Consolas,Courier,monospace">','word','onset']</span><br>
<br>
<span style="font-family:Consolas,Courier,monospace">ds = fmri_dataset(bold_fname, targets = None)</span><br>
<span style="font-family:Consolas,Courier,monospace">ds.sa.time_coords = exp_data.onset</span></div>
<div><span style="font-family:Consolas,Courier,monospace">ds.sa.targets = exp_data.condition<br>
</span></div>
<br>
</div>
<p style="margin-top:0; margin-bottom:0">The problem with this is that there are more fMRI volumes than rows in the conditions.txt fie, hence I get the following error:</p>
<p style="margin-top:0; margin-bottom:0"></p>
<pre><span style="font-family:Consolas,Courier,monospace">Name: onset, dtype: float64` (Value length [45] does not match the required length [113] of attribute 'time_coords'.)</span></pre>
Can anyone suggest a workaround? Thanks in advance for any advice!<br>
<p></p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p><span style="color:rgb(0,0,0); font-family:arial,sans-serif; font-size:12.8px">---------------------------------------------------------</span></p>
<span style="color:rgb(0,0,0)"></span>
<p><span style="color:rgb(0,0,0); font-family:arial,sans-serif; font-size:12.8px"><b>Lyam Bailey, B.Sc., M.Sc. </b></span></p>
<p><span style="color:rgb(0,0,0); font-family:arial,sans-serif; font-size:12.8px"></span><span style="font-family:arial,sans-serif; font-size:12.8px">Doctoral Student</span></p>
<span style="color:rgb(0,0,0)"></span>
<div style="color:rgb(136,136,136); font-family:arial,sans-serif; font-size:12.8px">
<span style="color:rgb(0,0,0)">Department of Psychology & Neuroscience</span></div>
<span style="color:rgb(0,0,0)"></span>
<div style="color:rgb(136,136,136); font-family:arial,sans-serif; font-size:12.8px">
<span style="color:rgb(0,0,0)">Dalhousie University</span></div>
<br>
<p></p>
</div>
</div>
</div>
</body>
</html>