using NeuroAnalyzer
using Plots
= load("files/eeg.hdf");
eeg = epoch(eeg, ep_len=10); e10
[ Info: Loaded: EEG (24 × 282991 × 1; 1105.43 s)
Load data:
using NeuroAnalyzer
using Plots
= load("files/eeg.hdf");
eeg = epoch(eeg, ep_len=10); e10
[ Info: Loaded: EEG (24 × 282991 × 1; 1105.43 s)
Plot autocovariance:
= acov(e10, ch="all", l=100)
ac, l plot_xac(ac[1, :, 1], l, title="Autocovariance")
There are repetitive positive peaks every 0.2 s, due to dominating 50 Hz line noise in the source signal. Every 0.1 s there are negative peaks due to shifting the signal by 1/2 of the 50 Hz cycle. axc2frq()
can be used to detect these peaks and transform into frequencies:
= acor(eeg, ch="all", l=10)
ac, l axc2frq(ac[1, :, 1], l)
1-element Vector{Float64}:
50.0
By default, biased autocovariance is calculated. To calculate unbiased autocovariance:
= acov(e10, ch="all", biased=false) ac, l
(ac = [38.031 39.436 38.031; 50.966 55.347 50.966; … ; 31.66 37.593 31.66; 7495.504 8319.962 7495.504;;; 45.664 47.078 45.664; 44.82 49.409 44.82; … ; 90.27 96.7 90.27; 7013.765 7755.839 7013.765;;; 54.726 56.095 54.726; 67.946 72.526 67.946; … ; 118.218 124.818 118.218; 7589.653 8393.648 7589.653;;; … ;;; 89.715 96.515 89.715; 29.439 46.119 29.439; … ; 76.562 97.118 76.562; 6672.659 7395.422 6672.659;;; 62.36 69.378 62.36; 10.726 26.207 10.726; … ; 128.603 148.23 128.603; 7246.448 8034.943 7246.448;;; 107.593 114.524 107.593; 17.412 33.351 17.412; … ; 100.361 120.407 100.361; 7224.113 8005.492 7224.113],
l = [-0.00390625, 0.0, 0.00390625],)
Plot autocorrelation (which is a standardized covariance):
= acor(e10, ch="all", l=100)
ac, l plot_xac(ac[1, :, 1], l, title="Autocorrelation")
Plot cross-covariance:
= xcov(e10, e10, ch1="Fp1", ch2="Fp2", l=100)
xc, l plot_xac(xc[1, :, 1], l, title="Cross-covariance") NeuroAnalyzer.
Plot cross-correlation (which is a standardized cross-covariance):
= xcor(e10, e10, ch1="Fp1", ch2="Fp2", l=100)
xc, l plot_xac(xc[1, :, 1], l, title="Cross-correlation") NeuroAnalyzer.