using NeuroAnalyzer
using Plots
= load("files/eeg.hdf"); eeg
[ Info: Loaded: EEG (24 × 282991 × 1; 1105.43 s)
Load data:
using NeuroAnalyzer
using Plots
= load("files/eeg.hdf"); eeg
[ Info: Loaded: EEG (24 × 282991 × 1; 1105.43 s)
Calculate PSD data using Welch periodogram:
= psd(eeg, ch="all", db=true) p, f
(p = [19.072115171958423 18.477655517286433 … -19.051774776221087 -22.059516911184026; 18.149282286022896 17.86233437201902 … -18.972406450309784 -21.983182581810844; … ; 20.30503678721386 19.89942102519797 … -16.586922185450113 -19.602239724621178; 26.119689962454476 29.21800948676856 … -11.05757415631208 -14.077842397490471;;;],
f = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 … 119.0, 120.0, 121.0, 122.0, 123.0, 124.0, 125.0, 126.0, 127.0, 128.0],)
Draw scatter plot of PSD data, channel 1 (Fp1):
scatter(f, p[1, :], ms=1, legend=false)
Calculate and plot PSD slope:
= psd_slope(eeg, ch="Fp1", db=true)
lf, ls, pf plot!(pf, lf[1, :, 1], title="slope = $(round(ls[1, 1], digits=2))") Plots.
Calculate PSD slope of the alpha band:
= psd_slope(eeg, ch="Fp1", frq_lim=(8, 14), db=true) f, ps, frq
(lf = [-4.308386220222146 -4.752628776771901 … -6.529599002970921 -6.973841559520677;;;],
ls = [-0.44424255654975475;;],
pf = [8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0],)