- MNE version: 0.24.0
- operating system: MacOS 11.6.1
I’m familiarizing myself with the
spectral_connectivity command when method=‘coh’ and mode=‘cwt_morlet’ and have two questions.
Q1: Is the result obtained obtained using these selected options the same as the usual wavelet coherence?
My second question can be phrased using an example such as that below:
import numpy as np from scipy.signal import chirp from mne.connectivity import spectral_connectivity fs = 1000 L = 2**12 # signal length of 4.096 seconds t = np.arange(0, L) / fs t1=2**8 #data will be formed using three chirp signals w1 = chirp(t, f0=5, f1=25, t1=t1, method="linear") w2=chirp(t, f0=14, f1=7, t1=t1, method="linear") w3=chirp(t, f0=13, f1=8, t1=t1, method="linear") data=np.array([w1,w2,w3]) #size 3-by-4096 data=np.expand_dims(data, axis=0) fmin=5 fmax=30 cwt_freqs=np.array(np.arange(0,fs/2,1)) W,freqs,times,n_epochs,n_tapers=spectral_connectivity(data,sfreq=fs, method='coh',mode='cwt_morlet',cwt_freqs=cwt_freqs,fmin=fmin, fmax=fmax, faverage=False )
In the output,
times lists the 4096 times, and
freqs includes the 26 frequencies in
cwt_freqs that are between 5 and 30. The array
W has size 3-by-3-by-26-by-4096. For each frequency
f and each time
W(:,:,f,t) is a 3-by-3 lower triangular matrix, whose values below the diagonal completely determine the entries corresponding to the actual coherence matrix. This all makes sense to me.
However, for the example above, and others I’ve considered, my results yield a
W whose lower triangular values all equal one regardless of
t. This does not make sense to me, as I would expect some entries strictly less than one, as happens, say, when
mode=multitaper, in which case the frequency-averaged (
faverage=True) result is
[[0. 0. 0. ]
[0.7886259 0. 0. ]
[0.76379543 0.85283805 0. ]]
Q2. What am I missing/misinterpreting above when I try to use the