# Problem with Compute coherence in source space MNE Example

**URL:** <https://mne.discourse.group/t/problem-with-compute-coherence-in-source-space-mne-example/7316>\
**Category:** Support & Discussions\
**Tags:** ﻿source-localization, eeg, connectivity\
**Created:** [August 3, 2023, 12:52am UTC](https://mne.discourse.group/t/problem-with-compute-coherence-in-source-space-mne-example/7316 "2023-08-03T00:52:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MiguelNeves](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@MiguelNeves](https://mne.discourse.group/u/MiguelNeves)\
**Post date:** [August 3, 2023, 12:52am UTC](https://mne.discourse.group/t/problem-with-compute-coherence-in-source-space-mne-example/7316/1 "2023-08-03T00:52:05Z")

</div>

Hi guys!  
I’m kind of new to MNE and I’m still getting the hang of a few things :)~  
I was trying to follow the example [Compute coherence in source space using a MNE inverse solution — MNE-Connectivity 0.5.0 documentation](https://mne.tools/mne-connectivity/stable/auto_examples/mne_inverse_coherence_epochs.html)

but I keep getting problems when calculating my channel sources…  
I’m using EEG data with 63 channels and I’ve calculated the inverse operator with the EEG forward operator example.

the code I have is this:

```python
fwd = mne.make_forward_solution(
    raw.info, trans=trans, src=src, bem=bem, eeg=True, mindist=5.0, n_jobs=None
)
inverse_operator = make_inverse_operator(raw.info, fwd, cov, loose=0.0, depth=0.8, verbose=True)
# Read epochs.
epochs = mne.make_fixed_length_epochs(raw, duration=15)

#%%

snr = 3.0
lambda2 = 1.0 / snr ** 2
evoked = epochs.average()
stc = apply_inverse(evoked, inverse_operator, lambda2, method=method, verbose=True,pick_ori="normal")

```

I am getting the error message in the last line - “cannot reshape array of size 61452 into shape (20484,3,3)”  
and I dont understand how to fix this ☹ does anyone know what I should do? Thanks!!

- MNE version: e.g. 1.4.0
- operating system: Windows 10

---

<div class="post-metadata">

**Author:** ![agramfort](https://avatars.discourse-cdn.com/v4/letter/a/7c8e57/32.png) [@agramfort](https://mne.discourse.group/u/agramfort)\
**Post date:** [August 8, 2023, 7:40am UTC](https://mne.discourse.group/t/problem-with-compute-coherence-in-source-space-mne-example/7316/2 "2023-08-08T07:40:57Z")

</div>

can you provide the full code? What is fwd and src? Do you have fwd[“src”] that is the same as src?

Alex
