<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hey Alex,</p>
<p style="margin-top:0;margin-bottom:0">Yes, you can find the script <a href="https://github.com/pelednoam/mmvt/blob/master/src/misc/power_spectral_density.py" class="OWAAutoLink" id="LPlnk179818" previewremoved="true">
here</a>.</p>
<p style="margin-top:0;margin-bottom:0">It's based on this mne&nbsp;<a href="https://martinos.org/mne/stable/auto_examples/time_frequency/plot_compute_source_psd_epochs.html" class="OWAAutoLink" id="LPlnk162834" previewremoved="true">example</a>.</p>
<p style="margin-top:0;margin-bottom:0">One thing the pops immediately, is that only on the second approach (<span>psd_array_multitaper on the label_ts)</span> you need to set the mode (I set it to mean_flip)</p>
<p style="margin-top:0;margin-bottom:0">Also, for both of them, I use 10 * np.log10(x) to get dB. Not sure this correct in the first approach, mostly because it's not part of the mne example.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Thanks,</p>
<p style="margin-top:0;margin-bottom:0">Noam</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> mne_analysis-bounces@nmr.mgh.harvard.edu &lt;mne_analysis-bounces@nmr.mgh.harvard.edu&gt; on behalf of Alexandre Gramfort &lt;alexandre.gramfort@inria.fr&gt;<br>
<b>Sent:</b> Thursday, August 30, 2018 9:27:59 AM<br>
<b>To:</b> Discussion and support forum for the users of MNE Software<br>
<b>Subject:</b> Re: [Mne_analysis] Cortical labels power spectrum different approaches</font>
<div>&nbsp;</div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; External Email - Use Caution&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
<br>
hi,<br>
<br>
It should be more in agreement.<br>
Can you share a script on one of the MNE datasets to figure out the<br>
cause of the difference?<br>
Also note that both units in your plots are very different (dB vs I am not sure)<br>
<br>
Alex<br>
<br>
On Wed, Aug 29, 2018 at 11:18 PM Peled, Noam &lt;NPELED@mgh.harvard.edu&gt; wrote:<br>
&gt;<br>
&gt; Let me be more specific/clear:<br>
&gt;<br>
&gt; I'm analyzing data from a patient with an ECOG. I want to compare the power-spectrum of the electrodes and the MEG cortical labels I've created around each electrode.<br>
&gt;<br>
&gt; It seems that calculating the time series in the source space of long enough MEG epochs (~10s), split the electrodes file to same length epochs, and use<br>
&gt;<br>
&gt; mne.time_frequency.psd_array_multitaper on both of them is the way to go, and also I know that both are in the same units (10*log10 for [dB]).<br>
&gt; But I'm still a little bit confused by the different results I'm getting when using mne.minimum_norm.compute_source_psd_epochs instead.<br>
&gt;<br>
&gt; Thanks,<br>
&gt; Noam<br>
&gt;<br>
&gt; ________________________________<br>
&gt; From: mne_analysis-bounces@nmr.mgh.harvard.edu &lt;mne_analysis-bounces@nmr.mgh.harvard.edu&gt; on behalf of Peled, Noam &lt;NPELED@mgh.harvard.edu&gt;<br>
&gt; Sent: Wednesday, August 29, 2018 2:32:39 PM<br>
&gt; To: mne_analysis@nmr.mgh.harvard.edu<br>
&gt; Subject: [Mne_analysis] Cortical labels power spectrum different approaches<br>
&gt;<br>
&gt;<br>
&gt; Hey all,<br>
&gt;<br>
&gt; I'm calculating MEG cortical labels power spectrum (for resting state data) in two different ways. Can you help me understand the differences? The power spectrums are quite different (see attached).<br>
&gt;<br>
&gt;<br>
&gt; 1) Go through the source space time-series:<br>
&gt;<br>
&gt;<br>
&gt; stcs = mne.minimum_norm.apply_inverse_epochs(epochs, ...)<br>
&gt; labels_ts = mne.extract_label_time_course(stcs, labels, ...)<br>
&gt; for label_ts:<br>
&gt;&nbsp;&nbsp; psds, freqs = mne.time_frequency.psd_array_welch(label_ts, ...)<br>
&gt;&nbsp;&nbsp; psds = 10 * np.log10(psds)<br>
&gt;<br>
&gt;<br>
&gt; 2) Compute the PSD from the epochs:<br>
&gt;<br>
&gt;<br>
&gt; for label_ind, label in enumerate(labels):<br>
&gt;&nbsp;&nbsp; stcs = mne.minimum_norm.compute_source_psd_epochs(epochs, ...)<br>
&gt;&nbsp;&nbsp; for stc in stcs:<br>
&gt;&nbsp;&nbsp;&nbsp;&nbsp; psds = np.mean(stc.data, axis=0)<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Thanks!<br>
&gt;<br>
&gt; Noam<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Mne_analysis mailing list<br>
&gt; Mne_analysis@nmr.mgh.harvard.edu<br>
&gt; <a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
&gt;<br>
&gt;<br>
&gt; The information in this e-mail is intended only for the person to whom it is<br>
&gt; addressed. If you believe this e-mail was sent to you in error and the e-mail<br>
&gt; contains patient information, please contact the Partners Compliance HelpLine at<br>
&gt; <a href="http://www.partners.org/complianceline">http://www.partners.org/complianceline</a> . If the e-mail was sent to you in error<br>
&gt; but does not contain patient information, please contact the sender and properly<br>
&gt; dispose of the e-mail.<br>
<br>
_______________________________________________<br>
Mne_analysis mailing list<br>
Mne_analysis@nmr.mgh.harvard.edu<br>
<a href="https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis">https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis</a><br>
</div>
</span></font></div>
</body>
</html>