A bizzare issue that has come up after formatting my pc and reinstalling entropy. I am not sure if I'm making a mistake or the newest version of entropy broke something.
This is the code I am using for a two-channel resting-state EEG study.
`
import yasa
import mne
import numpy as np
import seaborn as sns
import pandas as pd
import entropy as ent
sns.set(font_scale=1.2)
df_all = pd.DataFrame(df_all)
df_all.to_csv(r'D:\study\EEGLAB\resting state\nonlinear - ASR + BANDPASS\1_nonlinear.csv')`
Error: AttributeError: module 'entropy' has no attribute 'perm_entropy'. This happens with all different types of entropy/complexity is just stops at the first one.
A bizzare issue that has come up after formatting my pc and reinstalling entropy. I am not sure if I'm making a mistake or the newest version of entropy broke something.
This is the code I am using for a two-channel resting-state EEG study.
` import yasa import mne import numpy as np import seaborn as sns import pandas as pd import entropy as ent sns.set(font_scale=1.2)
P1
Load data as a eeglab file
f = mne.io.read_raw_eeglab('D:/study/EEGLAB/resting state/Recordings/bandpass 0point5 - 45Hz +ASR/1_EEG_LR_RS.set', eog=(), preload=True, uint16_codec=None, verbose=None)
Load data
data = f._data * 1e6
sf = f.info['sfreq'] chan = f.ch_names times = np.arange(data.shape[1]) / sf
print(data.shape, np.round(data[0:5], 3))
Convert the EEG data to 30-sec data
times, data_win = yasa.sliding_window(data, sf, window=51)
Convert times to minutes
times /= 60
from numpy import apply_along_axis as apply
def lziv(x): """Binarize the EEG signal and calculate the Lempel-Ziv complexity. """ return ent.lziv_complexity(x > x.mean(), normalize=True)
df_all = []
for i, c in enumerate(chan): data_win_ep = data_win[i, :, :]
Calculate entropy for this channel
df_all = pd.DataFrame(df_all) df_all.to_csv(r'D:\study\EEGLAB\resting state\nonlinear - ASR + BANDPASS\1_nonlinear.csv')`
Error: AttributeError: module 'entropy' has no attribute 'perm_entropy'. This happens with all different types of entropy/complexity is just stops at the first one.
Thank you for your help in the matter.