NeuroAnalyzer tutorials: HRV

Heart rate variability (HRV) is the physiological phenomenon of variation in the time interval between heartbeats. It is measured by the variation in the beat-to-beat interval (source: Wikipedia).

NeuroAnalyzer allows detecting and analysis of HRV using ECG channel.

The following time-domain parameters are analyzed:

nn_seg, r_idx = hrv_detect(eeg)

Output:

[ Info: ECG channel found: 24
[ Info: Detected NN segments: 1288

Check peaks:

ecg = eeg.data[24, :, :][:]
p = Plots.plot(ecg[1:20*sr(eeg)],               # 20 seconds
               lc=:black,
               lw=0.5,
               legend=false,
               yticks=false,
               xticks=false)
p = Plots.vline!(r_idx[1:21],                   # 21 peaks
                 ls=:dot,
                 lc=:red,
                 alpha=0.5)
plot_save(p, file_name="images/rr.png")

hrv_analyze(nn_seg)

Results:

menn = 926.176
mdnn = 937.5
vnn = 6966.958
sdnn = 83.468
rmssd = 68.297
sdsd = 68.323
nn50 = 27
pnn50 = 0.021
nn20 = 67
pnn20 = 0.052