-
While trying to get the PAC analysis, I found myself stuck on "data_N2", it constantly refuses to get passed it and returns a continuous error. ValueError: Must pass int or slice to __getitem__ I enclosed my code below: input_fname=easygui.fileopenbox(msg="EDF file")
raw=mne.io.read_raw_edf(input_fname,preload=True,verbose=False)
raw.resample(100)
sf=raw.info
raw.filter(0.1,45)
data=raw.get_data(units="uV")
sls=yasa.SleepStaging(raw,eeg_name='C3',eog_name='EOG R',emg_name='CHIN1')
hypno_pred=sls.predict()
hypno_pred=yasa.hypno_str_to_int(hypno_pred)
hypno_up=yasa.hypno_upsample_to_data(hypno_pred,sf_hypno=1/30,data=raw)
_,data_N2=yasa.sliding_window(data[0,hypno==2],sf,window=15)
data_N2.shape
f_pha=np.arange(0.375,4.25,0.25)
f_amp=np.arange(7.25,25.5,0.5)
from tensorpac import Pac
p=Pac(idpac=(2,0,0),f_pha=f_pha,f_amp=f_amp,verbose='WARNING')
xpac=p.filterfit(sf,data_N2)
p.comodulogram(xpac.mean(-1),title=str(p),vmin=0,plotas='imshow')
p.show() Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
sjg2203
Dec 7, 2022
Replies: 1 comment
-
Apparently, the first line has to be modified to look like the second one to work: _,data_N2=yasa.sliding_window(data[0,hypno==2],sf,window=15) _,data_N2=yasa.sliding_window(hypno==2,sf,window=15) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
sjg2203
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Apparently, the first line has to be modified to look like the second one to work: