# \[mne-python\] use spectral\_connectivity on a single	epoch

**URL:** <https://mne.discourse.group/t/mne-python-use-spectral-connectivity-on-a-single-epoch/785>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [August 7, 2014, 12:34pm UTC](https://mne.discourse.group/t/mne-python-use-spectral-connectivity-on-a-single-epoch/785 "2014-08-07T12:34:49Z")\
**Posts on this page:** 4\
**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:** [August 7, 2014, 12:34pm UTC](https://mne.discourse.group/t/mne-python-use-spectral-connectivity-on-a-single-epoch/785/1 "2014-08-07T12:34:49Z")

</div>

Hi all,

Using mne-python, is it possible to use spectral\_connectivity on a  
single epoch at a time.

I have a single subject and I would like to calculate the Phase-Locking  
Value (or similar "connectivity" measure) on single trial basis. As I  
understand the output of the spectral\_connectivity the returned object  
is one value and not one per epoch. Is it possible to get it to return a  
value per epoch or does that simply not make any sense to do?

thanks,  
mads

---

<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:** [August 8, 2014, 3:06pm UTC](https://mne.discourse.group/t/mne-python-use-spectral-connectivity-on-a-single-epoch/785/2 "2014-08-08T15:06:24Z")

</div>

hi mads,

just call spectral\_connectivity on each epoch.

for k in range(len(epochs)):  
&nbsp;&nbsp;&nbsp;&nbsp;out = spectral\_connectivity(epochs[k], ...)  
&nbsp;&nbsp;&nbsp;&nbsp;....

or something along these lines.

HTH  
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:** [August 8, 2014, 3:14pm UTC](https://mne.discourse.group/t/mne-python-use-spectral-connectivity-on-a-single-epoch/785/3 "2014-08-08T15:14:54Z")

</div>

> hi mads,
> 
> just call spectral\_connectivity on each epoch.
> 
> for k in range(len(epochs)):  
> &nbsp;&nbsp;&nbsp;&nbsp;out = spectral\_connectivity(epochs[k], ...)  
> &nbsp;&nbsp;&nbsp;&nbsp;....

Arent' these all measures that are defined across epochs??

> or something along these lines.
> 
> HTH  
> Alex
> 
> \> Hi all,  
> \>  
> \> Using mne-python, is it possible to use spectral\_connectivity on a  
> \> single epoch at a time.  
> \>  
> \> I have a single subject and I would like to calculate the Phase-Locking  
> \> Value (or similar "connectivity" measure) on single trial basis. As I  
> \> understand the output of the spectral\_connectivity the returned object  
> \> is one value and not one per epoch. Is it possible to get it to return a  
> \> value per epoch or does that simply not make any sense to do?  
> \>  
> \> thanks,  
> \> mads  
> \> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> \> 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)

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20140808/1e45d7a3/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20140808/1e45d7a3/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:** [August 8, 2014, 5:17pm UTC](https://mne.discourse.group/t/mne-python-use-spectral-connectivity-on-a-single-epoch/785/4 "2014-08-08T17:17:54Z")

</div>

Normally all the connectivity measures are defined across epochs, and look  
for consistency of phase across them. For single trial value is one.

You can do connectivity across time however window need be very long in  
order to compensate for the bias in the connectivity.

Sheraz
