I have problem in finding the mutual information of EEG signals. I have considered the physionet CHB-MIT Scalp EEG Data. My coding is:
import os
import numpy as np
import matplotlib.pyplot as plt
import mne
import spkit as sp
# physionet EEG data
chb01_01_data = mne.io.read_raw_edf('CHB-MIT Scalp EEG Data\chb_01\chb01_01.edf', preload = True)
# shape of data
print(chb01_01_data._data.shape)
num_channels, num_samples = chb01_01_data._data.shape
x = chb01_03_data[0] # Assuming 'chb01_03_data' contains EEG data for 'x'
y = chb01_01_data[1] # Assuming 'chb01_01_data' contains EEG data for 'y'
# Ensure both signals have the same length
assert len(x) == len(y), "Both signals must have the same length."
# Shannan entropy
H_x = sp.entropy(x, alpha=1)
H_y = sp.entropy(y, alpha=1)
# Rényi entropy
Hr_x = sp.entropy(x, alpha=2)
Hr_y = sp.entropy(y, alpha=2)
H_xy = sp.entropy_joint(x, y)
H_x1y = sp.entropy_cond(x, y)
H_y1x = sp.entropy_cond(y, x)
I_xy = sp.mutual_Info(x, y)
AssertionError: Both signals must have the same length.
Though length of both x and y are same, it is showing error.