# plot sensors connectivity error

**URL:** <https://mne.discourse.group/t/plot-sensors-connectivity-error/572>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [April 19, 2013, 1:09pm UTC](https://mne.discourse.group/t/plot-sensors-connectivity-error/572 "2013-04-19T13:09:39Z")\
**Posts on this page:** 2\
**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 19, 2013, 1:09pm UTC](https://mne.discourse.group/t/plot-sensors-connectivity-error/572/1 "2013-04-19T13:09:39Z")

</div>

Hi MNEers,

When I tried to run plot\_sensors\_connectivity.py  
I got the following error,

Computes the Phase Lag Index (PLI) between all gradiometers and shows the  
connectivity in 3D using the helmet geometry. The left visual stimulation data  
are used which produces strong connectvitiy in the right occipital sensors.

Opening raw data file F:\TDDOWNLOAD\MNE\_sample\_data\MNE-sample-data-processed\MN  
E-sample-data-python/MEG/sample/sample\_audvis\_filt-0-40\_raw.fif...  
&nbsp;&nbsp;&nbsp;&nbsp;Read a total of 4 projection items:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PCA-v1 (1 x 102) idle  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PCA-v2 (1 x 102) idle  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PCA-v3 (1 x 102) idle  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Average EEG reference (1 x 60) idle  
&nbsp;&nbsp;&nbsp;&nbsp;Range : 6450 ... 48149 = 42.956 ... 320.665 secs  
Ready.  
4 projection items activated  
73 matching events found  
Connectivity computation...  
Reading 606 ... 711 = 4.036 ... 4.735 secs...  
[done]  
Applying baseline correction ... (mode: mean)  
Reading 1026 ... 1131 = 6.833 ... 7.532 secs...  
[done]  
Applying baseline correction ... (mode: mean)  
Traceback (most recent call last):  
&nbsp;&nbsp;File "plot\_sensor\_connectivity.py", line 56, in \<module\>  
&nbsp;&nbsp;&nbsp;&nbsp;mt\_adaptive=False, n\_jobs=2)  
&nbsp;&nbsp;File "D:\Python\lib\site-packages\mne-0.6.git-py2.7.egg\mne\utils.py", line 27  
9, in dec  
&nbsp;&nbsp;&nbsp;&nbsp;return function(\*args, \*\*kwargs)  
&nbsp;&nbsp;File "D:\Python\lib\site-packages\mne-0.6.git-py2.7.egg\mne\connectivity\spect  
ral.py", line 694, in spectral\_connectivity  
&nbsp;&nbsp;&nbsp;&nbsp;tmax\_idx = n\_times\_in  
UnboundLocalError: local variable 'n\_times\_in' referenced before assignment

Anyone ever encounter the similar error info?  
How to solve it ?  
Thank you in advance.

Best wishes,  
Junpeng

------------------ Original ------------------

---

<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 19, 2013, 1:19pm UTC](https://mne.discourse.group/t/plot-sensors-connectivity-error/572/2 "2013-04-19T13:19:52Z")

</div>

Hi Junpeng,

This was a bug, it has been fixed in the meanwhile, see

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

Updating your MNE-Python installation to the latest master from github  
will fix it.

Best,

Martin
