Interpretation of spectral_connectivity output for weighted phase lag index (wpli) computation

Hi everyone,
I’m currently trying to compute weighted phase lag indices using the mne.connectivity.spectral_connectivity() function. I’d like to do this for 2 channels from 1 epoch for 31 frequencies and so far, everything works, but I’m not sure how to interpret the output.

This is what I did:
I have to arrays (x and y) with data from the same epoch, each array with length = 1501, and I concatenated them like this so I get an numpy array with shape (1, 2, 1501):

wpli_data = np.array([x, y])
# add third axis                 
wpli_data = wpli_data[newaxis, :, :]

Then I computed the WPLIs like this:

wpli, freqs, times, n_epochs, n_tapers = mne.connectivity.spectral_connectivity(data = wpli_data,
                                                                                                                               method = 'wpli',
                                                                                                                               sfreq = 500, 
                                                                                                                               mode = 'fourier', 
                                                                                                                               fmin = 4,
                                                                                                                               fmax = 35,
                                                                                                                               fskip = 2)

My “con” output has the shape (2, 2, 31) and looks like this:

array([[[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
         0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.],
        [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
         0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]],

       [[1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
         1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
        [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
         0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]]])

There are 3 things I don’t get:

  1. Why do I have 4 arrays with values for each frequency?

  2. I read that the WPLI values lie somewhere between 0 and 1, but what exactly does a value of 1 or 0 mean?

  3. If I use data from another epoch or other channels, the result always looks like the example above: Only zeros except for one array where there are only ones. Does this make sense, did I make a mistake or is it a bug?

I’d be really happy if anyone could give me a hint! Thanks in advance! :blush:

Hello @Merle, did you manage to figure this out? :slight_smile: