Hi everyone, below is a toy data
import numpy as np
import mne
from copy import deepcopy as dpcpy
np.random.seed(10)
data = np.random.rand(24,1024)
data1 = np.random.rand(24,251)
data_ = np.concatenate((data, data1),axis=1)
ch_names = ["Fp1", "Fp2", "F3", "F4", "C3", "C4", "P3", "P4", "O1", "O2", "F7", "F8", "T7", "T8", "P7", "P8", "Fz", "Cz", "Pz", "M1", "M2", "AFz", "CPz", "POz"]
montage = mne.channels.make_standard_montage('standard_1020')
info = mne.create_info(ch_names=ch_names, sfreq=1000, ch_types='eeg').set_montage(montage, match_case=False)
raw = mne.io.RawArray(data_,info, copy='data', verbose=False)
raw.set_eeg_reference(projection=True)
EEG_bands = {'delta':(1, 4),
'theta':(4, 8),
'alpha':(8, 13),
'beta':(13, 32),
'gamma':(32, 125)}
for bandName in list(EEG_bands.keys())[1:6]:
eeg_data = raw.copy().filter(l_freq=EEG_bands[bandName][0],h_freq=EEG_bands[bandName][1], verbose=False)
# FFT Amplitude-Frequency Plots
psd, freqs = mne.time_frequency.psd_array_welch(eeg_data._data,eeg_data.info["sfreq"],n_fft=256,n_per_seg=None, average='mean')
spectrum = mne.time_frequency.SpectrumArray(data=psd,freqs=freqs, info=eeg_data.info)
fig_spec = spectrum.plot(spatial_colors=False, amplitude=True)
The outputs:
-
My question is in the output plots isnβt the curve suppose to drift towards zeros after their frequency range? why does do that after several frequency values?
-
Is it possible for the gamma band to have negative psd? and why?
-
Is there another method in mne I could use to get the amplitude frequency plot?
Thanks. Answers and corrections are welcome