# Welch PSD in source space

**URL:** <https://mne.discourse.group/t/welch-psd-in-source-space/1113>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [November 7, 2016, 2:55pm UTC](https://mne.discourse.group/t/welch-psd-in-source-space/1113 "2016-11-07T14:55:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 7, 2016, 2:55pm UTC](https://mne.discourse.group/t/welch-psd-in-source-space/1113/1 "2016-11-07T14:55:02Z")

</div>

Dear MNE-users,

I would like to compute PSD in source space using Welch's method. I did not  
find how to do it with the currently implemented functions:  
- compute\_source\_psd is doing it but from raw file, yet I'ld like to  
perform the analysis only on some parts of epochs,  
- compute\_source\_psd\_epochs is using multitaper,  
- psd\_welch had epochs/evoked instances as argument and not source data

How could I do it?

Thanks a lot,  
Best,  
Laetitia G.  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161107/e1c0932b/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161107/e1c0932b/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 7, 2016, 3:03pm UTC](https://mne.discourse.group/t/welch-psd-in-source-space/1113/2 "2016-11-07T15:03:20Z")

</div>

Hi Laetitia I would simply source localize epochs and compute the Welch on  
the output. I happen to write some code for this right now, I'm happy to  
share it with you. We can then make a PR to MNE. Currently the API there  
does not seam to support this yet.  
Denis

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 7, 2016, 3:06pm UTC](https://mne.discourse.group/t/welch-psd-in-source-space/1113/3 "2016-11-07T15:06:52Z")

</div>

For now you can use `mne.time_frequency.psd._psd_welch` and pass sfreq from  
your info and data from the stc.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 7, 2016, 3:08pm UTC](https://mne.discourse.group/t/welch-psd-in-source-space/1113/4 "2016-11-07T15:08:59Z")

</div>

Yes, I'ld be happy to use your code. I was also thinking about source  
reconstructing PSD computed on the epochs, do you think it is valid?

2016-11-07 16:03 GMT+01:00 Denis-Alexander Engemann \<  
denis.engemann at gmail.com\>:

> Hi Laetitia I would simply source localize epochs and compute the Welch on  
> the output. I happen to write some code for this right now, I'm happy to  
> share it with you. We can then make a PR to MNE. Currently the API there  
> does not seam to support this yet.  
> Denis
> 
> > Dear MNE-users,
> > 
> > I would like to compute PSD in source space using Welch's method. I did  
> > not find how to do it with the currently implemented functions:  
> > - compute\_source\_psd is doing it but from raw file, yet I'ld like to  
> > perform the analysis only on some parts of epochs,  
> > - compute\_source\_psd\_epochs is using multitaper,  
> > - psd\_welch had epochs/evoked instances as argument and not source data
> > 
> > How could I do it?
> > 
> > Thanks a lot,  
> > Best,  
> > Laetitia G.  
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Mne\_analysis mailing list  
> > Mne\_analysis at nmr.mgh.harvard.edu  
> > [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> > 
> > The information in this e-mail is intended only for the person to whom it  
> > is  
> > addressed. If you believe this e-mail was sent to you in error and the  
> > e-mail  
> > contains patient information, please contact the Partners Compliance  
> > HelpLine at  
> > [MyComplianceReport.com: Compliance and Ethics Reporting](http://www.partners.org/complianceline) . If the e-mail was sent to you  
> > in error  
> > but does not contain patient information, please contact the sender and  
> > properly  
> > dispose of the e-mail.
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Mne\_analysis mailing list  
> Mne\_analysis at nmr.mgh.harvard.edu  
> [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> 
> The information in this e-mail is intended only for the person to whom it  
> is  
> addressed. If you believe this e-mail was sent to you in error and the  
> e-mail  
> contains patient information, please contact the Partners Compliance  
> HelpLine at  
> [MyComplianceReport.com: Compliance and Ethics Reporting](http://www.partners.org/complianceline) . If the e-mail was sent to you in  
> error  
> but does not contain patient information, please contact the sender and  
> properly  
> dispose of the e-mail.

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161107/db54f3d9/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161107/db54f3d9/attachment-0001.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 7, 2016, 3:11pm UTC](https://mne.discourse.group/t/welch-psd-in-source-space/1113/5 "2016-11-07T15:11:32Z")

</div>

No only for the Fourier coefficients is valid once you compute the power  
it's non-linear.

Use apply\_inverse\_epochs and do a welch on the output with the private  
function and accumulate the result.

That's anyways what I will do.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [November 7, 2016, 3:14pm UTC](https://mne.discourse.group/t/welch-psd-in-source-space/1113/6 "2016-11-07T15:14:03Z")

</div>

Great, thanks!

2016-11-07 16:11 GMT+01:00 Denis-Alexander Engemann \<  
denis.engemann at gmail.com\>:

> No only for the Fourier coefficients is valid once you compute the power  
> it's non-linear.
> 
> Use apply\_inverse\_epochs and do a welch on the output with the private  
> function and accumulate the result.
> 
> That's anyways what I will do.
> 
> > Yes, I'ld be happy to use your code. I was also thinking about source  
> > reconstructing PSD computed on the epochs, do you think it is valid?
> > 
> > 2016-11-07 16:03 GMT+01:00 Denis-Alexander Engemann \<  
> > denis.engemann at gmail.com\>:
> > 
> > Hi Laetitia I would simply source localize epochs and compute the Welch  
> > on the output. I happen to write some code for this right now, I'm happy to  
> > share it with you. We can then make a PR to MNE. Currently the API there  
> > does not seam to support this yet.  
> > Denis
> > 
> > Dear MNE-users,
> > 
> > I would like to compute PSD in source space using Welch's method. I did  
> > not find how to do it with the currently implemented functions:  
> > - compute\_source\_psd is doing it but from raw file, yet I'ld like to  
> > perform the analysis only on some parts of epochs,  
> > - compute\_source\_psd\_epochs is using multitaper,  
> > - psd\_welch had epochs/evoked instances as argument and not source data
> > 
> > How could I do it?
> > 
> > Thanks a lot,  
> > Best,  
> > Laetitia G.  
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Mne\_analysis mailing list  
> > Mne\_analysis at nmr.mgh.harvard.edu  
> > [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> > 
> > The information in this e-mail is intended only for the person to whom it  
> > is  
> > addressed. If you believe this e-mail was sent to you in error and the  
> > e-mail  
> > contains patient information, please contact the Partners Compliance  
> > HelpLine at  
> > [MyComplianceReport.com: Compliance and Ethics Reporting](http://www.partners.org/complianceline) . If the e-mail was sent to you  
> > in error  
> > but does not contain patient information, please contact the sender and  
> > properly  
> > dispose of the e-mail.
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Mne\_analysis mailing list  
> > Mne\_analysis at nmr.mgh.harvard.edu  
> > [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> > 
> > The information in this e-mail is intended only for the person to whom it  
> > is  
> > addressed. If you believe this e-mail was sent to you in error and the  
> > e-mail  
> > contains patient information, please contact the Partners Compliance  
> > HelpLine at  
> > [MyComplianceReport.com: Compliance and Ethics Reporting](http://www.partners.org/complianceline) . If the e-mail was sent to you  
> > in error  
> > but does not contain patient information, please contact the sender and  
> > properly  
> > dispose of the e-mail.
> > 
> > \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> > Mne\_analysis mailing list  
> > Mne\_analysis at nmr.mgh.harvard.edu  
> > [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> > 
> > The information in this e-mail is intended only for the person to whom it  
> > is  
> > addressed. If you believe this e-mail was sent to you in error and the  
> > e-mail  
> > contains patient information, please contact the Partners Compliance  
> > HelpLine at  
> > [MyComplianceReport.com: Compliance and Ethics Reporting](http://www.partners.org/complianceline) . If the e-mail was sent to you  
> > in error  
> > but does not contain patient information, please contact the sender and  
> > properly  
> > dispose of the e-mail.
> 
> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> Mne\_analysis mailing list  
> Mne\_analysis at nmr.mgh.harvard.edu  
> [Mne\_analysis Info Page](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> 
> The information in this e-mail is intended only for the person to whom it  
> is  
> addressed. If you believe this e-mail was sent to you in error and the  
> e-mail  
> contains patient information, please contact the Partners Compliance  
> HelpLine at  
> [MyComplianceReport.com: Compliance and Ethics Reporting](http://www.partners.org/complianceline) . If the e-mail was sent to you in  
> error  
> but does not contain patient information, please contact the sender and  
> properly  
> dispose of the e-mail.

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20161107/f9dab915/attachment-0001.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20161107/f9dab915/attachment-0001.html)
