<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Alex,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Thanks for your reply! I did:</div><div class="gmail_default" style=""><pre style="font-size:12pt;background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:&quot;Courier New&quot;">surf = fwd[<span style="color:rgb(0,128,0);font-weight:bold">&#39;src&#39;</span>][hemi_idx]<br>tris = surf[<span style="color:rgb(0,128,0);font-weight:bold">&#39;use_tris&#39;</span>]  <span style="color:rgb(128,128,128);font-style:italic"><br></span></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><pre style="font-size:12pt;font-family:&quot;Courier New&quot;;background-color:rgb(255,255,255);color:rgb(0,0,0)"><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:&quot;Courier New&quot;;font-size:12pt"><span style="background-color:rgb(255,228,255)">edges</span> = mesh_edges(tris)</pre></pre><font face="arial, helvetica, sans-serif" style="">The dimensions of &#39;edges&#39; are 642*642 in my case. </font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif" style="">I&#39;m not sure I understand how coo_matrix in the mesh_edges function works. </font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif" style="">I saw that in the mesh_edges function,</font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif" style=""><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:&quot;Courier New&quot;;font-size:12pt">npoints = np.max(tris) + <span style="color:rgb(0,0,255)">1 </span></pre>Which gives one extra point.</font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif" style="">Then:</font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif" style=""><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:&quot;Courier New&quot;;font-size:12pt">edges = coo_matrix((ones_ntris, (x, y)), <span style="color:rgb(102,0,153)">shape</span>=(npoints, npoints))</pre>Which I interpreted as adding a &#39;1&#39;  at element (x[i],y[i]) of &#39;edges&#39; each time (x[i],y[i]) appears in (x,y), like in <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.coo_matrix.html">this example on constructing a matrix using ijv format</a>.</font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif" style="">However, since the largest element of &#39;tris&#39; is np.max(tris), why are there nonzero entries for the (np.max(tris) + 1)th row/col in the &#39;edges&#39; matrix?</font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif" style="">Should I be using edges[0:npoints-1,0:npoints-1] as my adjacency matrix? </font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif" style=""><br></font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif" style="">Thanks and Best,</font></pre><pre style="background-color:rgb(255,255,255);color:rgb(0,0,0)"><font face="arial, helvetica, sans-serif" style="">Gladia</font></pre><br></div><div class="gmail_default" style="font-size:small"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Mar 4, 2018 at 3:29 PM, Alexandre Gramfort <span dir="ltr">&lt;<a href="mailto:alexandre.gramfort@inria.fr" target="_blank">alexandre.gramfort@inria.fr</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">i suppose you mean use_tris with _<div><br></div><div>it&#39;s normal to have twice more triangles than vertices.<div><br></div><div>see for example here:</div><div><br></div><div><a href="https://github.com/mne-tools/mne-python/blob/master/mne/viz/_3d.py#L1444" target="_blank">https://github.com/mne-tools/<wbr>mne-python/blob/master/mne/<wbr>viz/_3d.py#L1444</a><br></div><div><br></div><div>how we get the triangles in low resolution with vertices index that go</div><div>from 0 to 581 in your case.</div><div><br></div><div>HTH</div><div>Alex</div><div><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Mar 3, 2018 at 10:58 PM, Gladia Hotan <span dir="ltr">&lt;<a href="mailto:gladiach@gmail.com" target="_blank">gladiach@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Alex,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I&#39;m still not sure how to get the adjacency matrix, based on the example. It seems like lh_faces and rh_faces contain the faces from the original cortical parcellation, before some sources are removed? I have an ico 3 source space. My leadfield matrix has 1162 sources in total. Thus fwd[&#39;src&#39;][0][&#39;vertno&#39;].shape = 581 and <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">fwd[&#39;src&#39;][1][&#39;vertno&#39;].sh<wbr>ape = 581. However, <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">fwd[&#39;src&#39;][0][&#39;usetri<wbr>s&#39;].shape = 1280 and <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">fwd[&#39;src&#39;][1][&#39;usetris&#39;]</span>.shape = 1280, so I&#39;m not sure which faces correspond to which vertices?</span></span></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br></span></span></div><div class="gmail_default" style="font-size:small"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">Thanks and Best,<br>Gladia</span></span></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_8272461268463871713h5">On Tue, Feb 6, 2018 at 5:26 AM, Alexandre Gramfort <span dir="ltr">&lt;<a href="mailto:alexandre.gramfort@inria.fr" target="_blank">alexandre.gramfort@inria.fr</a>&gt;</span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_8272461268463871713h5">This is the old script I was pointing to:<br>
<br>
<a href="https://github.com/mne-tools/mne-python/blob/maint/0.4/examples/plot_read_forward.py" rel="noreferrer" target="_blank">https://github.com/mne-tools/m<wbr>ne-python/blob/maint/0.4/examp<wbr>les/plot_read_forward.py</a><br>
<br>
HTH<br>
Alex<br></div></div>
______________________________<wbr>_________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.e<wbr>du</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.e<wbr>du/mailman/listinfo/mne_analys<wbr>is</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" rel="noreferrer" target="_blank">http://www.partners.org/compli<wbr>anceline</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>
<br>______________________________<wbr>_________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu" target="_blank">Mne_analysis@nmr.mgh.harvard.e<wbr>du</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.e<wbr>du/mailman/listinfo/mne_analys<wbr>is</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" rel="noreferrer" target="_blank">http://www.partners.org/compli<wbr>anceline</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><br>______________________________<wbr>_________________<br>
Mne_analysis mailing list<br>
<a href="mailto:Mne_analysis@nmr.mgh.harvard.edu">Mne_analysis@nmr.mgh.harvard.<wbr>edu</a><br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis" rel="noreferrer" target="_blank">https://mail.nmr.mgh.harvard.<wbr>edu/mailman/listinfo/mne_<wbr>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" rel="noreferrer" target="_blank">http://www.partners.org/<wbr>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>