NeuroAnalyzer tutorials: Edit EEG (4)

Resample:

sr(eeg)
eeg_512 = NeuroAnalyzer.resample(eeg, new_sr=512)
eeg_128 = NeuroAnalyzer.resample(eeg, new_sr=128)

Create virtual channel:

vc = vch(eeg, f="mean(fp1 + fp2) / cz")

Any external formula/operation/function may be applied to EEG signal using apply() function:

ch_avg = apply(eeg, f="mean(eeg, dims=1)", ch=1:4)

In the formula eeg indicates EEG object. Function f will be applied to all channels specified by channel (default is all EEG/MEG channels).

Getting band frequency range:

band_frq(eeg, band=:alpha)
filter!(eeg, fprototype=:butterworth, ftype=:bp, cutoff=band_frq(eeg, band=:alpha), order=8)

(!) Band range is truncated is Nyquist frequency based on EEG sampling rate (128.0) is lower than the band range, e.g.  gamma range (30.0-150.0 Hz) is truncated to: 30.0-127.9 Hz for 128 Hz signal.

Get channel numbers by channel picks (set of electrodes):

e = channel_pick(eeg, p=:c)                             # central
labels(eeg)[e]
e = channel_pick(eeg, p=[:l, :f, :t])                   # left fronto-temporal
labels(eeg)[e]

(!) Available picks: :central (:c), :left (:l), :right (:r), :frontal (:f), :temporal (:t), :parietal (:p), :occipital (:o).

Get channel numbers by channels cluster:

channel_cluster(eeg, cluster=:f1)

Channel clusters:

Convert samples to seconds/seconds to samples:

s2t(eeg, s=1234)
t2s(eeg, t=10)