<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Thanks Jan-Mathijs,
<div class=""><br class="">
</div>
<div class="">I am getting the following error when I try this.</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">Error using ft_checkdata (line 528)</div>
<div class="">This function requires 'comp', 'timelock' or 'freq' data as input, see ft_datatype_comp, ft_datatype_timelock or ft_datatype_freq.</div>
<div class=""><br class="">
</div>
<div class="">My code is this:</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">
data = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">
data.avg =weights';</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">
data.labels = labels;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">
data.time = 1;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">
data.dimord = <span style="color: #a020f0" class="">'chan_time'</span>;</div>
<p style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</p>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">
cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">
cfg.xlim =<span style="color: #a020f0" class="">'maxmin'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">
cfg.zlim = <span style="color: #a020f0" class="">'maxmin'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; color: rgb(160, 32, 240);" class="">
<span style="color: #000000" class="">cfg.layout = </span>'neuromag306all.lay'<span style="color: #000000" class="">;</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">
cfg.channel = <span style="color: #a020f0" class="">'MEG'</span>;</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal; color: rgb(34, 139, 34);" class="">
<span style="color: #000000" class="">cfg.parameter = </span><span style="color: #a020f0" class="">'weights'</span><span style="color: #000000" class="">;
</span>% the default 'avg' is not present in the data</div>
<div style="margin: 0px; font-stretch: normal; font-size: 10px; line-height: normal;" class="">
figure; ft_topoplotER(cfg,data); colorbar</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
<br class="">
</div>
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
<br class="">
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
And my data structure is this:</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
<br class="">
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
data.weights = 306x1 double</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
 data.labels, = 321 x1cell</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
data.time=1</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
data.dimord=‘chan_time’</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
<br class="">
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
I’m believe I have all the necessary fields for it to pass as time lock data (time, dimord, and label), so I’m not sure why it is not working. I have tried preselecting only the correct 306 labels and using those in the structure but this does not help either.
 I can try the ft_plot_topo method, but since I had some other questions I thought I’d see if you could help me with the higher level function. My other questions are simply, in the neuromag layout files, are the first two columns X and Y coordinates respectively?
 And secondly, I understand that plotting magnetometers and gradiometers together is not such a good idea because of the difference in their scales, but why do you say that using only gradiometers will not result in a nice topography? Does that mean my only
 option is to plot magnetometers alone? Also, thanks for the reference to that paper, indeed I was using the forward mixing weights after having read that very paper! </div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
<br class="">
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
Thanks a lot!</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
Benjy</div>
<div><br class="">
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Mar 5, 2021, at 3:02 PM, Schoffelen, J.M. (Jan Mathijs) <<a href="mailto:jan.schoffelen@donders.ru.nl" class="">jan.schoffelen@donders.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Dear Benjy,
<div class=""><br class="">
</div>
<div class="">It looks as if you are almost there.</div>
<div class=""><br class="">
</div>
<div class="">That is, I don’t know what your data structure looks like, but if you create it sufficiently lean, and internally consistent, it should work.</div>
<div class="">Something like:</div>
<div class=""><br class="">
</div>
<div class="">data = [];</div>
<div class="">data.weights = weights;</div>
<div class="">data.label = <list-of-labels>;</div>
<div class="">data.time = 0; % just give it a value</div>
<div class="">data.dimord = ‘chan_time’;</div>
<div class=""><br class="">
</div>
<div class="">Alternatively, you can use the lower-level function ft_plot_topo (it’s in fieldtrip/plotting): this function requires also ‘low-level’ input arguments, i.e. two vectors of x and y coordinates of the sensor positions, the vector with the to-be-plotted
 values, and some additional options for aesthetics. I think the help documentation of this function explains it well enough.</div>
<div class=""><br class="">
</div>
<div class="">Two points of caution: </div>
<div class="">1) with the 306 mixed gradiometer/magnetometer system it probably does not make sense to visualize a topogrophy of the gradiometers and magnetometers mixed, and also, using the gradiometers only it probably will probably not result in a nice topography. </div>
<div class="">2) it could be that it is more informative to look at the ‘forward mixing weights’, rather than the unmixing weights that drop out of your classifier. An exceptionally good read about this issue is provided in: <a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1016%2Fj.neuroimage.2013.10.067&data=04%7C01%7C%7C2d001b0f96d040c256bc08d8dfebe8ea%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C637505551608497405%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=iGUmFxRtA2u8iXvHksxNY%2BaqwNY6Vx8efqB%2FH6%2BKp6k%3D&reserved=0" originalsrc="https://doi.org/10.1016/j.neuroimage.2013.10.067" shash="xRFp/tkHhgnMxzNiDytQUuAKB/OOHSiCwSQJGlkRJvjFQA8sbmj4wU7SwDboP/lvZ/FJE6dcfAik92yBFJmGs9XwSz7KBt6UsRSGV0LrnP0sTW1PmvexAiN8DPnfYljBJb0sGcDt1ValD6MkeJahPAKkP4AOp7b2Z6LVT4iMvfs=" class="">https://doi.org/10.1016/j.neuroimage.2013.10.067</a></div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">
<div class=""><br class="">
<blockquote type="cite" class="">
<div class="">On 5 Mar 2021, at 15:18, Barnett, Benjy <<a href="mailto:benjy.barnett.20@ucl.ac.uk" class="">benjy.barnett.20@ucl.ac.uk</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi!
<div class=""><br class="">
</div>
<div class="">I am trying to plot the topography of my LDA weights, but am having some trouble. I am using my own script to calculate the weights rather than any packages (e.g. DMLT, or MVPA-light), so the tutorials on the fieldtrip site haven’t been able to
 help me. So far, I’ve simply tried adding the weights (a 306x1 length vector) as a field to my data structure. And trying this code:</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">data.weights = weights;</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">cfg = [];</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">cfg.xlim =<span style="color: #a020f0" class="">'maxmin'</span>;</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">cfg.zlim =
<span style="color: #a020f0" class="">'maxmin'</span>;</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(160, 32, 240);" class="">
<span style="" class="">cfg.layout = </span>'neuromag306all.lay'<span style="" class="">;</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">cfg.channel =
<span style="color: #a020f0" class="">'MEG'</span>;</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; color: rgb(34, 139, 34);" class="">
<span style="" class="">cfg.parameter = </span><span style="color: #a020f0" class="">'weights'</span><span style="" class="">; </span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">figure; ft_topoplotER(cfg,data); colorbar</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 12px;" class="">
 <br class="webkit-block-placeholder">
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
Unsurprisingly, this doesn’t work. It results in the error 'field “weights" not present in data’. I assume because the weights field is not interpretable by the fieldtrip code. I guessed the lack of a dimord field for the weights might be underlying its lack
 of interpretability, but playing around with that has not worked either. I’ve tried adding a ‘weightsdimord’ field with the [306x1] dimensions, but this also - unsurprisingly - didn’t work.</div>
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
<br class="">
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
Is there a way around this? Will I need to use lower level functions than ft_topoplotER? If so, can anyone advise on how I might implement this?</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
<br class="">
</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
Many thanks for your time,</div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 14px;" class="">
Benjy</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=04%7C01%7C%7C2d001b0f96d040c256bc08d8dfebe8ea%7C1faf88fea9984c5b93c9210a11d9a5c2%7C0%7C0%7C637505551608507361%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=4M%2BiFWZXL7byRW8DF7%2F6YUD4jTU0JBbgkvEQeTCaxKE%3D&reserved=0" originalsrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" shash="JOSlIL5qZl1lYshK/bbulnWbdCI73X6p0PEh8TdrTmL/mbb7kC0NZIX5rmd3rTDjs3TKsAla+KZDEhQ3H299ZkU4n9z+Auh3biiQiE17hnA3tkhTFMTdLKN919eFH78wK4Ym/7YZAsZTHx9sg2ssyWZFPlJJT0b2lAI/Bhe73VE=" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
<a href="https://doi.org/10.1371/journal.pcbi.1002202" class="">https://doi.org/10.1371/journal.pcbi.1002202</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
_______________________________________________<br class="">
fieldtrip mailing list<br class="">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="">
https://doi.org/10.1371/journal.pcbi.1002202<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>