NeuroAnalyzer tutorials: Edit EEG (4)

Load data:

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

Show sampling rate:

sr(eeg)
256

Resample to 512 Hz:

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

Resample to 128 Hz:

eeg_128 = NeuroAnalyzer.resample(eeg, new_sr=128);
sr(eeg_128)
[ Warning: To prevent aliasing due to down-sampling, a low-pass filter should be applied before removing data points. The filter cutoff should be the Nyquist frequency of the new down-sampled rate, (64.0 Hz), not the original Nyquist frequency (128.0 Hz).
[ Warning: New sampling rate should be easily captured by integer fractions e.g. 1000 Hz → 250 Hz or 256 Hz → 512 Hz.
128

Calculate band frequency range:

band_frq(eeg, band=:alpha)
NeuroAnalyzer.filter!(eeg, ch="all", fprototype=:butterworth, ftype=:bp, cutoff=band_frq(eeg, band=:alpha), order=8)
[ Info: Signal should be tapered prior to filtering to reduce edge artifacts

(!) 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.