# mne\_connectivity.spectral\_connectivity\_epochs results in error after upgrading MNE: requires no reference

**URL:** <https://mne.discourse.group/t/mne-connectivity-spectral-connectivity-epochs-results-in-error-after-upgrading-mne-requires-no-reference/6919>\
**Category:** Support & Discussions\
**Tags:** eeg, epochs\
**Created:** [May 18, 2023, 10:48am UTC](https://mne.discourse.group/t/mne-connectivity-spectral-connectivity-epochs-results-in-error-after-upgrading-mne-requires-no-reference/6919 "2023-05-18T10:48:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![TijmenWartenberg](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/tijmenwartenberg/32/913_2.png) [@TijmenWartenberg](https://mne.discourse.group/u/TijmenWartenberg)\
**Post date:** [May 18, 2023, 10:48am UTC](https://mne.discourse.group/t/mne-connectivity-spectral-connectivity-epochs-results-in-error-after-upgrading-mne-requires-no-reference/6919/1 "2023-05-18T10:48:17Z")

</div>

MNE\_version: 1.5  
mne-connectivity: 0.5  
System: Windows 10

So I have recently upgraded my mne version from 1.1 to 1.5. However, after the upgrade exectution of my code for computing spectral connectivity yields an error.  
if \_electrode\_types(info) and info.get(‘custom\_ref\_applied’, False):  
raise ValueError('Custom EEG reference is not allowed for inverse ’  
‘modeling.’)  
I checked the error and noticed that the error could be caused by the fact that the function \_check\_reference is called within mne.minimum\_norm.inverse. apply\_inverse\_epochs\_gen from versions 1.2\> while this wasn’t the case in 1.0 and 1.1.

What are the implications of this change and how do I make the following code work in current version of MNE?

```python
con = mne_connectivity.spectral_connectivity_epochs(
        label_ts, method=con_methods, mode='multitaper', sfreq=sfreq, fmin=fmin,
        fmax = fmax, faverage=True, mt_adaptive=True, n_jobs=-1, verbose = 'ERROR')

```

My reference is set to average projection:  
` raw.set_eeg_reference(projection=False)`

---

<div class="post-metadata">

**Author:** ![TijmenWartenberg](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/tijmenwartenberg/32/913_2.png) [@TijmenWartenberg](https://mne.discourse.group/u/TijmenWartenberg)\
**Post date:** [May 18, 2023, 2:00pm UTC](https://mne.discourse.group/t/mne-connectivity-spectral-connectivity-epochs-results-in-error-after-upgrading-mne-requires-no-reference/6919/2 "2023-05-18T14:00:58Z")

</div>

I solved this by setting projection = True and applying the projection with apply\_proj later.

But in my opinion the error should not be raised when setting the projection to False as the data manipulation is mathematically not different. Setting the projection to False and using average reference, will always yield an error now, because the reference is not recognized as such (but as custom reference). This is confusing to me and perhaps other users as well.

I highly recommend updating this in the next version of mne.
