NeuroAnalyzer tutorials: Analyze EEG (2)

Load data:

using NeuroAnalyzer
eeg = load("files/eeg.hdf");
[ Info: Loaded: EEG (24 × 282991 × 1; 1105.43 s)

Get range of frequencies and Nyquist frequency:

hz, nyq = freqs(eeg)
(hz = [0.0, 0.001, 0.002, 0.003, 0.004, 0.005, 0.005, 0.006, 0.007, 0.008  …  127.991, 127.992, 127.993, 127.994, 127.995, 127.996, 127.997, 127.998, 127.999, 128.0],
 nf = 128.0,)

Calculate signal total power:

total_power(eeg, ch="eeg")
19×1 Matrix{Float64}:
 173.3732896831565
 141.47002647136117
 888.6262295653551
  55.439625999264344
 155.32787478736196
  54.97653734115282
 187.74261331705785
 137.7240141739683
 193.38253046396542
 167.86208863281394
 165.71615077841642
 216.0046615885647
 153.01756642311403
 111.28217401284095
 176.04252545700322
 144.70381997135445
  13.583606096790557
  84.80880915039269
 186.1818494840585

Calculate band power:

band_power(eeg, ch="eeg", frq_lim=(8, 12.5))
19×1 Matrix{Float64}:
 1.1678222568550911
 0.44054265643028834
 0.9744307462302664
 0.2672112619823751
 1.5687486408289275
 0.5205797672378376
 2.240391650836055
 2.7007284748739524
 2.8042840930585196
 3.106236264510023
 1.1760485037197947
 0.8593372222520874
 2.0571271322929654
 2.0395687657279136
 2.7141531836113764
 2.7507459944522035
 0.27789185204524675
 0.8926802628621378
 2.311394173384165

Calculate maximum frequency of the beta band:

_, mfrq, _, _ = band_mpower(eeg, ch="eeg", frq_lim=band_frq(eeg, band=:beta), method=:fft)
plot_bar(mfrq[1:19, 1], xlabels=labels(eeg)[1:19], ylabel="Frequency [Hz]", title="Maximum β band frequency\n[epoch: 1]")

(!) band_mpower() returns mean band power, peak frequency of the band and power and amplitude at the peak frequency.

Calculate peak frequency of the alpha band:

peak_frq(eeg, ch="eeg", frq_lim=band_frq(eeg, band=:alpha))
19×1 Matrix{Float64}:
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0
 8.0

Calculate power at the peak frequency of the alpha band:

peak_pow(eeg, ch="eeg", frq_lim=band_frq(eeg, band=:alpha))
19×1 Matrix{Float64}:
 0.6541801854996789
 0.4306152749498006
 0.5952946091264317
 0.34801225807008423
 0.7858750458228905
 0.4922605813576842
 1.0153929039007477
 1.112382140803131
 1.14541521571877
 1.231051141278545
 0.6716029930311644
 0.609589804188452
 0.9768161690886735
 0.9908521271657713
 1.1354085081294263
 1.1891331766926283
 0.3707811362336822
 0.5969014733490882
 1.0164722624743883

Calculate amplitude at the peak frequency of the alpha band:

peak_amp(eeg, ch="eeg", frq_lim=band_frq(eeg, band=:alpha))
19×1 Matrix{Float64}:
 0.6541801854996789
 0.4306152749498006
 0.5952946091264317
 0.34801225807008423
 0.7858750458228905
 0.4922605813576842
 1.0153929039007477
 1.112382140803131
 1.14541521571877
 1.231051141278545
 0.6716029930311644
 0.609589804188452
 0.9768161690886735
 0.9908521271657713
 1.1354085081294263
 1.1891331766926283
 0.3707811362336822
 0.5969014733490882
 1.0164722624743883