NeuroAnalyzer tutorials: Process EEG (3)

Normalize:

normalize!(eeg, method=:zscore)
normalize!(eeg, method=:minmax)

(!) To get the list of all available methods, use ?normalize.

Remove DC:

remove_dc!(eeg)

Taper:

taper!(eeg, t=generate_window(:hann, epoch_len(eeg)))
taper!(eeg, t=hanning(epoch_len(eeg))) # some tapers require DSP.jl

Calculate signal derivative:

derivative!(eeg)

Detrend:

detrend!(eeg, type=:constant)

Time-domain convolution:

mw = generate_morlet(256, 1, 32, complex=true)
tconv!(eeg, kernel=mw)

Frequency-domain convolution:

mw = generate_morlet(256, 1, 32, complex=true)
s_conv = fconv(eeg, kernel=mw)
eeg.data = abs.(s_conv)

Denoising using Wiener deconvolution:

denoise_wien!(eeg)

Generate PCA:

pc, pc_var, pc_m, pc_model = pca_decompose(eeg, n=10)

View components variance:

p = Plots.bar(pc_var, legend=false, xticks=1:10, ylabel="% of total variance")
plot_save(p, file_name="pca_var.png")

Reconstruct signal using PCA components:

pca_reconstruct(e10, pc, pc_model);