Thank you for your information!

I have a note/question to make on the Magnitude Squared Coherence algorithm. I do not know if this is the right place for it, but I rather make all my contacts regarding the functional connectivity algorithms in a single place!

In the definition of the Magnitude Squared Coherence there is in the implementation:

**Code:**

const VectorXd l_vecXdCoherenceNum = (m_vecXcdCrossSpectrum.real().cwiseProduct(m_vecXcdCrossSpectrum.conjugate())).real();

This means we take the real part of the Cross Spectrum Sxy and multiply by the real part of the conjugate of Sxy. However, I think this might not be a good approach since, considering a very simple case of:

- x being a sine wave (Sx = Ax*e^iPx, where Ax is the amplitude and Px the phase of Spectrum for a given frequency)
- y the same sine wave shifted by 90 degrees

Then we would expect high coherence (there is only a delay but the signals are the same), but since through the above implementation we obtain Sxy = Ax*Ay*e^i*PI/2 = i*Ax*Ay , when we take the real part the Coherence vanishes.

Instead, we should make something like:

**Code:**

const VectorXd l_vecXdCoherenceNum = m_vecXcdCrossSpectrum.cwiseProduct((m_vecXcdCrossSpectrum.conjugate()).real();

That is, we take the real part only of the product of Sxy by its conjugate.

Sorry for the long exposure

Some feedback on this would be great!