I am reproducing the results reported by the author in a research paper. In which he takes the STFT of EEG signals. The input data has a shape of (1 X500) and I used Scipy library built-in function to calculate STFT and the output has shape (257 x32) I need to extract the data between two frequency bands (6-13 Hz) and (17-30 Hz). The author reports the extracted bands to be of the size of (16 X 32) and (23 X 32) but in none of the setting, I am getting this frequency resolution. I tried contacting the author but no response so far. I hope some of you could direct me in the right direction. Thank you very much.
wlen=64 nfft=1024 temp=S1_769_test[3,0,:] win=signal.get_window(window='blackman',Nx=wlen, fftbins=True) f, t, Zxx = signal.stft(temp,fs=500,window=win,noverlap=50,nfft=nfft,nperseg=wlen, boundary=None,padded=False,return_onesided=True) dat=np.abs(Zxx)/250 if (nfft % 2): # odd nfft excludes Nyquist point dat[2:,:] = dat[2:,:]*2 else: # even nfft includes Nyquist point dat[2:-1,:]= dat[2:-1,:]*2 band1=np.where((f >= 6) & (f <=13)) band2=np.where((f >= 17) & (f <=30)) extracted1=np.squeeze(dat[band1,:]) extracted2=np.squeeze(dat[band2,:]) extracted2 = cv2.resize(extracted2, dsize=(32,15), interpolation=cv2.INTER_CUBIC) Combined=np.vstack([extracted1,extracted2]) print (len(band2)) print (len(band1))