<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 <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 <mne_analysis-bounces@nmr.mgh.harvard.edu> on behalf of Alexandre Gramfort <alexandre.gramfort@inria.fr><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> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText"> External Email - Use Caution <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 <NPELED@mgh.harvard.edu> wrote:<br>
><br>
> Let me be more specific/clear:<br>
><br>
> 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>
><br>
> 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>
><br>
> 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>
> 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>
><br>
> Thanks,<br>
> Noam<br>
><br>
> ________________________________<br>
> From: mne_analysis-bounces@nmr.mgh.harvard.edu <mne_analysis-bounces@nmr.mgh.harvard.edu> on behalf of Peled, Noam <NPELED@mgh.harvard.edu><br>
> Sent: Wednesday, August 29, 2018 2:32:39 PM<br>
> To: mne_analysis@nmr.mgh.harvard.edu<br>
> Subject: [Mne_analysis] Cortical labels power spectrum different approaches<br>
><br>
><br>
> Hey all,<br>
><br>
> 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>
><br>
><br>
> 1) Go through the source space time-series:<br>
><br>
><br>
> stcs = mne.minimum_norm.apply_inverse_epochs(epochs, ...)<br>
> labels_ts = mne.extract_label_time_course(stcs, labels, ...)<br>
> for label_ts:<br>
> psds, freqs = mne.time_frequency.psd_array_welch(label_ts, ...)<br>
> psds = 10 * np.log10(psds)<br>
><br>
><br>
> 2) Compute the PSD from the epochs:<br>
><br>
><br>
> for label_ind, label in enumerate(labels):<br>
> stcs = mne.minimum_norm.compute_source_psd_epochs(epochs, ...)<br>
> for stc in stcs:<br>
> psds = np.mean(stc.data, axis=0)<br>
><br>
><br>
><br>
> Thanks!<br>
><br>
> Noam<br>
><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>
><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">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>
_______________________________________________<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>