<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 In this short tutorial, we will compute the static connectivity of the EEG singals.
Load data
Step1:  Static connectivity
As a first example, we are going to compute the static connectivity of the EEG signals using the IPLV estimator.
Step2:  Define the frequency band we are interested to examine, in Hz
Step3:  Define the sampling frequency, in Hz
Step5:  We will invoke the estimator using the full by-name arguments. The last arguement, pairs is None by default, which means all "full connectivity", otherwise you check the documentation about the structure of the value.
Step6:  Make the connectivity matrix symmetric
Step7:  Plot
Plot the matrix using the standard Matplotlib functions
<ASSISTANT_TASK:>
Python Code:
import numpy as np
import scipy
from scipy import io
eeg = np.load("data/eeg_eyes_opened.npy")
num_trials, num_channels, num_samples = np.shape(eeg)
eeg_ts = np.squeeze(eeg[0, :, :])
Explanation: In this short tutorial, we will compute the static connectivity of the EEG singals.
Load data
End of explanation
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
from dyconnmap.fc import iplv
Explanation: Static connectivity
As a first example, we are going to compute the static connectivity of the EEG signals using the IPLV estimator.
End of explanation
band = [1.0, 4.0]
Explanation: Define the frequency band we are interested to examine, in Hz
End of explanation
sampling_frequency = 160.0
Explanation: Define the sampling frequency, in Hz
End of explanation
ts, avg = iplv(eeg_ts, fb=band, fs=sampling_frequency, pairs=None)
print(fTime series array shape: {np.shape(ts)}
Average time series array shape: {np.shape(avg)})
Explanation: We will invoke the estimator using the full by-name arguments. The last arguement, pairs is None by default, which means all "full connectivity", otherwise you check the documentation about the structure of the value.
End of explanation
avg_symm = avg + avg.T
np.fill_diagonal(avg_symm, 1.0)
Explanation: Make the connectivity matrix symmetric
End of explanation
import matplotlib.pyplot as plt
mtx_min = 0.0 # we know it's 0.0 because of the estimator's properties
mtx_max = np.max(avg)
plt.figure(figsize=(6, 6))
cax = plt.imshow(avg_symm, vmin=mtx_min, vmax=mtx_max, cmap=plt.cm.Spectral)
cb = plt.colorbar(fraction=0.046, pad=0.04)
cb.ax.set_ylabel('Imaginary PLV', fontdict={'fontsize': 20})
plt.title('Connectivity Matrix', fontdict={'fontsize': 20})
plt.xlabel('ROI', fontdict={'fontsize': 20})
plt.ylabel('ROI', fontdict={'fontsize': 20})
plt.show()
Explanation: Plot
Plot the matrix using the standard Matplotlib functions
End of explanation
<END_TASK>