# compute\_source\_psd\_epochs()

**URL:** <https://mne.discourse.group/t/compute-source-psd-epochs/561>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [April 2, 2013, 4:47pm UTC](https://mne.discourse.group/t/compute-source-psd-epochs/561 "2013-04-02T16:47:06Z")\
**Posts on this page:** 5\
**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:** [April 2, 2013, 4:47pm UTC](https://mne.discourse.group/t/compute-source-psd-epochs/561/1 "2013-04-02T16:47:06Z")

</div>

Greetings,

There is an example script called "Compute Power Spectral Density of  
inverse solution from single epochs" at  
[http://martinos.org/mne/auto\_examples/time\_frequency/plot\_compute\_source\_psd\_epochs.html#example-time-frequency-plot-compute-source-psd-epochs-py](http://martinos.org/mne/auto_examples/time_frequency/plot_compute_source_psd_epochs.html#example-time-frequency-plot-compute-source-psd-epochs-py)  
.

I noticed that after defining and loading the label into memory, it is  
never mentioned again. Line #60 of the script says "compute source space  
psd in label" and involves calling the compute\_source\_psd\_epochs()  
function, but the label variable is never passed into it as an argument.  
Does this function automatically seek a previously defined variable called  
label? Are there any options for what labels, how many labels, etc., can be  
fed into it?

I want to load a label like lh.BA45.label, but I want it to perform the psd  
computations on \*both\* hemispheres. So far it seems like you can only load  
one hemisphere at a time.

Best wishes,

Vincent Rupp Jr  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20130402/8391faa1/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20130402/8391faa1/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:** [April 2, 2013, 5:13pm UTC](https://mne.discourse.group/t/compute-source-psd-epochs/561/2 "2013-04-02T17:13:11Z")

</div>

Hi Vincent,

You are correct, the loaded label isn't used at all. It must be a "copy  
paste artifact" from when the example was created.

To your question, if you want to use multiple labels, you can just  
combine them using "+", e.g.,

label\_both = label\_lh + label\_rh

and then pass label\_both to compute\_source\_psd\_epochs using the label  
parameter. The resulting SourceEstimate will contain the PSD for all  
labels (the union of all the source space vertices in the labels). Let  
me know if you need help splitting the data into the labels again (it's  
a few lines of Python code).

I hope this helps.

Martin

---

<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:** [April 2, 2013, 5:19pm UTC](https://mne.discourse.group/t/compute-source-psd-epochs/561/3 "2013-04-02T17:19:41Z")

</div>

hi Vincent,

looks like your problem is fixed. Thanks Martin.

[https://github.com/mne-tools/mne-python/pull/550](https://github.com/mne-tools/mne-python/pull/550)

Best,  
Alex

---

<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:** [April 2, 2013, 5:20pm UTC](https://mne.discourse.group/t/compute-source-psd-epochs/561/4 "2013-04-02T17:20:47Z")

</div>

After looking at the example again, I realized that it wasn't a "copy  
paste artifact" but that it was a bug as we simply didn't use the label  
while it should have been used. This has been fixed in the MNE-Python  
development version:

[https://github.com/mne-tools/mne-python/pull/550](https://github.com/mne-tools/mne-python/pull/550)

---

<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:** [April 2, 2013, 5:25pm UTC](https://mne.discourse.group/t/compute-source-psd-epochs/561/5 "2013-04-02T17:25:24Z")

</div>

This is great help. Thanks Martin!

Best wishes,

Vincent Rupp Jr
