<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">I have version 0.5 which I think is the newest version.<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF76785"><font color="#000000" face="Tahoma" size="2"><b>Lähettäjä:</b> mne_analysis-bounces@nmr.mgh.harvard.edu [mne_analysis-bounces@nmr.mgh.harvard.edu] käyttäjän Denis-Alexander Engemann [denis.engemann@gmail.com] puolesta<br>
<b>Lähetetty:</b> 22. heinäkuuta 2014 15:00<br>
<b>Vastaanottaja:</b> Discussion and support forum for the users of MNE Software<br>
<b>Aihe:</b> Re: [Mne_analysis] Index errors with PySurfer real-time source estimate visualization<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">Hi Sebastian,
<div><br>
</div>
<div>before digging deeper, </div>
<div>which version of PySurfer are you using.</div>
<div>In my experience usually many problems dissolve with the latest PySurfer code. </div>
<div><br>
</div>
<div>Best,</div>
<div>Denis</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Jul 22, 2014 at 1:44 PM, Silfverberg Sebastian <span dir="ltr">
<<a href="mailto:sebastian.silfverberg@aalto.fi" target="_blank">sebastian.silfverberg@aalto.fi</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hi everyone!<br>
<br>
<font color="black" face="Tahoma"><span dir="ltr" style="font-size:10pt">I have been trying to code a program that would enable to plot trigger spesific source estimates in real time with FieldTrip Buffer. I have managed to do that, but I want to optimize it
a little more. I would like the program to be able to plot the initial brain surface with PySurfer and then just add and remove estimates from the cortex when the buffer has received a next epoch. I'm using PySurfers Brain()-class and brain.add_data -method.
But the brain.add_data -method doesn't work:<br>
<br>
It always complains about index errors. I've noticed that the index error happens to be in vertices which have to be given in add_data method. Error is for example this:<br>
<br>
IndexError Traceback (most recent call last)<br>
/usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)<br>
173 else:<br>
174 filename = fname<br>
--> 175 __builtin__.execfile(filename, *where)<br>
<br>
/home/silfves1/mne-python/examples/omatfunktiot/yks_off.py in <module>()<br>
122 stc.tmin + stc.data.shape[1] * stc.tstep,<br>
123 stc.data.shape[1])<br>
--> 124 brain.add_data(stc.data, colormap='hot', vertices = stc.vertno, smoothing_steps=20, time=time, time_label='Time 100.0 ms', hemi=hemi, remove_existing=True)
<br>
125 <br>
126 # for ii, ev in enumerate(epochs.iter_evoked()):<br>
<br>
<br>
/home/silfves1/.local/lib/python2.7/site-packages/pysurfer-0.5-py2.7.egg/surfer/viz.pyc in add_data(self, array, min, max, thresh, colormap, alpha, vertices, smoothing_steps, time, time_label, colorbar, hemi, remove_existing)
<br>
835 adj_mat = utils.mesh_edges(self.geo[hemi].faces)<br>
836 smooth_mat = utils.smoothing_matrix(vertices, adj_mat,<br>
--> 837 smoothing_steps)<br>
838 else:<br>
839 smooth_mat = None<br>
<br>
/home/silfves1/.local/lib/python2.7/site-packages/pysurfer-0.5-py2.7.egg/surfer/utils.pyc in dec(*args, **kwargs)<br>
337 return ret<br>
338 else:<br>
--> 339 return function(*args, **kwargs)<br>
340 <br>
341 # set __wrapped__ attribute so ?? in IPython gets the right source<br>
<br>
<br>
/home/silfves1/.local/lib/python2.7/site-packages/pysurfer-0.5-py2.7.egg/surfer/utils.pyc in smoothing_matrix(vertices, adj_mat, smoothing_steps, verbose)
<br>
512 n_iter = smoothing_steps if smoothing_steps is not None else 1000<br>
513 for k in range(n_iter):<br>
--> 514 e_use = e[:, idx_use]<br>
515 <br>
516 data1 = e_use * np.ones(len(idx_use))<br>
<br>
/usr/lib/python2.7/dist-packages/scipy/sparse/csr.pyc in __getitem__(self, key)<br>
218 return self._get_submatrix(row, col) #[1:2,j]<br>
219 else:<br>
--> 220 P = extractor(col,self.shape[1]).T #[1:2,[1,2]]<br>
221 return self[row,:]*P<br>
222 <br>
<br>
/usr/lib/python2.7/dist-packages/scipy/sparse/csr.pyc in extractor(indices, N)<br>
186 indices = asindices(indices)<br>
187 <br>
--> 188 (min_indx,max_indx) = check_bounds(indices,N)<br>
189 <br>
190 if min_indx < 0:<br>
<br>
/usr/lib/python2.7/dist-packages/scipy/sparse/csr.pyc in check_bounds(indices, N)<br>
172 max_indx = indices.max()<br>
173 if max_indx >= N:<br>
--> 174 raise IndexError('index (%d) out of range' % max_indx)<br>
175 <br>
176 min_indx = indices.min()<br>
<br>
IndexError: index (215242) out of range<br>
<br>
I don't know how to fix this. Is the stc.vertno same thing as vertices? I've also tried to remove some indexes from stc.vertno, but it always complains about the ranks not being 1. Do you have any ideas to help me?<br>
<br>
Best regards<br>
<br>
Sebastian Silfveberg</span></font><br>
</div>
</div>
<br>
_______________________________________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" target="_blank">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
<br>
<br>
The information in this e-mail is intended only for the person to whom it is<br>
addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
contains patient information, please contact the Partners Compliance HelpLine at<br>
<a href="http://www.partners.org/complianceline" target="_blank">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in error<br>
but does not contain patient information, please contact the sender and properly<br>
dispose of the e-mail.<br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>