<div dir="ltr">Quick update. Yaroslav and I were discussing this offline. It turned out that it was necessary to adjust the time_coords of all events in all sessions (chunks) after the first session. Basically, the time_coords have to be relative to the beginning of the first session, rather than relative to the beginning of the current session.<div><br></div><div>Thanks,</div><div><br></div><div>Wolfgang</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 9, 2016 at 6:27 PM, Yaroslav Halchenko <span dir="ltr"><<a href="mailto:debian@onerussian.com" target="_blank">debian@onerussian.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">sorry Wolfgang, I have no mental capacity left to parse those outputs...<br>
it kinda looks ok, but you better just h5save sample dataset<br>
(ds[:,0] should be enough) and those events and then accompany with the<br>
code operating on those which would demonstrate the problem.  you can<br>
send directly to my email (ml will not allow for large attachments)<br>
That would be the best way to reproduce and understand (tomorrow morning<br>
I guess)<br>
<span class=""><br>
<br>
On Mon, 09 May 2016, Wolfgang Pauli wrote:<br>
<br>
</span>>    Hi,A<br>
<span class="">>    Thank you for the quick response. I did infact have<br>
>    condition_attr=['targets', 'chunks'], sorry about the typo. Have been<br>
>    trying to debug this for too long ...<br>
>    Regarding the even definitions. Please see below the event definitions<br>
</span>>    according to.A<br>
<span class="">>    onsets = []<br>
>    targets = []<br>
>    chunks = []<br>
>    for ev in events:<br>
</span>>    A  A  onsets.append(ev['onset'])<br>
>    A  A  targets.append(ev['targets'])<br>
>    A  A  chunks.append(ev['chunks'])<br>
<span class="">>    >>> targets<br>
>    ['csA', 'csX_j_1', 'csB', 'csY_n_1', 'csA', 'csX_j_1', 'csB', 'csY_n_1',<br>
>    'csA', 'csX_j_1', 'csB', 'csY_n_1', 'csA', 'csX_j_1', 'csB', 'csY_n_1',<br>
>    'csB', 'csA', 'csX_j_1', 'csB', 'csY_n_1', 'csA', 'csX_j_1', 'csB',\<br>
</span>>    A 'csY_n_1', 'csA', 'csX_j_1', 'csB', 'csY_n_1', 'csA', 'csX_j_1', 'csB',<br>
<span class="">>    'csY_n_1', 'csA', 'csX_j_1', 'csB', 'csB', 'csY_n_1', 'csA', 'csA',<br>
>    'csX_j_1', 'csB', 'csY_n_1', 'csB', 'csA', 'csX_j_1', 'csA', 'csX_j_1',\<br>
</span>>    A 'csB', 'csY_n_1', 'csA', 'csB', 'csY_n_1', 'csA', 'csC', 'csX_n_1',<br>
<span class="">>    'csD', 'csY_j_1', 'csD', 'csY_j_1', 'csC', 'csX_n_1', 'csD', 'csY_j_1',<br>
>    'csC', 'csX_n_1', 'csD', 'csY_j_1', 'csC', 'csX_n_1', 'csD', 'csY_j_1',\<br>
</span>>    A 'csC', 'csC', 'csX_n_1', 'csC', 'csX_n_1', 'csD', 'csY_j_1', 'csC',<br>
<div><div class="h5">>    'csX_n_1', 'csC', 'csC', 'csX_n_1', 'csD', 'csD', 'csY_j_1', 'csC',<br>
>    'csX_n_1', 'csD', 'csY_j_1', 'csC', 'csX_n_1', 'csD', 'csY_j_1', 'csD',<br>
>    'cs\<br>
>    D', 'csY_j_1', 'csC', 'csX_n_1', 'csD', 'csY_j_1', 'csC', 'csD',<br>
>    'csY_j_1', 'csD', 'csC', 'csX_n_1', 'csE', 'csX_j_2', 'csE', 'csX_j_2',<br>
>    'csE', 'csX_j_2', 'csF', 'csY_n_2', 'csE', 'csX_j_2', 'csF', 'csY_n_2',<br>
>    'cs\<br>
>    E', 'csX_j_2', 'csF', 'csY_n_2', 'csE', 'csX_j_2', 'csF', 'csY_n_2',<br>
>    'csF', 'csF', 'csY_n_2', 'csE', 'csX_j_2', 'csF', 'csY_n_2', 'csE', 'csF',<br>
>    'csY_n_2', 'csE', 'csX_j_2', 'csF', 'csY_n_2', 'csE', 'csX_j_2', 'cs\<br>
>    F', 'csY_n_2', 'csE', 'csX_j_2', 'csF', 'csY_n_2', 'csE', 'csX_j_2',<br>
>    'csF', 'csY_n_2', 'csE', 'csF', 'csY_n_2', 'csF', 'csE', 'csF', 'csE',<br>
>    'csX_j_2', 'csH', 'csY_j_2', 'csH', 'csY_j_2', 'csH', 'csY_j_2', 'csG', \<br>
>    'csX_n_2', 'csH', 'csY_j_2', 'csG', 'csX_n_2', 'csH', 'csY_j_2', 'csG',<br>
>    'csX_n_2', 'csH', 'csY_j_2', 'csG', 'csX_n_2', 'csH', 'csY_j_2', 'csH',<br>
>    'csH', 'csY_j_2', 'csG', 'csX_n_2', 'csH', 'csY_j_2', 'csG', 'csX_n_\<br>
>    2', 'csG', 'csG', 'csX_n_2', 'csH', 'csG', 'csX_n_2', 'csH', 'csY_j_2',<br>
>    'csG', 'csX_n_2', 'csG', 'csG', 'csX_n_2', 'csH', 'csY_j_2', 'csG',<br>
>    'csX_n_2', 'csH', 'csY_j_2', 'csH', 'csG', 'csX_n_2', 'csG']<br>
>    >>> onsets<br>
>    [4.2000001668930054, 7.2000002861022949, 20.400000810623169,<br>
>    25.200001001358032, 39.600001573562622, 45.600001811981201,<br>
>    61.800002455711365, 66.600002646446228, 80.40000319480896,<br>
>    84.000003337860107, 94.800003767\<br>
>    01355, 98.400003910064697, 114.000004529953, 117.00000464916229,<br>
>    127.20000505447388, 132.00000524520874, 144.0000057220459,<br>
>    162.00000643730164, 166.20000660419464, 178.80000710487366,<br>
>    184.20000731945038, 199.8000\<br>
>    0793933868, 203.40000808238983, 216.00000858306885, 219.60000872612,<br>
>    230.40000915527344, 235.80000936985016, 249.60000991821289,<br>
>    254.40001010894775, 270.00001072883606, 275.40001094341278,<br>
>    291.00001156330109, 295\<br>
>    .20001173019409, 306.00001215934753, 310.8000123500824,<br>
>    327.00001299381256, 346.20001375675201, 351.60001397132874,<br>
>    367.8000146150589, 386.40001535415649, 392.40001559257507,<br>
>    409.80001628398895, 415.2000164985656\<br>
>    7, 432.60001718997955, 451.80001795291901, 456.00001811981201,<br>
>    469.20001864433289, 473.40001881122589, 487.80001938343048,<br>
>    492.60001957416534, 507.00002014636993, 528.00002098083496,<br>
>    532.80002117156982, 548.40002\<br>
>    179145813, 606.60002410411835, 610.80002427101135, 624.00002479553223,<br>
>    628.80002498626709, 640.20002543926239, 644.4000256061554,<br>
>    658.20002615451813, 661.80002629756927, 673.80002677440643,<br>
>    676.80002689361572, 68\<br>
>    8.20002734661102, 693.00002753734589, 703.20002794265747,<br>
>    707.40002810955048, 720.00002861022949, 725.40002882480621,<br>
>    737.40002930164337, 740.40002942085266, 755.40003001689911,<br>
>    777.00003087520599, 781.2000310420\<br>
>    99, 793.20003151893616, 798.60003173351288, 811.20003223419189,<br>
>    815.4000324010849, 828.60003292560577, 834.0000331401825,<br>
>    846.00003361701965, 862.80003428459167, 867.00003445148468,<br>
>    878.40003490447998, 897.000035\<br>
>    64357758, 901.20003581047058, 917.40003645420074, 922.20003664493561,<br>
>    939.60003733634949, 943.80003750324249, 955.20003795623779,<br>
>    958.80003809928894, 972.60003864765167, 976.20003879070282,<br>
>    989.40003931522369, 10\<br>
>    08.0000400543213, 1012.2000402212143, 1025.4000407457352,<br>
>    1030.8000409603119, 1043.4000414609909, 1047.0000416040421,<br>
>    1062.0000422000885, 1083.0000430345535, 1087.8000432252884,<br>
>    1100.4000437259674, 1119.000044465\<br>
>    065, 1122.0000445842743, 1206.6000479459763, 1210.8000481128693,<br>
>    1225.8000487089157, 1230.6000488996506, 1243.2000494003296,<br>
>    1247.4000495672226, 1260.0000500679016, 1266.0000503063202,<br>
>    1279.8000508546829, 1284.00\<br>
>    00510215759, 1299.0000516176224, 1304.4000518321991, 1318.2000523805618,<br>
>    1323.6000525951385, 1335.6000530719757, 1339.2000532150269,<br>
>    1354.2000538110733, 1358.4000539779663, 1369.2000544071198,<br>
>    1374.0000545978546,\<br>
</div></div>>    A 1390.2000552415848, 1407.6000559329987, 1412.4000561237335,<br>
<div><div class="h5">>    1428.0000567436218, 1434.0000569820404, 1448.400057554245,<br>
>    1453.8000577688217, 1470.0000584125519, 1485.0000590085983,<br>
>    1488.0000591278076, 1504.8000597\<br>
>    953796, 1510.8000600337982, 1523.4000605344772, 1527.6000607013702,<br>
>    1543.2000613212585, 1547.4000614881516, 1559.4000619649887,<br>
>    1564.8000621795654, 1579.20006275177, 1584.6000629663467,<br>
>    1600.200063586235, 1603.20\<br>
>    00637054443, 1615.2000641822815, 1618.2000643014908, 1630.8000648021698,<br>
>    1634.4000649452209, 1647.6000654697418, 1662.0000660419464,<br>
>    1666.2000662088394, 1679.4000667333603, 1696.2000674009323,<br>
>    1714.200068116188, \<br>
>    1735.2000689506531, 1741.2000691890717, 1806.6000717878342,<br>
>    1809.6000719070435, 1824.000072479248, 1830.0000727176666,<br>
>    1842.0000731945038, 1848.0000734329224, 1860.0000739097595,<br>
>    1865.4000741243362, 1879.80007469\<br>
>    65408, 1884.6000748872757, 1900.200075507164, 1904.400075674057,<br>
>    1919.4000762701035, 1923.0000764131546, 1937.4000769853592,<br>
>    1943.4000772237778, 1956.0000777244568, 1960.8000779151917,<br>
>    1974.6000784635544, 1977.60\<br>
>    00785827637, 1993.200079202652, 1998.6000794172287, 2011.2000799179077,<br>
>    2026.2000805139542, 2030.4000806808472, 2042.4000811576843,<br>
>    2047.800081372261, 2059.8000818490982, 2065.2000820636749,<br>
>    2077.2000825405121, 2\<br>
>    080.8000826835632, 2092.8000831604004, 2107.8000837564468,<br>
>    2112.6000839471817, 2125.8000844717026, 2140.800085067749,<br>
>    2145.000085234642, 2158.8000857830048, 2164.2000859975815,<br>
>    2176.8000864982605, 2179.8000866174\<br>
>    698, 2195.4000872373581, 2212.2000879049301, 2217.000088095665,<br>
>    2232.6000887155533, 2235.6000888347626, 2250.0000894069672,<br>
>    2254.2000895738602, 2269.8000901937485, 2274.6000903844833,<br>
>    2289.0000909566879, 2306.400\<br>
>    0916481018, 2311.8000918626785, 2322.0000922679901]<br>
</div></div>>    >>> chunksA<br>
<span class="">>    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br>
>    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,<br>
>    0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1\<br>
>    , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,<br>
>    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,<br>
>    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, \<br>
>    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3,<br>
>    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,<br>
>    3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\<br>
</span>>    A 3, 3, 3, 3]<br>
<span class="">>    This looks correct, no? I am trying to attach the image plot of the design<br>
</span>>    matrix, split into the 4 sessions.A<br>
>    Best,<br>
>    Wolfganga**<br>
>    [IMG]A figure_1.png<br>
>    a**<br>
<div><div class="h5">>    On Mon, May 9, 2016 at 5:50 PM, Yaroslav Halchenko <<a href="mailto:debian@onerussian.com">debian@onerussian.com</a>><br>
>    wrote:<br>
<br>
>      On Mon, 09 May 2016, Wolfgang Pauli wrote:<br>
<br>
>      > Hi,<br>
<br>
>      > I am trying to perform an mvpa analysis of an experiment in which I<br>
>      have 16<br>
>      > different trial types and 4 sessions, 4 trial types in each session<br>
>      (run).<br>
>      > Based on the tutorial, I was getting started by using<br>
>      fit_event_hrf_model,<br>
>      > like so:<br>
<br>
>      > evds = fit_event_hrf_model(ds, events, time_attr='time_coords',<br>
>      > condition_attr=('onset'), return_model=True)<br>
<br>
>      > where ds is an openfmri dataset (get_model_bold_dataset).<br>
<br>
>      > I was trying to figure out why I would always get the warning that the<br>
>      > design matrix was singular, and eventually ended up investigating the<br>
>      > design matrix of the model.<br>
<br>
>      > I used matplotlib to plot the design matrix, split it up into the four<br>
>      > session, and found that the four parts were IDENTICAL. What could I be<br>
>      > doing wrong? Obviously, it shouldn't be the same, because there are<br>
>      > different trial types in the four sessions, and the trial order is<br>
>      also<br>
>      > randomized.<br>
<br>
>      > Furthermore, the design matrix has 26 regressors. I don't quite<br>
>      understand<br>
>      > where that number is coming from, as I have 16 unique event types, and<br>
>      4<br>
>      > sessions.<br>
<br>
>      most probably that events definition was was the same in each of the<br>
>      chunks... but also note that if you do it in a dataset which has<br>
>      multiple chunks, you want to have condition_attr=['onset', 'chunks'] if<br>
>      you want to make a model per each onset x chunk pair as was demoed e.g.<br>
</div></div>>      atA  <a href="http://www.pymvpa.org/tutorial_eventrelated.html#response-modeling" rel="noreferrer" target="_blank">http://www.pymvpa.org/tutorial_eventrelated.html#response-modeling</a><br>
<div class="HOEnZb"><div class="h5"><br>
>      if you share your data, and ideally your investigation script then we<br>
>      could may be look deeper<br>
--<br>
Yaroslav O. Halchenko<br>
Center for Open Neuroscience     <a href="http://centerforopenneuroscience.org" rel="noreferrer" target="_blank">http://centerforopenneuroscience.org</a><br>
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755<br>
Phone: <a href="tel:%2B1%20%28603%29%20646-9834" value="+16036469834">+1 (603) 646-9834</a>                       Fax: <a href="tel:%2B1%20%28603%29%20646-1419" value="+16036461419">+1 (603) 646-1419</a><br>
WWW:   <a href="http://www.linkedin.com/in/yarik" rel="noreferrer" target="_blank">http://www.linkedin.com/in/yarik</a><br>
<br>
_______________________________________________<br>
Pkg-ExpPsy-PyMVPA mailing list<br>
<a href="mailto:Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org">Pkg-ExpPsy-PyMVPA@lists.alioth.debian.org</a><br>
<a href="http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa" rel="noreferrer" target="_blank">http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa</a><br>
</div></div></blockquote></div><br></div>