Comparing PLI, wPLI, and dPLI#

This example demonstrates the different connectivity information captured by the phase lag index (PLI) [1], weighted phase lag index (wPLI) [2], and directed phase lag index (dPLI) [3] on simulated data.

# Authors: Kenji Marshall <kenji.marshall99@gmail.com>
#          Charlotte Maschke <charlotte.maschke@mail.mcgill.ca>
#          Stefanie Blain-Moraes <stefanie.blain-moraes@mcgill.ca>
#
# License: BSD (3-clause)


import matplotlib.pyplot as plt
import mne
import numpy as np
from mne.datasets import sample

from mne_connectivity import spectral_connectivity_epochs

Background#

The formulae for PLI, wPLI, and dPLI are given below. In these equations, \(X_{ij}\) is the cross-spectral density (CSD) between two signals \(i, j\). Importantly, the imaginary component of the CSD is maximal when the signals have a phase difference given by \(k\pi+\frac{\pi}{2}\), and is \(0\) when the phase difference is given by \(k\pi\) (where \(k \in \mathbb{Z}\)). This property provides protection against recognizing volume conduction effects as connectivity, and is the backbone for these methods [2]. In the equations below, \(\mathcal{I}\) refers to the imaginary component, \(\mathcal{H}\) refers to the Heaviside step function, and \(sgn\) refers to the sign function.

\(PLI = |E[sgn(\mathcal{I}(X_{ij}))]|\) [1]

\(wPLI = \frac{|E[\mathcal{I}(X_{ij})]|}{E[|\mathcal{I}(X_{ij})|]}\) [2]

\(dPLI = E[\mathcal{H}(\mathcal{I}(X_{ij}))]\) [3]

All three of these metrics are bounded in the range \([0, 1]\).

  • For PLI, \(0\) means that signal \(i\) leads and lags signal \(j\) equally often, while a value greater than \(0\) means that there is an imbalance in the likelihood for signal \(i\) to be leading or lagging. A value of \(1\) means that signal \(i\) only leads or only lags signal \(j\).

  • For wPLI, \(0\) means that the total weight (not the quantity) of all leading relationships equals the total weight of lagging relationships, while a value greater than \(0\) means that there is an imbalance between these weights. A value of \(1\), just as in PLI, means that signal \(i\) only leads or only lags signal \(j\).

  • With dPLI, we gain the ability to distinguish whether signal \(i\) is leading or lagging signal \(j\), complementing the information provided by PLI or wPLI. A value of \(0.5\) means that signal \(i\) leads and lags signal \(j\) equally often. A value in the range \((0.5, 1.0]\) means that signal \(i\) leads signal \(j\) more often than it lags, with a value of \(1\) meaning that signal \(i\) always leads signal \(j\). A value in the range \([0.0, 0.5)\) means that signal \(i\) lags signal \(j\) more often than it leads, with a value of \(0\) meaning that signal \(i\) always lags signal \(j\). The PLI can actually be extracted from the dPLI by the relationship \(PLI = 2|dPLI - 0.5|\), but this relationship is not invertible (dPLI can not be estimated from the PLI).

Overall, these different approaches are closely related but have subtle differences, as will be demonstrated throughout the rest of this example.

Capturing Leading/Lagging Phase Relationships with dPLI#

The main advantage of dPLI is that it’s directed, meaning it can differentiate between phase relationships which are leading or lagging. To illustrate this, we generate sinusoids with Gaussian noise. In particular, we generate signals with phase differences of \([-\pi, -\frac{\pi}{2}, 0, \frac{\pi}{2}, \pi]\) relative to a reference signal. A negative difference means that the reference signal is lagging the other signal.

fs = 250  # sampling rate (Hz)
n_e = 300  # number of epochs
T = 10  # length of epochs (s)
f = 10  # frequency of sinusoids (Hz)
t = np.arange(0, T, 1 / fs)
A = 1  # noise amplitude
sigma = 0.5  # Gaussian noise variance

data = []

phase_differences = [0, -np.pi, -np.pi / 2, 0, np.pi / 2, np.pi]
for ps in zip(phase_differences):
    sig = []
    for _ in range(n_e):
        sig.append(
            np.sin(2 * np.pi * f * t - ps)
            + A * np.random.normal(0, sigma, size=t.shape)
        )
    data.append(sig)

data = np.swapaxes(np.array(data), 0, 1)  # make epochs the first dimension

A snippet of this simulated data is shown below. The blue signal is the reference signal.

fig, ax = plt.subplots(1, 2, figsize=(12, 5), sharey=True)
ax[0].plot(t[:fs], data[0, 0, :fs], label="Reference")
ax[0].plot(t[:fs], data[0, 2, :fs])

ax[0].set_title(r"Phase Lagging ($-\pi/2$ Phase Difference)")
ax[0].set_xlabel("Time (s)")
ax[0].set_ylabel("Signal")
ax[0].legend()

ax[1].plot(t[:fs], data[0, 0, :fs], label="Reference")
ax[1].plot(t[:fs], data[0, 4, :fs])
ax[1].set_title(r"Phase Leading ($\pi/2$ Phase Difference)")
ax[1].set_xlabel("Time (s)")

plt.show()
Phase Lagging ($-\pi/2$ Phase Difference), Phase Leading ($\pi/2$ Phase Difference)

We will now compute PLI, wPLI, and dPLI for each phase relationship.

conn = []
indices = ([0, 0, 0, 0, 0], [1, 2, 3, 4, 5])
for method in ["pli", "wpli", "dpli"]:
    conn.append(
        spectral_connectivity_epochs(
            data,
            method=method,
            sfreq=fs,
            indices=indices,
            fmin=9,
            fmax=11,
            faverage=True,
        ).get_data()[:, 0]
    )
conn = np.array(conn)
Connectivity computation...
    using t=0.000s..9.996s for estimation (2500 points)
    frequencies: 9.0Hz..11.0Hz (21 points)
    connectivity scores will be averaged for each band
    computing connectivity for 5 connections
    Using multitaper spectrum estimation with 7 DPSS windows
    the following metrics will be computed: PLI
    computing cross-spectral density for epoch 1
    computing cross-spectral density for epoch 2
    computing cross-spectral density for epoch 3
    computing cross-spectral density for epoch 4
    computing cross-spectral density for epoch 5
    computing cross-spectral density for epoch 6
    computing cross-spectral density for epoch 7
    computing cross-spectral density for epoch 8
    computing cross-spectral density for epoch 9
    computing cross-spectral density for epoch 10
    computing cross-spectral density for epoch 11
    computing cross-spectral density for epoch 12
    computing cross-spectral density for epoch 13
    computing cross-spectral density for epoch 14
    computing cross-spectral density for epoch 15
    computing cross-spectral density for epoch 16
    computing cross-spectral density for epoch 17
    computing cross-spectral density for epoch 18
    computing cross-spectral density for epoch 19
    computing cross-spectral density for epoch 20
    computing cross-spectral density for epoch 21
    computing cross-spectral density for epoch 22
    computing cross-spectral density for epoch 23
    computing cross-spectral density for epoch 24
    computing cross-spectral density for epoch 25
    computing cross-spectral density for epoch 26
    computing cross-spectral density for epoch 27
    computing cross-spectral density for epoch 28
    computing cross-spectral density for epoch 29
    computing cross-spectral density for epoch 30
    computing cross-spectral density for epoch 31
    computing cross-spectral density for epoch 32
    computing cross-spectral density for epoch 33
    computing cross-spectral density for epoch 34
    computing cross-spectral density for epoch 35
    computing cross-spectral density for epoch 36
    computing cross-spectral density for epoch 37
    computing cross-spectral density for epoch 38
    computing cross-spectral density for epoch 39
    computing cross-spectral density for epoch 40
    computing cross-spectral density for epoch 41
    computing cross-spectral density for epoch 42
    computing cross-spectral density for epoch 43
    computing cross-spectral density for epoch 44
    computing cross-spectral density for epoch 45
    computing cross-spectral density for epoch 46
    computing cross-spectral density for epoch 47
    computing cross-spectral density for epoch 48
    computing cross-spectral density for epoch 49
    computing cross-spectral density for epoch 50
    computing cross-spectral density for epoch 51
    computing cross-spectral density for epoch 52
    computing cross-spectral density for epoch 53
    computing cross-spectral density for epoch 54
    computing cross-spectral density for epoch 55
    computing cross-spectral density for epoch 56
    computing cross-spectral density for epoch 57
    computing cross-spectral density for epoch 58
    computing cross-spectral density for epoch 59
    computing cross-spectral density for epoch 60
    computing cross-spectral density for epoch 61
    computing cross-spectral density for epoch 62
    computing cross-spectral density for epoch 63
    computing cross-spectral density for epoch 64
    computing cross-spectral density for epoch 65
    computing cross-spectral density for epoch 66
    computing cross-spectral density for epoch 67
    computing cross-spectral density for epoch 68
    computing cross-spectral density for epoch 69
    computing cross-spectral density for epoch 70
    computing cross-spectral density for epoch 71
    computing cross-spectral density for epoch 72
    computing cross-spectral density for epoch 73
    computing cross-spectral density for epoch 74
    computing cross-spectral density for epoch 75
    computing cross-spectral density for epoch 76
    computing cross-spectral density for epoch 77
    computing cross-spectral density for epoch 78
    computing cross-spectral density for epoch 79
    computing cross-spectral density for epoch 80
    computing cross-spectral density for epoch 81
    computing cross-spectral density for epoch 82
    computing cross-spectral density for epoch 83
    computing cross-spectral density for epoch 84
    computing cross-spectral density for epoch 85
    computing cross-spectral density for epoch 86
    computing cross-spectral density for epoch 87
    computing cross-spectral density for epoch 88
    computing cross-spectral density for epoch 89
    computing cross-spectral density for epoch 90
    computing cross-spectral density for epoch 91
    computing cross-spectral density for epoch 92
    computing cross-spectral density for epoch 93
    computing cross-spectral density for epoch 94
    computing cross-spectral density for epoch 95
    computing cross-spectral density for epoch 96
    computing cross-spectral density for epoch 97
    computing cross-spectral density for epoch 98
    computing cross-spectral density for epoch 99
    computing cross-spectral density for epoch 100
    computing cross-spectral density for epoch 101
    computing cross-spectral density for epoch 102
    computing cross-spectral density for epoch 103
    computing cross-spectral density for epoch 104
    computing cross-spectral density for epoch 105
    computing cross-spectral density for epoch 106
    computing cross-spectral density for epoch 107
    computing cross-spectral density for epoch 108
    computing cross-spectral density for epoch 109
    computing cross-spectral density for epoch 110
    computing cross-spectral density for epoch 111
    computing cross-spectral density for epoch 112
    computing cross-spectral density for epoch 113
    computing cross-spectral density for epoch 114
    computing cross-spectral density for epoch 115
    computing cross-spectral density for epoch 116
    computing cross-spectral density for epoch 117
    computing cross-spectral density for epoch 118
    computing cross-spectral density for epoch 119
    computing cross-spectral density for epoch 120
    computing cross-spectral density for epoch 121
    computing cross-spectral density for epoch 122
    computing cross-spectral density for epoch 123
    computing cross-spectral density for epoch 124
    computing cross-spectral density for epoch 125
    computing cross-spectral density for epoch 126
    computing cross-spectral density for epoch 127
    computing cross-spectral density for epoch 128
    computing cross-spectral density for epoch 129
    computing cross-spectral density for epoch 130
    computing cross-spectral density for epoch 131
    computing cross-spectral density for epoch 132
    computing cross-spectral density for epoch 133
    computing cross-spectral density for epoch 134
    computing cross-spectral density for epoch 135
    computing cross-spectral density for epoch 136
    computing cross-spectral density for epoch 137
    computing cross-spectral density for epoch 138
    computing cross-spectral density for epoch 139
    computing cross-spectral density for epoch 140
    computing cross-spectral density for epoch 141
    computing cross-spectral density for epoch 142
    computing cross-spectral density for epoch 143
    computing cross-spectral density for epoch 144
    computing cross-spectral density for epoch 145
    computing cross-spectral density for epoch 146
    computing cross-spectral density for epoch 147
    computing cross-spectral density for epoch 148
    computing cross-spectral density for epoch 149
    computing cross-spectral density for epoch 150
    computing cross-spectral density for epoch 151
    computing cross-spectral density for epoch 152
    computing cross-spectral density for epoch 153
    computing cross-spectral density for epoch 154
    computing cross-spectral density for epoch 155
    computing cross-spectral density for epoch 156
    computing cross-spectral density for epoch 157
    computing cross-spectral density for epoch 158
    computing cross-spectral density for epoch 159
    computing cross-spectral density for epoch 160
    computing cross-spectral density for epoch 161
    computing cross-spectral density for epoch 162
    computing cross-spectral density for epoch 163
    computing cross-spectral density for epoch 164
    computing cross-spectral density for epoch 165
    computing cross-spectral density for epoch 166
    computing cross-spectral density for epoch 167
    computing cross-spectral density for epoch 168
    computing cross-spectral density for epoch 169
    computing cross-spectral density for epoch 170
    computing cross-spectral density for epoch 171
    computing cross-spectral density for epoch 172
    computing cross-spectral density for epoch 173
    computing cross-spectral density for epoch 174
    computing cross-spectral density for epoch 175
    computing cross-spectral density for epoch 176
    computing cross-spectral density for epoch 177
    computing cross-spectral density for epoch 178
    computing cross-spectral density for epoch 179
    computing cross-spectral density for epoch 180
    computing cross-spectral density for epoch 181
    computing cross-spectral density for epoch 182
    computing cross-spectral density for epoch 183
    computing cross-spectral density for epoch 184
    computing cross-spectral density for epoch 185
    computing cross-spectral density for epoch 186
    computing cross-spectral density for epoch 187
    computing cross-spectral density for epoch 188
    computing cross-spectral density for epoch 189
    computing cross-spectral density for epoch 190
    computing cross-spectral density for epoch 191
    computing cross-spectral density for epoch 192
    computing cross-spectral density for epoch 193
    computing cross-spectral density for epoch 194
    computing cross-spectral density for epoch 195
    computing cross-spectral density for epoch 196
    computing cross-spectral density for epoch 197
    computing cross-spectral density for epoch 198
    computing cross-spectral density for epoch 199
    computing cross-spectral density for epoch 200
    computing cross-spectral density for epoch 201
    computing cross-spectral density for epoch 202
    computing cross-spectral density for epoch 203
    computing cross-spectral density for epoch 204
    computing cross-spectral density for epoch 205
    computing cross-spectral density for epoch 206
    computing cross-spectral density for epoch 207
    computing cross-spectral density for epoch 208
    computing cross-spectral density for epoch 209
    computing cross-spectral density for epoch 210
    computing cross-spectral density for epoch 211
    computing cross-spectral density for epoch 212
    computing cross-spectral density for epoch 213
    computing cross-spectral density for epoch 214
    computing cross-spectral density for epoch 215
    computing cross-spectral density for epoch 216
    computing cross-spectral density for epoch 217
    computing cross-spectral density for epoch 218
    computing cross-spectral density for epoch 219
    computing cross-spectral density for epoch 220
    computing cross-spectral density for epoch 221
    computing cross-spectral density for epoch 222
    computing cross-spectral density for epoch 223
    computing cross-spectral density for epoch 224
    computing cross-spectral density for epoch 225
    computing cross-spectral density for epoch 226
    computing cross-spectral density for epoch 227
    computing cross-spectral density for epoch 228
    computing cross-spectral density for epoch 229
    computing cross-spectral density for epoch 230
    computing cross-spectral density for epoch 231
    computing cross-spectral density for epoch 232
    computing cross-spectral density for epoch 233
    computing cross-spectral density for epoch 234
    computing cross-spectral density for epoch 235
    computing cross-spectral density for epoch 236
    computing cross-spectral density for epoch 237
    computing cross-spectral density for epoch 238
    computing cross-spectral density for epoch 239
    computing cross-spectral density for epoch 240
    computing cross-spectral density for epoch 241
    computing cross-spectral density for epoch 242
    computing cross-spectral density for epoch 243
    computing cross-spectral density for epoch 244
    computing cross-spectral density for epoch 245
    computing cross-spectral density for epoch 246
    computing cross-spectral density for epoch 247
    computing cross-spectral density for epoch 248
    computing cross-spectral density for epoch 249
    computing cross-spectral density for epoch 250
    computing cross-spectral density for epoch 251
    computing cross-spectral density for epoch 252
    computing cross-spectral density for epoch 253
    computing cross-spectral density for epoch 254
    computing cross-spectral density for epoch 255
    computing cross-spectral density for epoch 256
    computing cross-spectral density for epoch 257
    computing cross-spectral density for epoch 258
    computing cross-spectral density for epoch 259
    computing cross-spectral density for epoch 260
    computing cross-spectral density for epoch 261
    computing cross-spectral density for epoch 262
    computing cross-spectral density for epoch 263
    computing cross-spectral density for epoch 264
    computing cross-spectral density for epoch 265
    computing cross-spectral density for epoch 266
    computing cross-spectral density for epoch 267
    computing cross-spectral density for epoch 268
    computing cross-spectral density for epoch 269
    computing cross-spectral density for epoch 270
    computing cross-spectral density for epoch 271
    computing cross-spectral density for epoch 272
    computing cross-spectral density for epoch 273
    computing cross-spectral density for epoch 274
    computing cross-spectral density for epoch 275
    computing cross-spectral density for epoch 276
    computing cross-spectral density for epoch 277
    computing cross-spectral density for epoch 278
    computing cross-spectral density for epoch 279
    computing cross-spectral density for epoch 280
    computing cross-spectral density for epoch 281
    computing cross-spectral density for epoch 282
    computing cross-spectral density for epoch 283
    computing cross-spectral density for epoch 284
    computing cross-spectral density for epoch 285
    computing cross-spectral density for epoch 286
    computing cross-spectral density for epoch 287
    computing cross-spectral density for epoch 288
    computing cross-spectral density for epoch 289
    computing cross-spectral density for epoch 290
    computing cross-spectral density for epoch 291
    computing cross-spectral density for epoch 292
    computing cross-spectral density for epoch 293
    computing cross-spectral density for epoch 294
    computing cross-spectral density for epoch 295
    computing cross-spectral density for epoch 296
    computing cross-spectral density for epoch 297
    computing cross-spectral density for epoch 298
    computing cross-spectral density for epoch 299
    computing cross-spectral density for epoch 300
[Connectivity computation done]
Connectivity computation...
    using t=0.000s..9.996s for estimation (2500 points)
    frequencies: 9.0Hz..11.0Hz (21 points)
    connectivity scores will be averaged for each band
    computing connectivity for 5 connections
    Using multitaper spectrum estimation with 7 DPSS windows
    the following metrics will be computed: WPLI
    computing cross-spectral density for epoch 1
    computing cross-spectral density for epoch 2
    computing cross-spectral density for epoch 3
    computing cross-spectral density for epoch 4
    computing cross-spectral density for epoch 5
    computing cross-spectral density for epoch 6
    computing cross-spectral density for epoch 7
    computing cross-spectral density for epoch 8
    computing cross-spectral density for epoch 9
    computing cross-spectral density for epoch 10
    computing cross-spectral density for epoch 11
    computing cross-spectral density for epoch 12
    computing cross-spectral density for epoch 13
    computing cross-spectral density for epoch 14
    computing cross-spectral density for epoch 15
    computing cross-spectral density for epoch 16
    computing cross-spectral density for epoch 17
    computing cross-spectral density for epoch 18
    computing cross-spectral density for epoch 19
    computing cross-spectral density for epoch 20
    computing cross-spectral density for epoch 21
    computing cross-spectral density for epoch 22
    computing cross-spectral density for epoch 23
    computing cross-spectral density for epoch 24
    computing cross-spectral density for epoch 25
    computing cross-spectral density for epoch 26
    computing cross-spectral density for epoch 27
    computing cross-spectral density for epoch 28
    computing cross-spectral density for epoch 29
    computing cross-spectral density for epoch 30
    computing cross-spectral density for epoch 31
    computing cross-spectral density for epoch 32
    computing cross-spectral density for epoch 33
    computing cross-spectral density for epoch 34
    computing cross-spectral density for epoch 35
    computing cross-spectral density for epoch 36
    computing cross-spectral density for epoch 37
    computing cross-spectral density for epoch 38
    computing cross-spectral density for epoch 39
    computing cross-spectral density for epoch 40
    computing cross-spectral density for epoch 41
    computing cross-spectral density for epoch 42
    computing cross-spectral density for epoch 43
    computing cross-spectral density for epoch 44
    computing cross-spectral density for epoch 45
    computing cross-spectral density for epoch 46
    computing cross-spectral density for epoch 47
    computing cross-spectral density for epoch 48
    computing cross-spectral density for epoch 49
    computing cross-spectral density for epoch 50
    computing cross-spectral density for epoch 51
    computing cross-spectral density for epoch 52
    computing cross-spectral density for epoch 53
    computing cross-spectral density for epoch 54
    computing cross-spectral density for epoch 55
    computing cross-spectral density for epoch 56
    computing cross-spectral density for epoch 57
    computing cross-spectral density for epoch 58
    computing cross-spectral density for epoch 59
    computing cross-spectral density for epoch 60
    computing cross-spectral density for epoch 61
    computing cross-spectral density for epoch 62
    computing cross-spectral density for epoch 63
    computing cross-spectral density for epoch 64
    computing cross-spectral density for epoch 65
    computing cross-spectral density for epoch 66
    computing cross-spectral density for epoch 67
    computing cross-spectral density for epoch 68
    computing cross-spectral density for epoch 69
    computing cross-spectral density for epoch 70
    computing cross-spectral density for epoch 71
    computing cross-spectral density for epoch 72
    computing cross-spectral density for epoch 73
    computing cross-spectral density for epoch 74
    computing cross-spectral density for epoch 75
    computing cross-spectral density for epoch 76
    computing cross-spectral density for epoch 77
    computing cross-spectral density for epoch 78
    computing cross-spectral density for epoch 79
    computing cross-spectral density for epoch 80
    computing cross-spectral density for epoch 81
    computing cross-spectral density for epoch 82
    computing cross-spectral density for epoch 83
    computing cross-spectral density for epoch 84
    computing cross-spectral density for epoch 85
    computing cross-spectral density for epoch 86
    computing cross-spectral density for epoch 87
    computing cross-spectral density for epoch 88
    computing cross-spectral density for epoch 89
    computing cross-spectral density for epoch 90
    computing cross-spectral density for epoch 91
    computing cross-spectral density for epoch 92
    computing cross-spectral density for epoch 93
    computing cross-spectral density for epoch 94
    computing cross-spectral density for epoch 95
    computing cross-spectral density for epoch 96
    computing cross-spectral density for epoch 97
    computing cross-spectral density for epoch 98
    computing cross-spectral density for epoch 99
    computing cross-spectral density for epoch 100
    computing cross-spectral density for epoch 101
    computing cross-spectral density for epoch 102
    computing cross-spectral density for epoch 103
    computing cross-spectral density for epoch 104
    computing cross-spectral density for epoch 105
    computing cross-spectral density for epoch 106
    computing cross-spectral density for epoch 107
    computing cross-spectral density for epoch 108
    computing cross-spectral density for epoch 109
    computing cross-spectral density for epoch 110
    computing cross-spectral density for epoch 111
    computing cross-spectral density for epoch 112
    computing cross-spectral density for epoch 113
    computing cross-spectral density for epoch 114
    computing cross-spectral density for epoch 115
    computing cross-spectral density for epoch 116
    computing cross-spectral density for epoch 117
    computing cross-spectral density for epoch 118
    computing cross-spectral density for epoch 119
    computing cross-spectral density for epoch 120
    computing cross-spectral density for epoch 121
    computing cross-spectral density for epoch 122
    computing cross-spectral density for epoch 123
    computing cross-spectral density for epoch 124
    computing cross-spectral density for epoch 125
    computing cross-spectral density for epoch 126
    computing cross-spectral density for epoch 127
    computing cross-spectral density for epoch 128
    computing cross-spectral density for epoch 129
    computing cross-spectral density for epoch 130
    computing cross-spectral density for epoch 131
    computing cross-spectral density for epoch 132
    computing cross-spectral density for epoch 133
    computing cross-spectral density for epoch 134
    computing cross-spectral density for epoch 135
    computing cross-spectral density for epoch 136
    computing cross-spectral density for epoch 137
    computing cross-spectral density for epoch 138
    computing cross-spectral density for epoch 139
    computing cross-spectral density for epoch 140
    computing cross-spectral density for epoch 141
    computing cross-spectral density for epoch 142
    computing cross-spectral density for epoch 143
    computing cross-spectral density for epoch 144
    computing cross-spectral density for epoch 145
    computing cross-spectral density for epoch 146
    computing cross-spectral density for epoch 147
    computing cross-spectral density for epoch 148
    computing cross-spectral density for epoch 149
    computing cross-spectral density for epoch 150
    computing cross-spectral density for epoch 151
    computing cross-spectral density for epoch 152
    computing cross-spectral density for epoch 153
    computing cross-spectral density for epoch 154
    computing cross-spectral density for epoch 155
    computing cross-spectral density for epoch 156
    computing cross-spectral density for epoch 157
    computing cross-spectral density for epoch 158
    computing cross-spectral density for epoch 159
    computing cross-spectral density for epoch 160
    computing cross-spectral density for epoch 161
    computing cross-spectral density for epoch 162
    computing cross-spectral density for epoch 163
    computing cross-spectral density for epoch 164
    computing cross-spectral density for epoch 165
    computing cross-spectral density for epoch 166
    computing cross-spectral density for epoch 167
    computing cross-spectral density for epoch 168
    computing cross-spectral density for epoch 169
    computing cross-spectral density for epoch 170
    computing cross-spectral density for epoch 171
    computing cross-spectral density for epoch 172
    computing cross-spectral density for epoch 173
    computing cross-spectral density for epoch 174
    computing cross-spectral density for epoch 175
    computing cross-spectral density for epoch 176
    computing cross-spectral density for epoch 177
    computing cross-spectral density for epoch 178
    computing cross-spectral density for epoch 179
    computing cross-spectral density for epoch 180
    computing cross-spectral density for epoch 181
    computing cross-spectral density for epoch 182
    computing cross-spectral density for epoch 183
    computing cross-spectral density for epoch 184
    computing cross-spectral density for epoch 185
    computing cross-spectral density for epoch 186
    computing cross-spectral density for epoch 187
    computing cross-spectral density for epoch 188
    computing cross-spectral density for epoch 189
    computing cross-spectral density for epoch 190
    computing cross-spectral density for epoch 191
    computing cross-spectral density for epoch 192
    computing cross-spectral density for epoch 193
    computing cross-spectral density for epoch 194
    computing cross-spectral density for epoch 195
    computing cross-spectral density for epoch 196
    computing cross-spectral density for epoch 197
    computing cross-spectral density for epoch 198
    computing cross-spectral density for epoch 199
    computing cross-spectral density for epoch 200
    computing cross-spectral density for epoch 201
    computing cross-spectral density for epoch 202
    computing cross-spectral density for epoch 203
    computing cross-spectral density for epoch 204
    computing cross-spectral density for epoch 205
    computing cross-spectral density for epoch 206
    computing cross-spectral density for epoch 207
    computing cross-spectral density for epoch 208
    computing cross-spectral density for epoch 209
    computing cross-spectral density for epoch 210
    computing cross-spectral density for epoch 211
    computing cross-spectral density for epoch 212
    computing cross-spectral density for epoch 213
    computing cross-spectral density for epoch 214
    computing cross-spectral density for epoch 215
    computing cross-spectral density for epoch 216
    computing cross-spectral density for epoch 217
    computing cross-spectral density for epoch 218
    computing cross-spectral density for epoch 219
    computing cross-spectral density for epoch 220
    computing cross-spectral density for epoch 221
    computing cross-spectral density for epoch 222
    computing cross-spectral density for epoch 223
    computing cross-spectral density for epoch 224
    computing cross-spectral density for epoch 225
    computing cross-spectral density for epoch 226
    computing cross-spectral density for epoch 227
    computing cross-spectral density for epoch 228
    computing cross-spectral density for epoch 229
    computing cross-spectral density for epoch 230
    computing cross-spectral density for epoch 231
    computing cross-spectral density for epoch 232
    computing cross-spectral density for epoch 233
    computing cross-spectral density for epoch 234
    computing cross-spectral density for epoch 235
    computing cross-spectral density for epoch 236
    computing cross-spectral density for epoch 237
    computing cross-spectral density for epoch 238
    computing cross-spectral density for epoch 239
    computing cross-spectral density for epoch 240
    computing cross-spectral density for epoch 241
    computing cross-spectral density for epoch 242
    computing cross-spectral density for epoch 243
    computing cross-spectral density for epoch 244
    computing cross-spectral density for epoch 245
    computing cross-spectral density for epoch 246
    computing cross-spectral density for epoch 247
    computing cross-spectral density for epoch 248
    computing cross-spectral density for epoch 249
    computing cross-spectral density for epoch 250
    computing cross-spectral density for epoch 251
    computing cross-spectral density for epoch 252
    computing cross-spectral density for epoch 253
    computing cross-spectral density for epoch 254
    computing cross-spectral density for epoch 255
    computing cross-spectral density for epoch 256
    computing cross-spectral density for epoch 257
    computing cross-spectral density for epoch 258
    computing cross-spectral density for epoch 259
    computing cross-spectral density for epoch 260
    computing cross-spectral density for epoch 261
    computing cross-spectral density for epoch 262
    computing cross-spectral density for epoch 263
    computing cross-spectral density for epoch 264
    computing cross-spectral density for epoch 265
    computing cross-spectral density for epoch 266
    computing cross-spectral density for epoch 267
    computing cross-spectral density for epoch 268
    computing cross-spectral density for epoch 269
    computing cross-spectral density for epoch 270
    computing cross-spectral density for epoch 271
    computing cross-spectral density for epoch 272
    computing cross-spectral density for epoch 273
    computing cross-spectral density for epoch 274
    computing cross-spectral density for epoch 275
    computing cross-spectral density for epoch 276
    computing cross-spectral density for epoch 277
    computing cross-spectral density for epoch 278
    computing cross-spectral density for epoch 279
    computing cross-spectral density for epoch 280
    computing cross-spectral density for epoch 281
    computing cross-spectral density for epoch 282
    computing cross-spectral density for epoch 283
    computing cross-spectral density for epoch 284
    computing cross-spectral density for epoch 285
    computing cross-spectral density for epoch 286
    computing cross-spectral density for epoch 287
    computing cross-spectral density for epoch 288
    computing cross-spectral density for epoch 289
    computing cross-spectral density for epoch 290
    computing cross-spectral density for epoch 291
    computing cross-spectral density for epoch 292
    computing cross-spectral density for epoch 293
    computing cross-spectral density for epoch 294
    computing cross-spectral density for epoch 295
    computing cross-spectral density for epoch 296
    computing cross-spectral density for epoch 297
    computing cross-spectral density for epoch 298
    computing cross-spectral density for epoch 299
    computing cross-spectral density for epoch 300
[Connectivity computation done]
Connectivity computation...
    using t=0.000s..9.996s for estimation (2500 points)
    frequencies: 9.0Hz..11.0Hz (21 points)
    connectivity scores will be averaged for each band
    computing connectivity for 5 connections
    Using multitaper spectrum estimation with 7 DPSS windows
    the following metrics will be computed: DPLI
    computing cross-spectral density for epoch 1
    computing cross-spectral density for epoch 2
    computing cross-spectral density for epoch 3
    computing cross-spectral density for epoch 4
    computing cross-spectral density for epoch 5
    computing cross-spectral density for epoch 6
    computing cross-spectral density for epoch 7
    computing cross-spectral density for epoch 8
    computing cross-spectral density for epoch 9
    computing cross-spectral density for epoch 10
    computing cross-spectral density for epoch 11
    computing cross-spectral density for epoch 12
    computing cross-spectral density for epoch 13
    computing cross-spectral density for epoch 14
    computing cross-spectral density for epoch 15
    computing cross-spectral density for epoch 16
    computing cross-spectral density for epoch 17
    computing cross-spectral density for epoch 18
    computing cross-spectral density for epoch 19
    computing cross-spectral density for epoch 20
    computing cross-spectral density for epoch 21
    computing cross-spectral density for epoch 22
    computing cross-spectral density for epoch 23
    computing cross-spectral density for epoch 24
    computing cross-spectral density for epoch 25
    computing cross-spectral density for epoch 26
    computing cross-spectral density for epoch 27
    computing cross-spectral density for epoch 28
    computing cross-spectral density for epoch 29
    computing cross-spectral density for epoch 30
    computing cross-spectral density for epoch 31
    computing cross-spectral density for epoch 32
    computing cross-spectral density for epoch 33
    computing cross-spectral density for epoch 34
    computing cross-spectral density for epoch 35
    computing cross-spectral density for epoch 36
    computing cross-spectral density for epoch 37
    computing cross-spectral density for epoch 38
    computing cross-spectral density for epoch 39
    computing cross-spectral density for epoch 40
    computing cross-spectral density for epoch 41
    computing cross-spectral density for epoch 42
    computing cross-spectral density for epoch 43
    computing cross-spectral density for epoch 44
    computing cross-spectral density for epoch 45
    computing cross-spectral density for epoch 46
    computing cross-spectral density for epoch 47
    computing cross-spectral density for epoch 48
    computing cross-spectral density for epoch 49
    computing cross-spectral density for epoch 50
    computing cross-spectral density for epoch 51
    computing cross-spectral density for epoch 52
    computing cross-spectral density for epoch 53
    computing cross-spectral density for epoch 54
    computing cross-spectral density for epoch 55
    computing cross-spectral density for epoch 56
    computing cross-spectral density for epoch 57
    computing cross-spectral density for epoch 58
    computing cross-spectral density for epoch 59
    computing cross-spectral density for epoch 60
    computing cross-spectral density for epoch 61
    computing cross-spectral density for epoch 62
    computing cross-spectral density for epoch 63
    computing cross-spectral density for epoch 64
    computing cross-spectral density for epoch 65
    computing cross-spectral density for epoch 66
    computing cross-spectral density for epoch 67
    computing cross-spectral density for epoch 68
    computing cross-spectral density for epoch 69
    computing cross-spectral density for epoch 70
    computing cross-spectral density for epoch 71
    computing cross-spectral density for epoch 72
    computing cross-spectral density for epoch 73
    computing cross-spectral density for epoch 74
    computing cross-spectral density for epoch 75
    computing cross-spectral density for epoch 76
    computing cross-spectral density for epoch 77
    computing cross-spectral density for epoch 78
    computing cross-spectral density for epoch 79
    computing cross-spectral density for epoch 80
    computing cross-spectral density for epoch 81
    computing cross-spectral density for epoch 82
    computing cross-spectral density for epoch 83
    computing cross-spectral density for epoch 84
    computing cross-spectral density for epoch 85
    computing cross-spectral density for epoch 86
    computing cross-spectral density for epoch 87
    computing cross-spectral density for epoch 88
    computing cross-spectral density for epoch 89
    computing cross-spectral density for epoch 90
    computing cross-spectral density for epoch 91
    computing cross-spectral density for epoch 92
    computing cross-spectral density for epoch 93
    computing cross-spectral density for epoch 94
    computing cross-spectral density for epoch 95
    computing cross-spectral density for epoch 96
    computing cross-spectral density for epoch 97
    computing cross-spectral density for epoch 98
    computing cross-spectral density for epoch 99
    computing cross-spectral density for epoch 100
    computing cross-spectral density for epoch 101
    computing cross-spectral density for epoch 102
    computing cross-spectral density for epoch 103
    computing cross-spectral density for epoch 104
    computing cross-spectral density for epoch 105
    computing cross-spectral density for epoch 106
    computing cross-spectral density for epoch 107
    computing cross-spectral density for epoch 108
    computing cross-spectral density for epoch 109
    computing cross-spectral density for epoch 110
    computing cross-spectral density for epoch 111
    computing cross-spectral density for epoch 112
    computing cross-spectral density for epoch 113
    computing cross-spectral density for epoch 114
    computing cross-spectral density for epoch 115
    computing cross-spectral density for epoch 116
    computing cross-spectral density for epoch 117
    computing cross-spectral density for epoch 118
    computing cross-spectral density for epoch 119
    computing cross-spectral density for epoch 120
    computing cross-spectral density for epoch 121
    computing cross-spectral density for epoch 122
    computing cross-spectral density for epoch 123
    computing cross-spectral density for epoch 124
    computing cross-spectral density for epoch 125
    computing cross-spectral density for epoch 126
    computing cross-spectral density for epoch 127
    computing cross-spectral density for epoch 128
    computing cross-spectral density for epoch 129
    computing cross-spectral density for epoch 130
    computing cross-spectral density for epoch 131
    computing cross-spectral density for epoch 132
    computing cross-spectral density for epoch 133
    computing cross-spectral density for epoch 134
    computing cross-spectral density for epoch 135
    computing cross-spectral density for epoch 136
    computing cross-spectral density for epoch 137
    computing cross-spectral density for epoch 138
    computing cross-spectral density for epoch 139
    computing cross-spectral density for epoch 140
    computing cross-spectral density for epoch 141
    computing cross-spectral density for epoch 142
    computing cross-spectral density for epoch 143
    computing cross-spectral density for epoch 144
    computing cross-spectral density for epoch 145
    computing cross-spectral density for epoch 146
    computing cross-spectral density for epoch 147
    computing cross-spectral density for epoch 148
    computing cross-spectral density for epoch 149
    computing cross-spectral density for epoch 150
    computing cross-spectral density for epoch 151
    computing cross-spectral density for epoch 152
    computing cross-spectral density for epoch 153
    computing cross-spectral density for epoch 154
    computing cross-spectral density for epoch 155
    computing cross-spectral density for epoch 156
    computing cross-spectral density for epoch 157
    computing cross-spectral density for epoch 158
    computing cross-spectral density for epoch 159
    computing cross-spectral density for epoch 160
    computing cross-spectral density for epoch 161
    computing cross-spectral density for epoch 162
    computing cross-spectral density for epoch 163
    computing cross-spectral density for epoch 164
    computing cross-spectral density for epoch 165
    computing cross-spectral density for epoch 166
    computing cross-spectral density for epoch 167
    computing cross-spectral density for epoch 168
    computing cross-spectral density for epoch 169
    computing cross-spectral density for epoch 170
    computing cross-spectral density for epoch 171
    computing cross-spectral density for epoch 172
    computing cross-spectral density for epoch 173
    computing cross-spectral density for epoch 174
    computing cross-spectral density for epoch 175
    computing cross-spectral density for epoch 176
    computing cross-spectral density for epoch 177
    computing cross-spectral density for epoch 178
    computing cross-spectral density for epoch 179
    computing cross-spectral density for epoch 180
    computing cross-spectral density for epoch 181
    computing cross-spectral density for epoch 182
    computing cross-spectral density for epoch 183
    computing cross-spectral density for epoch 184
    computing cross-spectral density for epoch 185
    computing cross-spectral density for epoch 186
    computing cross-spectral density for epoch 187
    computing cross-spectral density for epoch 188
    computing cross-spectral density for epoch 189
    computing cross-spectral density for epoch 190
    computing cross-spectral density for epoch 191
    computing cross-spectral density for epoch 192
    computing cross-spectral density for epoch 193
    computing cross-spectral density for epoch 194
    computing cross-spectral density for epoch 195
    computing cross-spectral density for epoch 196
    computing cross-spectral density for epoch 197
    computing cross-spectral density for epoch 198
    computing cross-spectral density for epoch 199
    computing cross-spectral density for epoch 200
    computing cross-spectral density for epoch 201
    computing cross-spectral density for epoch 202
    computing cross-spectral density for epoch 203
    computing cross-spectral density for epoch 204
    computing cross-spectral density for epoch 205
    computing cross-spectral density for epoch 206
    computing cross-spectral density for epoch 207
    computing cross-spectral density for epoch 208
    computing cross-spectral density for epoch 209
    computing cross-spectral density for epoch 210
    computing cross-spectral density for epoch 211
    computing cross-spectral density for epoch 212
    computing cross-spectral density for epoch 213
    computing cross-spectral density for epoch 214
    computing cross-spectral density for epoch 215
    computing cross-spectral density for epoch 216
    computing cross-spectral density for epoch 217
    computing cross-spectral density for epoch 218
    computing cross-spectral density for epoch 219
    computing cross-spectral density for epoch 220
    computing cross-spectral density for epoch 221
    computing cross-spectral density for epoch 222
    computing cross-spectral density for epoch 223
    computing cross-spectral density for epoch 224
    computing cross-spectral density for epoch 225
    computing cross-spectral density for epoch 226
    computing cross-spectral density for epoch 227
    computing cross-spectral density for epoch 228
    computing cross-spectral density for epoch 229
    computing cross-spectral density for epoch 230
    computing cross-spectral density for epoch 231
    computing cross-spectral density for epoch 232
    computing cross-spectral density for epoch 233
    computing cross-spectral density for epoch 234
    computing cross-spectral density for epoch 235
    computing cross-spectral density for epoch 236
    computing cross-spectral density for epoch 237
    computing cross-spectral density for epoch 238
    computing cross-spectral density for epoch 239
    computing cross-spectral density for epoch 240
    computing cross-spectral density for epoch 241
    computing cross-spectral density for epoch 242
    computing cross-spectral density for epoch 243
    computing cross-spectral density for epoch 244
    computing cross-spectral density for epoch 245
    computing cross-spectral density for epoch 246
    computing cross-spectral density for epoch 247
    computing cross-spectral density for epoch 248
    computing cross-spectral density for epoch 249
    computing cross-spectral density for epoch 250
    computing cross-spectral density for epoch 251
    computing cross-spectral density for epoch 252
    computing cross-spectral density for epoch 253
    computing cross-spectral density for epoch 254
    computing cross-spectral density for epoch 255
    computing cross-spectral density for epoch 256
    computing cross-spectral density for epoch 257
    computing cross-spectral density for epoch 258
    computing cross-spectral density for epoch 259
    computing cross-spectral density for epoch 260
    computing cross-spectral density for epoch 261
    computing cross-spectral density for epoch 262
    computing cross-spectral density for epoch 263
    computing cross-spectral density for epoch 264
    computing cross-spectral density for epoch 265
    computing cross-spectral density for epoch 266
    computing cross-spectral density for epoch 267
    computing cross-spectral density for epoch 268
    computing cross-spectral density for epoch 269
    computing cross-spectral density for epoch 270
    computing cross-spectral density for epoch 271
    computing cross-spectral density for epoch 272
    computing cross-spectral density for epoch 273
    computing cross-spectral density for epoch 274
    computing cross-spectral density for epoch 275
    computing cross-spectral density for epoch 276
    computing cross-spectral density for epoch 277
    computing cross-spectral density for epoch 278
    computing cross-spectral density for epoch 279
    computing cross-spectral density for epoch 280
    computing cross-spectral density for epoch 281
    computing cross-spectral density for epoch 282
    computing cross-spectral density for epoch 283
    computing cross-spectral density for epoch 284
    computing cross-spectral density for epoch 285
    computing cross-spectral density for epoch 286
    computing cross-spectral density for epoch 287
    computing cross-spectral density for epoch 288
    computing cross-spectral density for epoch 289
    computing cross-spectral density for epoch 290
    computing cross-spectral density for epoch 291
    computing cross-spectral density for epoch 292
    computing cross-spectral density for epoch 293
    computing cross-spectral density for epoch 294
    computing cross-spectral density for epoch 295
    computing cross-spectral density for epoch 296
    computing cross-spectral density for epoch 297
    computing cross-spectral density for epoch 298
    computing cross-spectral density for epoch 299
    computing cross-spectral density for epoch 300
[Connectivity computation done]

The estimated connectivites are shown in the figure below, which provides insight into the differences between PLI/wPLI, and dPLI.

Similarities Of All Measures

  • Capture presence of connectivity in same situations (phase difference of \(\pm\frac{\pi}{2}\))

  • Do not predict connectivity when phase difference is a multiple of \(\pi\)

  • Bounded between \(0\) and \(1\)

How dPLI is Different Than PLI/wPLI

  • Null connectivity is \(0\) for PLI and wPLI, but \(0.5\) for dPLI

  • dPLI differentiates whether the reference signal is leading or lagging the other signal (lagging if \(0 <= dPlI < 0.5\), leading if \(0.5 < dPLI <= 1.0\))

x = np.arange(5)

plt.figure()
plt.bar(x - 0.2, conn[0], 0.2, align="center", label="PLI")
plt.bar(x, conn[1], 0.2, align="center", label="wPLI")
plt.bar(x + 0.2, conn[2], 0.2, align="center", label="dPLI")

plt.title("Connectivity Estimation Comparison")
plt.xticks(x, (r"$-\pi$", r"$-\pi/2$", r"$0$", r"$\pi/2$", r"$\pi$"))
plt.legend()
plt.xlabel("Phase Difference")
plt.ylabel("Estimated Connectivity")

plt.show()
Connectivity Estimation Comparison

Robustness to Outliers and Noise with wPLI#

The previous experiment illustrated the advantages conferred by dPLI when differentiating leading and lagging phase relationships. This experiment will now focus on understanding the advantages of wPLI, and explore how it extends upon PLI.

The main difference between PLI and wPLI is in how different phase relationships are weighted. In PLI, phase differences are weighted as \(-1\) or \(1\) according to their sign. In wPLI, phase differences are weighted based on their value, meaning that phase differences closer to \(\pm\frac{\pi}{2}\) are weighted more heavily than those close to \(0\) or any other multiple of \(\pi\).

This avoids a discontinuity at the transition between positive and negative phase, treating all phase differences near this transition in a similar way. This provides some robustness against outliers and noise when estimating connectivity. For instance, volume conduction can distort EEG/MEG recordings, wherein signals emanating from the same neural source will be picked up by multiple sensors on the scalp. This can effect connectivity estimations, bringing the relative phase differences between two signals close to \(0\). wPLI minimizes the contribution of phase relationships that are small but non-zero (and may thus be attributed to volume conduciton), while PLI weighs these in the same way as phase relationships of \(\pm\frac{\pi}{2}\).

To demonstrate this, we recreate a result from (Vinck et al, 2011) [2]. Two sinusoids are simulated, where the phase difference for half of the epochs is \(\frac{\pi}{2}\), and is \(-\frac{\pi}{100}\) for the others. We also explore the effect of applying uniform noise to this phase difference.

n_noise = 41  # amount of noise amplitude samples in [0, 4]
data = [[]]

# Generate reference
for _ in range(n_e):
    data[0].append(np.sin(2 * np.pi * f * t))

A_list = np.linspace(0, 4, n_noise)

for A in A_list:
    sig = []
    # Generate other signal
    for _ in range(int(n_e / 2)):  # phase difference -pi/100
        sig.append(
            np.sin(2 * np.pi * f * t + np.pi / 100 + A * np.random.uniform(-1, 1))
        )
    for _ in range(int(n_e / 2), n_e):  # phase difference pi/2
        sig.append(np.sin(2 * np.pi * f * t - np.pi / 2 + A * np.random.uniform(-1, 1)))
    data.append(sig)

data = np.swapaxes(np.array(data), 0, 1)

# Visualize the data
fig, ax = plt.subplots(1, 2, figsize=(12, 5), sharey=True)
ax[0].plot(t[:10], data[0, 0, :10], label="Reference")
ax[0].plot(t[:10], data[1, 1, :10])

ax[0].set_title(r"Phase Lagging ($-\pi/100$ Phase Difference)")
ax[0].set_xlabel("Time (s)")
ax[0].set_ylabel("Signal")
ax[0].legend()

ax[1].plot(t[:fs], data[0, 0, :fs], label="Reference")
ax[1].plot(t[:fs], data[-1, 1, :fs])
ax[1].set_title(r"Phase Leading ($\pi/2$ Phase Difference)")
ax[1].set_xlabel("Time (s)")

plt.show()
Phase Lagging ($-\pi/100$ Phase Difference), Phase Leading ($\pi/2$ Phase Difference)

We can now compute PLI and wPLI

conn = []
indices = ([0] * n_noise, np.arange(1, n_noise + 1))
for method in ["pli", "wpli"]:
    conn.append(
        spectral_connectivity_epochs(
            data,
            method=method,
            sfreq=fs,
            indices=indices,
            fmin=9,
            fmax=11,
            faverage=True,
        ).get_data()[:, 0]
    )
conn = np.array(conn)
Connectivity computation...
    using t=0.000s..9.996s for estimation (2500 points)
    frequencies: 9.0Hz..11.0Hz (21 points)
    connectivity scores will be averaged for each band
    computing connectivity for 41 connections
    Using multitaper spectrum estimation with 7 DPSS windows
    the following metrics will be computed: PLI
    computing cross-spectral density for epoch 1
    computing cross-spectral density for epoch 2
    computing cross-spectral density for epoch 3
    computing cross-spectral density for epoch 4
    computing cross-spectral density for epoch 5
    computing cross-spectral density for epoch 6
    computing cross-spectral density for epoch 7
    computing cross-spectral density for epoch 8
    computing cross-spectral density for epoch 9
    computing cross-spectral density for epoch 10
    computing cross-spectral density for epoch 11
    computing cross-spectral density for epoch 12
    computing cross-spectral density for epoch 13
    computing cross-spectral density for epoch 14
    computing cross-spectral density for epoch 15
    computing cross-spectral density for epoch 16
    computing cross-spectral density for epoch 17
    computing cross-spectral density for epoch 18
    computing cross-spectral density for epoch 19
    computing cross-spectral density for epoch 20
    computing cross-spectral density for epoch 21
    computing cross-spectral density for epoch 22
    computing cross-spectral density for epoch 23
    computing cross-spectral density for epoch 24
    computing cross-spectral density for epoch 25
    computing cross-spectral density for epoch 26
    computing cross-spectral density for epoch 27
    computing cross-spectral density for epoch 28
    computing cross-spectral density for epoch 29
    computing cross-spectral density for epoch 30
    computing cross-spectral density for epoch 31
    computing cross-spectral density for epoch 32
    computing cross-spectral density for epoch 33
    computing cross-spectral density for epoch 34
    computing cross-spectral density for epoch 35
    computing cross-spectral density for epoch 36
    computing cross-spectral density for epoch 37
    computing cross-spectral density for epoch 38
    computing cross-spectral density for epoch 39
    computing cross-spectral density for epoch 40
    computing cross-spectral density for epoch 41
    computing cross-spectral density for epoch 42
    computing cross-spectral density for epoch 43
    computing cross-spectral density for epoch 44
    computing cross-spectral density for epoch 45
    computing cross-spectral density for epoch 46
    computing cross-spectral density for epoch 47
    computing cross-spectral density for epoch 48
    computing cross-spectral density for epoch 49
    computing cross-spectral density for epoch 50
    computing cross-spectral density for epoch 51
    computing cross-spectral density for epoch 52
    computing cross-spectral density for epoch 53
    computing cross-spectral density for epoch 54
    computing cross-spectral density for epoch 55
    computing cross-spectral density for epoch 56
    computing cross-spectral density for epoch 57
    computing cross-spectral density for epoch 58
    computing cross-spectral density for epoch 59
    computing cross-spectral density for epoch 60
    computing cross-spectral density for epoch 61
    computing cross-spectral density for epoch 62
    computing cross-spectral density for epoch 63
    computing cross-spectral density for epoch 64
    computing cross-spectral density for epoch 65
    computing cross-spectral density for epoch 66
    computing cross-spectral density for epoch 67
    computing cross-spectral density for epoch 68
    computing cross-spectral density for epoch 69
    computing cross-spectral density for epoch 70
    computing cross-spectral density for epoch 71
    computing cross-spectral density for epoch 72
    computing cross-spectral density for epoch 73
    computing cross-spectral density for epoch 74
    computing cross-spectral density for epoch 75
    computing cross-spectral density for epoch 76
    computing cross-spectral density for epoch 77
    computing cross-spectral density for epoch 78
    computing cross-spectral density for epoch 79
    computing cross-spectral density for epoch 80
    computing cross-spectral density for epoch 81
    computing cross-spectral density for epoch 82
    computing cross-spectral density for epoch 83
    computing cross-spectral density for epoch 84
    computing cross-spectral density for epoch 85
    computing cross-spectral density for epoch 86
    computing cross-spectral density for epoch 87
    computing cross-spectral density for epoch 88
    computing cross-spectral density for epoch 89
    computing cross-spectral density for epoch 90
    computing cross-spectral density for epoch 91
    computing cross-spectral density for epoch 92
    computing cross-spectral density for epoch 93
    computing cross-spectral density for epoch 94
    computing cross-spectral density for epoch 95
    computing cross-spectral density for epoch 96
    computing cross-spectral density for epoch 97
    computing cross-spectral density for epoch 98
    computing cross-spectral density for epoch 99
    computing cross-spectral density for epoch 100
    computing cross-spectral density for epoch 101
    computing cross-spectral density for epoch 102
    computing cross-spectral density for epoch 103
    computing cross-spectral density for epoch 104
    computing cross-spectral density for epoch 105
    computing cross-spectral density for epoch 106
    computing cross-spectral density for epoch 107
    computing cross-spectral density for epoch 108
    computing cross-spectral density for epoch 109
    computing cross-spectral density for epoch 110
    computing cross-spectral density for epoch 111
    computing cross-spectral density for epoch 112
    computing cross-spectral density for epoch 113
    computing cross-spectral density for epoch 114
    computing cross-spectral density for epoch 115
    computing cross-spectral density for epoch 116
    computing cross-spectral density for epoch 117
    computing cross-spectral density for epoch 118
    computing cross-spectral density for epoch 119
    computing cross-spectral density for epoch 120
    computing cross-spectral density for epoch 121
    computing cross-spectral density for epoch 122
    computing cross-spectral density for epoch 123
    computing cross-spectral density for epoch 124
    computing cross-spectral density for epoch 125
    computing cross-spectral density for epoch 126
    computing cross-spectral density for epoch 127
    computing cross-spectral density for epoch 128
    computing cross-spectral density for epoch 129
    computing cross-spectral density for epoch 130
    computing cross-spectral density for epoch 131
    computing cross-spectral density for epoch 132
    computing cross-spectral density for epoch 133
    computing cross-spectral density for epoch 134
    computing cross-spectral density for epoch 135
    computing cross-spectral density for epoch 136
    computing cross-spectral density for epoch 137
    computing cross-spectral density for epoch 138
    computing cross-spectral density for epoch 139
    computing cross-spectral density for epoch 140
    computing cross-spectral density for epoch 141
    computing cross-spectral density for epoch 142
    computing cross-spectral density for epoch 143
    computing cross-spectral density for epoch 144
    computing cross-spectral density for epoch 145
    computing cross-spectral density for epoch 146
    computing cross-spectral density for epoch 147
    computing cross-spectral density for epoch 148
    computing cross-spectral density for epoch 149
    computing cross-spectral density for epoch 150
    computing cross-spectral density for epoch 151
    computing cross-spectral density for epoch 152
    computing cross-spectral density for epoch 153
    computing cross-spectral density for epoch 154
    computing cross-spectral density for epoch 155
    computing cross-spectral density for epoch 156
    computing cross-spectral density for epoch 157
    computing cross-spectral density for epoch 158
    computing cross-spectral density for epoch 159
    computing cross-spectral density for epoch 160
    computing cross-spectral density for epoch 161
    computing cross-spectral density for epoch 162
    computing cross-spectral density for epoch 163
    computing cross-spectral density for epoch 164
    computing cross-spectral density for epoch 165
    computing cross-spectral density for epoch 166
    computing cross-spectral density for epoch 167
    computing cross-spectral density for epoch 168
    computing cross-spectral density for epoch 169
    computing cross-spectral density for epoch 170
    computing cross-spectral density for epoch 171
    computing cross-spectral density for epoch 172
    computing cross-spectral density for epoch 173
    computing cross-spectral density for epoch 174
    computing cross-spectral density for epoch 175
    computing cross-spectral density for epoch 176
    computing cross-spectral density for epoch 177
    computing cross-spectral density for epoch 178
    computing cross-spectral density for epoch 179
    computing cross-spectral density for epoch 180
    computing cross-spectral density for epoch 181
    computing cross-spectral density for epoch 182
    computing cross-spectral density for epoch 183
    computing cross-spectral density for epoch 184
    computing cross-spectral density for epoch 185
    computing cross-spectral density for epoch 186
    computing cross-spectral density for epoch 187
    computing cross-spectral density for epoch 188
    computing cross-spectral density for epoch 189
    computing cross-spectral density for epoch 190
    computing cross-spectral density for epoch 191
    computing cross-spectral density for epoch 192
    computing cross-spectral density for epoch 193
    computing cross-spectral density for epoch 194
    computing cross-spectral density for epoch 195
    computing cross-spectral density for epoch 196
    computing cross-spectral density for epoch 197
    computing cross-spectral density for epoch 198
    computing cross-spectral density for epoch 199
    computing cross-spectral density for epoch 200
    computing cross-spectral density for epoch 201
    computing cross-spectral density for epoch 202
    computing cross-spectral density for epoch 203
    computing cross-spectral density for epoch 204
    computing cross-spectral density for epoch 205
    computing cross-spectral density for epoch 206
    computing cross-spectral density for epoch 207
    computing cross-spectral density for epoch 208
    computing cross-spectral density for epoch 209
    computing cross-spectral density for epoch 210
    computing cross-spectral density for epoch 211
    computing cross-spectral density for epoch 212
    computing cross-spectral density for epoch 213
    computing cross-spectral density for epoch 214
    computing cross-spectral density for epoch 215
    computing cross-spectral density for epoch 216
    computing cross-spectral density for epoch 217
    computing cross-spectral density for epoch 218
    computing cross-spectral density for epoch 219
    computing cross-spectral density for epoch 220
    computing cross-spectral density for epoch 221
    computing cross-spectral density for epoch 222
    computing cross-spectral density for epoch 223
    computing cross-spectral density for epoch 224
    computing cross-spectral density for epoch 225
    computing cross-spectral density for epoch 226
    computing cross-spectral density for epoch 227
    computing cross-spectral density for epoch 228
    computing cross-spectral density for epoch 229
    computing cross-spectral density for epoch 230
    computing cross-spectral density for epoch 231
    computing cross-spectral density for epoch 232
    computing cross-spectral density for epoch 233
    computing cross-spectral density for epoch 234
    computing cross-spectral density for epoch 235
    computing cross-spectral density for epoch 236
    computing cross-spectral density for epoch 237
    computing cross-spectral density for epoch 238
    computing cross-spectral density for epoch 239
    computing cross-spectral density for epoch 240
    computing cross-spectral density for epoch 241
    computing cross-spectral density for epoch 242
    computing cross-spectral density for epoch 243
    computing cross-spectral density for epoch 244
    computing cross-spectral density for epoch 245
    computing cross-spectral density for epoch 246
    computing cross-spectral density for epoch 247
    computing cross-spectral density for epoch 248
    computing cross-spectral density for epoch 249
    computing cross-spectral density for epoch 250
    computing cross-spectral density for epoch 251
    computing cross-spectral density for epoch 252
    computing cross-spectral density for epoch 253
    computing cross-spectral density for epoch 254
    computing cross-spectral density for epoch 255
    computing cross-spectral density for epoch 256
    computing cross-spectral density for epoch 257
    computing cross-spectral density for epoch 258
    computing cross-spectral density for epoch 259
    computing cross-spectral density for epoch 260
    computing cross-spectral density for epoch 261
    computing cross-spectral density for epoch 262
    computing cross-spectral density for epoch 263
    computing cross-spectral density for epoch 264
    computing cross-spectral density for epoch 265
    computing cross-spectral density for epoch 266
    computing cross-spectral density for epoch 267
    computing cross-spectral density for epoch 268
    computing cross-spectral density for epoch 269
    computing cross-spectral density for epoch 270
    computing cross-spectral density for epoch 271
    computing cross-spectral density for epoch 272
    computing cross-spectral density for epoch 273
    computing cross-spectral density for epoch 274
    computing cross-spectral density for epoch 275
    computing cross-spectral density for epoch 276
    computing cross-spectral density for epoch 277
    computing cross-spectral density for epoch 278
    computing cross-spectral density for epoch 279
    computing cross-spectral density for epoch 280
    computing cross-spectral density for epoch 281
    computing cross-spectral density for epoch 282
    computing cross-spectral density for epoch 283
    computing cross-spectral density for epoch 284
    computing cross-spectral density for epoch 285
    computing cross-spectral density for epoch 286
    computing cross-spectral density for epoch 287
    computing cross-spectral density for epoch 288
    computing cross-spectral density for epoch 289
    computing cross-spectral density for epoch 290
    computing cross-spectral density for epoch 291
    computing cross-spectral density for epoch 292
    computing cross-spectral density for epoch 293
    computing cross-spectral density for epoch 294
    computing cross-spectral density for epoch 295
    computing cross-spectral density for epoch 296
    computing cross-spectral density for epoch 297
    computing cross-spectral density for epoch 298
    computing cross-spectral density for epoch 299
    computing cross-spectral density for epoch 300
[Connectivity computation done]
Connectivity computation...
    using t=0.000s..9.996s for estimation (2500 points)
    frequencies: 9.0Hz..11.0Hz (21 points)
    connectivity scores will be averaged for each band
    computing connectivity for 41 connections
    Using multitaper spectrum estimation with 7 DPSS windows
    the following metrics will be computed: WPLI
    computing cross-spectral density for epoch 1
    computing cross-spectral density for epoch 2
    computing cross-spectral density for epoch 3
    computing cross-spectral density for epoch 4
    computing cross-spectral density for epoch 5
    computing cross-spectral density for epoch 6
    computing cross-spectral density for epoch 7
    computing cross-spectral density for epoch 8
    computing cross-spectral density for epoch 9
    computing cross-spectral density for epoch 10
    computing cross-spectral density for epoch 11
    computing cross-spectral density for epoch 12
    computing cross-spectral density for epoch 13
    computing cross-spectral density for epoch 14
    computing cross-spectral density for epoch 15
    computing cross-spectral density for epoch 16
    computing cross-spectral density for epoch 17
    computing cross-spectral density for epoch 18
    computing cross-spectral density for epoch 19
    computing cross-spectral density for epoch 20
    computing cross-spectral density for epoch 21
    computing cross-spectral density for epoch 22
    computing cross-spectral density for epoch 23
    computing cross-spectral density for epoch 24
    computing cross-spectral density for epoch 25
    computing cross-spectral density for epoch 26
    computing cross-spectral density for epoch 27
    computing cross-spectral density for epoch 28
    computing cross-spectral density for epoch 29
    computing cross-spectral density for epoch 30
    computing cross-spectral density for epoch 31
    computing cross-spectral density for epoch 32
    computing cross-spectral density for epoch 33
    computing cross-spectral density for epoch 34
    computing cross-spectral density for epoch 35
    computing cross-spectral density for epoch 36
    computing cross-spectral density for epoch 37
    computing cross-spectral density for epoch 38
    computing cross-spectral density for epoch 39
    computing cross-spectral density for epoch 40
    computing cross-spectral density for epoch 41
    computing cross-spectral density for epoch 42
    computing cross-spectral density for epoch 43
    computing cross-spectral density for epoch 44
    computing cross-spectral density for epoch 45
    computing cross-spectral density for epoch 46
    computing cross-spectral density for epoch 47
    computing cross-spectral density for epoch 48
    computing cross-spectral density for epoch 49
    computing cross-spectral density for epoch 50
    computing cross-spectral density for epoch 51
    computing cross-spectral density for epoch 52
    computing cross-spectral density for epoch 53
    computing cross-spectral density for epoch 54
    computing cross-spectral density for epoch 55
    computing cross-spectral density for epoch 56
    computing cross-spectral density for epoch 57
    computing cross-spectral density for epoch 58
    computing cross-spectral density for epoch 59
    computing cross-spectral density for epoch 60
    computing cross-spectral density for epoch 61
    computing cross-spectral density for epoch 62
    computing cross-spectral density for epoch 63
    computing cross-spectral density for epoch 64
    computing cross-spectral density for epoch 65
    computing cross-spectral density for epoch 66
    computing cross-spectral density for epoch 67
    computing cross-spectral density for epoch 68
    computing cross-spectral density for epoch 69
    computing cross-spectral density for epoch 70
    computing cross-spectral density for epoch 71
    computing cross-spectral density for epoch 72
    computing cross-spectral density for epoch 73
    computing cross-spectral density for epoch 74
    computing cross-spectral density for epoch 75
    computing cross-spectral density for epoch 76
    computing cross-spectral density for epoch 77
    computing cross-spectral density for epoch 78
    computing cross-spectral density for epoch 79
    computing cross-spectral density for epoch 80
    computing cross-spectral density for epoch 81
    computing cross-spectral density for epoch 82
    computing cross-spectral density for epoch 83
    computing cross-spectral density for epoch 84
    computing cross-spectral density for epoch 85
    computing cross-spectral density for epoch 86
    computing cross-spectral density for epoch 87
    computing cross-spectral density for epoch 88
    computing cross-spectral density for epoch 89
    computing cross-spectral density for epoch 90
    computing cross-spectral density for epoch 91
    computing cross-spectral density for epoch 92
    computing cross-spectral density for epoch 93
    computing cross-spectral density for epoch 94
    computing cross-spectral density for epoch 95
    computing cross-spectral density for epoch 96
    computing cross-spectral density for epoch 97
    computing cross-spectral density for epoch 98
    computing cross-spectral density for epoch 99
    computing cross-spectral density for epoch 100
    computing cross-spectral density for epoch 101
    computing cross-spectral density for epoch 102
    computing cross-spectral density for epoch 103
    computing cross-spectral density for epoch 104
    computing cross-spectral density for epoch 105
    computing cross-spectral density for epoch 106
    computing cross-spectral density for epoch 107
    computing cross-spectral density for epoch 108
    computing cross-spectral density for epoch 109
    computing cross-spectral density for epoch 110
    computing cross-spectral density for epoch 111
    computing cross-spectral density for epoch 112
    computing cross-spectral density for epoch 113
    computing cross-spectral density for epoch 114
    computing cross-spectral density for epoch 115
    computing cross-spectral density for epoch 116
    computing cross-spectral density for epoch 117
    computing cross-spectral density for epoch 118
    computing cross-spectral density for epoch 119
    computing cross-spectral density for epoch 120
    computing cross-spectral density for epoch 121
    computing cross-spectral density for epoch 122
    computing cross-spectral density for epoch 123
    computing cross-spectral density for epoch 124
    computing cross-spectral density for epoch 125
    computing cross-spectral density for epoch 126
    computing cross-spectral density for epoch 127
    computing cross-spectral density for epoch 128
    computing cross-spectral density for epoch 129
    computing cross-spectral density for epoch 130
    computing cross-spectral density for epoch 131
    computing cross-spectral density for epoch 132
    computing cross-spectral density for epoch 133
    computing cross-spectral density for epoch 134
    computing cross-spectral density for epoch 135
    computing cross-spectral density for epoch 136
    computing cross-spectral density for epoch 137
    computing cross-spectral density for epoch 138
    computing cross-spectral density for epoch 139
    computing cross-spectral density for epoch 140
    computing cross-spectral density for epoch 141
    computing cross-spectral density for epoch 142
    computing cross-spectral density for epoch 143
    computing cross-spectral density for epoch 144
    computing cross-spectral density for epoch 145
    computing cross-spectral density for epoch 146
    computing cross-spectral density for epoch 147
    computing cross-spectral density for epoch 148
    computing cross-spectral density for epoch 149
    computing cross-spectral density for epoch 150
    computing cross-spectral density for epoch 151
    computing cross-spectral density for epoch 152
    computing cross-spectral density for epoch 153
    computing cross-spectral density for epoch 154
    computing cross-spectral density for epoch 155
    computing cross-spectral density for epoch 156
    computing cross-spectral density for epoch 157
    computing cross-spectral density for epoch 158
    computing cross-spectral density for epoch 159
    computing cross-spectral density for epoch 160
    computing cross-spectral density for epoch 161
    computing cross-spectral density for epoch 162
    computing cross-spectral density for epoch 163
    computing cross-spectral density for epoch 164
    computing cross-spectral density for epoch 165
    computing cross-spectral density for epoch 166
    computing cross-spectral density for epoch 167
    computing cross-spectral density for epoch 168
    computing cross-spectral density for epoch 169
    computing cross-spectral density for epoch 170
    computing cross-spectral density for epoch 171
    computing cross-spectral density for epoch 172
    computing cross-spectral density for epoch 173
    computing cross-spectral density for epoch 174
    computing cross-spectral density for epoch 175
    computing cross-spectral density for epoch 176
    computing cross-spectral density for epoch 177
    computing cross-spectral density for epoch 178
    computing cross-spectral density for epoch 179
    computing cross-spectral density for epoch 180
    computing cross-spectral density for epoch 181
    computing cross-spectral density for epoch 182
    computing cross-spectral density for epoch 183
    computing cross-spectral density for epoch 184
    computing cross-spectral density for epoch 185
    computing cross-spectral density for epoch 186
    computing cross-spectral density for epoch 187
    computing cross-spectral density for epoch 188
    computing cross-spectral density for epoch 189
    computing cross-spectral density for epoch 190
    computing cross-spectral density for epoch 191
    computing cross-spectral density for epoch 192
    computing cross-spectral density for epoch 193
    computing cross-spectral density for epoch 194
    computing cross-spectral density for epoch 195
    computing cross-spectral density for epoch 196
    computing cross-spectral density for epoch 197
    computing cross-spectral density for epoch 198
    computing cross-spectral density for epoch 199
    computing cross-spectral density for epoch 200
    computing cross-spectral density for epoch 201
    computing cross-spectral density for epoch 202
    computing cross-spectral density for epoch 203
    computing cross-spectral density for epoch 204
    computing cross-spectral density for epoch 205
    computing cross-spectral density for epoch 206
    computing cross-spectral density for epoch 207
    computing cross-spectral density for epoch 208
    computing cross-spectral density for epoch 209
    computing cross-spectral density for epoch 210
    computing cross-spectral density for epoch 211
    computing cross-spectral density for epoch 212
    computing cross-spectral density for epoch 213
    computing cross-spectral density for epoch 214
    computing cross-spectral density for epoch 215
    computing cross-spectral density for epoch 216
    computing cross-spectral density for epoch 217
    computing cross-spectral density for epoch 218
    computing cross-spectral density for epoch 219
    computing cross-spectral density for epoch 220
    computing cross-spectral density for epoch 221
    computing cross-spectral density for epoch 222
    computing cross-spectral density for epoch 223
    computing cross-spectral density for epoch 224
    computing cross-spectral density for epoch 225
    computing cross-spectral density for epoch 226
    computing cross-spectral density for epoch 227
    computing cross-spectral density for epoch 228
    computing cross-spectral density for epoch 229
    computing cross-spectral density for epoch 230
    computing cross-spectral density for epoch 231
    computing cross-spectral density for epoch 232
    computing cross-spectral density for epoch 233
    computing cross-spectral density for epoch 234
    computing cross-spectral density for epoch 235
    computing cross-spectral density for epoch 236
    computing cross-spectral density for epoch 237
    computing cross-spectral density for epoch 238
    computing cross-spectral density for epoch 239
    computing cross-spectral density for epoch 240
    computing cross-spectral density for epoch 241
    computing cross-spectral density for epoch 242
    computing cross-spectral density for epoch 243
    computing cross-spectral density for epoch 244
    computing cross-spectral density for epoch 245
    computing cross-spectral density for epoch 246
    computing cross-spectral density for epoch 247
    computing cross-spectral density for epoch 248
    computing cross-spectral density for epoch 249
    computing cross-spectral density for epoch 250
    computing cross-spectral density for epoch 251
    computing cross-spectral density for epoch 252
    computing cross-spectral density for epoch 253
    computing cross-spectral density for epoch 254
    computing cross-spectral density for epoch 255
    computing cross-spectral density for epoch 256
    computing cross-spectral density for epoch 257
    computing cross-spectral density for epoch 258
    computing cross-spectral density for epoch 259
    computing cross-spectral density for epoch 260
    computing cross-spectral density for epoch 261
    computing cross-spectral density for epoch 262
    computing cross-spectral density for epoch 263
    computing cross-spectral density for epoch 264
    computing cross-spectral density for epoch 265
    computing cross-spectral density for epoch 266
    computing cross-spectral density for epoch 267
    computing cross-spectral density for epoch 268
    computing cross-spectral density for epoch 269
    computing cross-spectral density for epoch 270
    computing cross-spectral density for epoch 271
    computing cross-spectral density for epoch 272
    computing cross-spectral density for epoch 273
    computing cross-spectral density for epoch 274
    computing cross-spectral density for epoch 275
    computing cross-spectral density for epoch 276
    computing cross-spectral density for epoch 277
    computing cross-spectral density for epoch 278
    computing cross-spectral density for epoch 279
    computing cross-spectral density for epoch 280
    computing cross-spectral density for epoch 281
    computing cross-spectral density for epoch 282
    computing cross-spectral density for epoch 283
    computing cross-spectral density for epoch 284
    computing cross-spectral density for epoch 285
    computing cross-spectral density for epoch 286
    computing cross-spectral density for epoch 287
    computing cross-spectral density for epoch 288
    computing cross-spectral density for epoch 289
    computing cross-spectral density for epoch 290
    computing cross-spectral density for epoch 291
    computing cross-spectral density for epoch 292
    computing cross-spectral density for epoch 293
    computing cross-spectral density for epoch 294
    computing cross-spectral density for epoch 295
    computing cross-spectral density for epoch 296
    computing cross-spectral density for epoch 297
    computing cross-spectral density for epoch 298
    computing cross-spectral density for epoch 299
    computing cross-spectral density for epoch 300
[Connectivity computation done]

The results from the simulation are shown in the figure below. In the case without noise, the difference between wPLI and PLI is made obvious. In PLI, no connectivity is detected, as the \(-\frac{\pi}{100}\) phase differences are weighted in the exact same way as the \(\frac{\pi}{2}\) relationships. wPLI is able to avoid the cancellation of the \(\frac{\pi}{2}\) relationships.

As noise gets added, PLI increases since the \(-\frac{\pi}{100}\) relationships are made positive more often than the \(\frac{\pi}{2}\) relationships are made negative. However, wPLI maintains an advantage in its ability to distinguish the underlying structure. Beyond a certain point, the noise dominates any pre-defined structure, and both methods behave similarly, tending toward \(0\). For a more detailed analysis of this result and the properties of wPLI, please refer to (Vinck et al, 2011) [2].

plt.figure()
plt.plot(A_list, conn[0], "o-", label="PLI")
plt.plot(A_list, conn[1], "o-", label="wPLI")
plt.legend()
plt.xlabel("Noise Amplitude")
plt.ylabel("Connectivity Measure")
plt.title("wPLI and PLI Under Increasing Noise")
plt.show()
wPLI and PLI Under Increasing Noise

Demo On MEG Data#

To finish this example, we also quickly demonstrate these methods on some sample MEG data recorded during visual stimulation.

data_path = sample.data_path()
raw_fname = data_path / "MEG/sample/sample_audvis_filt-0-40_raw.fif"
event_fname = data_path / "MEG/sample/sample_audvis_filt-0-40_raw-eve.fif"
raw = mne.io.read_raw_fif(raw_fname)
events = mne.read_events(event_fname)


# Select gradiometers
picks = mne.pick_types(
    raw.info, meg="grad", eeg=False, stim=False, eog=True, exclude="bads"
)

# Create epochs
event_id, tmin, tmax = 3, -0.2, 1.5  # need a long enough epoch for 5 cycles
epochs = mne.Epochs(
    raw,
    events,
    event_id,
    tmin,
    tmax,
    picks=picks,
    baseline=(None, 0),
    reject=dict(grad=4000e-13, eog=150e-6),
)
epochs.load_data().pick_types(meg="grad")  # just keep MEG and no EOG now

fmin, fmax = 4.0, 9.0  # compute connectivity within 4-9 Hz
sfreq = raw.info["sfreq"]  # the sampling frequency
tmin = 0.0  # exclude the baseline period

# Compute PLI, wPLI, and dPLI
con_pli = spectral_connectivity_epochs(
    epochs,
    method="pli",
    mode="multitaper",
    sfreq=sfreq,
    fmin=fmin,
    fmax=fmax,
    faverage=True,
    tmin=tmin,
    mt_adaptive=False,
    n_jobs=1,
)

con_wpli = spectral_connectivity_epochs(
    epochs,
    method="wpli",
    mode="multitaper",
    sfreq=sfreq,
    fmin=fmin,
    fmax=fmax,
    faverage=True,
    tmin=tmin,
    mt_adaptive=False,
    n_jobs=1,
)

con_dpli = spectral_connectivity_epochs(
    epochs,
    method="dpli",
    mode="multitaper",
    sfreq=sfreq,
    fmin=fmin,
    fmax=fmax,
    faverage=True,
    tmin=tmin,
    mt_adaptive=False,
    n_jobs=1,
)
Opening raw data file /home/circleci/mne_data/MNE-sample-data/MEG/sample/sample_audvis_filt-0-40_raw.fif...
    Read a total of 4 projection items:
        PCA-v1 (1 x 102)  idle
        PCA-v2 (1 x 102)  idle
        PCA-v3 (1 x 102)  idle
        Average EEG reference (1 x 60)  idle
    Range : 6450 ... 48149 =     42.956 ...   320.665 secs
Ready.
Not setting metadata
73 matching events found
Setting baseline interval to [-0.19979521315838786, 0.0] s
Applying baseline correction (mode: mean)
0 projection items activated
Loading data for 73 events and 256 original time points ...
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
24 bad epochs dropped
NOTE: pick_types() is a legacy function. New code should use inst.pick(...).
Adding metadata with 3 columns
Connectivity computation...
    using t=0.000s..1.498s for estimation (226 points)
    frequencies: 4.7Hz..8.6Hz (7 points)
    connectivity scores will be averaged for each band
only using indices for lower-triangular matrix
    computing connectivity for 20503 connections
    Using multitaper spectrum estimation with 7 DPSS windows
    the following metrics will be computed: PLI
    computing cross-spectral density for epoch 1
    computing cross-spectral density for epoch 2
    computing cross-spectral density for epoch 3
    computing cross-spectral density for epoch 4
    computing cross-spectral density for epoch 5
    computing cross-spectral density for epoch 6
    computing cross-spectral density for epoch 7
    computing cross-spectral density for epoch 8
    computing cross-spectral density for epoch 9
    computing cross-spectral density for epoch 10
    computing cross-spectral density for epoch 11
    computing cross-spectral density for epoch 12
    computing cross-spectral density for epoch 13
    computing cross-spectral density for epoch 14
    computing cross-spectral density for epoch 15
    computing cross-spectral density for epoch 16
    computing cross-spectral density for epoch 17
    computing cross-spectral density for epoch 18
    computing cross-spectral density for epoch 19
    computing cross-spectral density for epoch 20
    computing cross-spectral density for epoch 21
    computing cross-spectral density for epoch 22
    computing cross-spectral density for epoch 23
    computing cross-spectral density for epoch 24
    computing cross-spectral density for epoch 25
    computing cross-spectral density for epoch 26
    computing cross-spectral density for epoch 27
    computing cross-spectral density for epoch 28
    computing cross-spectral density for epoch 29
    computing cross-spectral density for epoch 30
    computing cross-spectral density for epoch 31
    computing cross-spectral density for epoch 32
    computing cross-spectral density for epoch 33
    computing cross-spectral density for epoch 34
    computing cross-spectral density for epoch 35
    computing cross-spectral density for epoch 36
    computing cross-spectral density for epoch 37
    computing cross-spectral density for epoch 38
    computing cross-spectral density for epoch 39
    computing cross-spectral density for epoch 40
    computing cross-spectral density for epoch 41
    computing cross-spectral density for epoch 42
    computing cross-spectral density for epoch 43
    computing cross-spectral density for epoch 44
    computing cross-spectral density for epoch 45
    computing cross-spectral density for epoch 46
    computing cross-spectral density for epoch 47
    computing cross-spectral density for epoch 48
    computing cross-spectral density for epoch 49
    assembling connectivity matrix
[Connectivity computation done]
Replacing existing metadata with 3 columns
Connectivity computation...
    using t=0.000s..1.498s for estimation (226 points)
    frequencies: 4.7Hz..8.6Hz (7 points)
    connectivity scores will be averaged for each band
only using indices for lower-triangular matrix
    computing connectivity for 20503 connections
    Using multitaper spectrum estimation with 7 DPSS windows
    the following metrics will be computed: WPLI
    computing cross-spectral density for epoch 1
    computing cross-spectral density for epoch 2
    computing cross-spectral density for epoch 3
    computing cross-spectral density for epoch 4
    computing cross-spectral density for epoch 5
    computing cross-spectral density for epoch 6
    computing cross-spectral density for epoch 7
    computing cross-spectral density for epoch 8
    computing cross-spectral density for epoch 9
    computing cross-spectral density for epoch 10
    computing cross-spectral density for epoch 11
    computing cross-spectral density for epoch 12
    computing cross-spectral density for epoch 13
    computing cross-spectral density for epoch 14
    computing cross-spectral density for epoch 15
    computing cross-spectral density for epoch 16
    computing cross-spectral density for epoch 17
    computing cross-spectral density for epoch 18
    computing cross-spectral density for epoch 19
    computing cross-spectral density for epoch 20
    computing cross-spectral density for epoch 21
    computing cross-spectral density for epoch 22
    computing cross-spectral density for epoch 23
    computing cross-spectral density for epoch 24
    computing cross-spectral density for epoch 25
    computing cross-spectral density for epoch 26
    computing cross-spectral density for epoch 27
    computing cross-spectral density for epoch 28
    computing cross-spectral density for epoch 29
    computing cross-spectral density for epoch 30
    computing cross-spectral density for epoch 31
    computing cross-spectral density for epoch 32
    computing cross-spectral density for epoch 33
    computing cross-spectral density for epoch 34
    computing cross-spectral density for epoch 35
    computing cross-spectral density for epoch 36
    computing cross-spectral density for epoch 37
    computing cross-spectral density for epoch 38
    computing cross-spectral density for epoch 39
    computing cross-spectral density for epoch 40
    computing cross-spectral density for epoch 41
    computing cross-spectral density for epoch 42
    computing cross-spectral density for epoch 43
    computing cross-spectral density for epoch 44
    computing cross-spectral density for epoch 45
    computing cross-spectral density for epoch 46
    computing cross-spectral density for epoch 47
    computing cross-spectral density for epoch 48
    computing cross-spectral density for epoch 49
    assembling connectivity matrix
[Connectivity computation done]
Replacing existing metadata with 3 columns
Connectivity computation...
    using t=0.000s..1.498s for estimation (226 points)
    frequencies: 4.7Hz..8.6Hz (7 points)
    connectivity scores will be averaged for each band
only using indices for lower-triangular matrix
    computing connectivity for 20503 connections
    Using multitaper spectrum estimation with 7 DPSS windows
    the following metrics will be computed: DPLI
    computing cross-spectral density for epoch 1
    computing cross-spectral density for epoch 2
    computing cross-spectral density for epoch 3
    computing cross-spectral density for epoch 4
    computing cross-spectral density for epoch 5
    computing cross-spectral density for epoch 6
    computing cross-spectral density for epoch 7
    computing cross-spectral density for epoch 8
    computing cross-spectral density for epoch 9
    computing cross-spectral density for epoch 10
    computing cross-spectral density for epoch 11
    computing cross-spectral density for epoch 12
    computing cross-spectral density for epoch 13
    computing cross-spectral density for epoch 14
    computing cross-spectral density for epoch 15
    computing cross-spectral density for epoch 16
    computing cross-spectral density for epoch 17
    computing cross-spectral density for epoch 18
    computing cross-spectral density for epoch 19
    computing cross-spectral density for epoch 20
    computing cross-spectral density for epoch 21
    computing cross-spectral density for epoch 22
    computing cross-spectral density for epoch 23
    computing cross-spectral density for epoch 24
    computing cross-spectral density for epoch 25
    computing cross-spectral density for epoch 26
    computing cross-spectral density for epoch 27
    computing cross-spectral density for epoch 28
    computing cross-spectral density for epoch 29
    computing cross-spectral density for epoch 30
    computing cross-spectral density for epoch 31
    computing cross-spectral density for epoch 32
    computing cross-spectral density for epoch 33
    computing cross-spectral density for epoch 34
    computing cross-spectral density for epoch 35
    computing cross-spectral density for epoch 36
    computing cross-spectral density for epoch 37
    computing cross-spectral density for epoch 38
    computing cross-spectral density for epoch 39
    computing cross-spectral density for epoch 40
    computing cross-spectral density for epoch 41
    computing cross-spectral density for epoch 42
    computing cross-spectral density for epoch 43
    computing cross-spectral density for epoch 44
    computing cross-spectral density for epoch 45
    computing cross-spectral density for epoch 46
    computing cross-spectral density for epoch 47
    computing cross-spectral density for epoch 48
    computing cross-spectral density for epoch 49
    assembling connectivity matrix
[Connectivity computation done]

In this example, there is strong connectivity between sensors 190-200 and sensors 110-160.

Moreover, after observing the presence of connectivity, dPLI can be used to ascertain the direction of the phase relationship. Here, it appears that the dPLI connectivity in this area is less than \(0.5\), and thus sensors 190-200 are lagging sensors 110-160.

In keeping with the previous simulation, we can see that wPLI identifies stronger connectivity relationships than PLI. This is due to its robustness against volume conduction effects decreasing the detected connectivity strength, as was mentioned earlier.

fig, axs = plt.subplots(1, 3, figsize=(14, 5), sharey=True)
axs[0].imshow(con_pli.get_data("dense"), vmin=0, vmax=1)
axs[0].set_title("PLI")
axs[0].set_ylabel("Sensor 1")
axs[0].set_xlabel("Sensor 2")

axs[1].imshow(con_wpli.get_data("dense"), vmin=0, vmax=1)
axs[1].set_title("wPLI")
axs[1].set_xlabel("Sensor 2")

im = axs[2].imshow(con_dpli.get_data("dense"), vmin=0, vmax=1)
axs[2].set_title("dPLI")
axs[2].set_xlabel("Sensor 2")

fig.colorbar(im, ax=axs.ravel())
plt.show()
PLI, wPLI, dPLI

Conclusions#

Both wPLI and dPLI are extensions upon the original PLI method, and provide complementary information about underlying connectivity.

  • To identify the presence of an underlying phase relationship, wPLI is the method of choice for most researchers as it provides an improvement in robustness over the original PLI method

  • To know the directionality of the connectivity identified by wPLI, dPLI should be used

Ultimately, these methods work great together, providing a comprehensive estimate of phase-based connectivity.

References#

Total running time of the script: (0 minutes 13.903 seconds)

Gallery generated by Sphinx-Gallery