Quickstart

Data import

The data can be read from a wfdb file using the infile function. Therefore, the name and the annotator of the record are passed to the function. For the record "e1034.atr" with the header "e1304.hea" the name to be passed is "e1034" and the annotator is "atr".

data = HeartRateVariability.infile("e1304","atr")

Additionally, txt or csv files can be read in by passing the path of the file as a parameter.

data = HeartRateVariability.infile("e1304.txt")
7749-element Array{Float64,1}:
 1012.0
 1060.0
 1032.0
 1016.0
 1048.0
 1040.0
 1000.0
 1024.0
 1032.0
 1016.0
    ⋮  
  984.0
  984.0
  968.0
  984.0
  992.0
 1000.0
  976.0
  984.0
  960.0

Analysis

To analyze the read-in data, the array with the data is passed to the respective analysis function. The results are returned in a NamedTuple.

Time-Domain Analysis

td = HeartRateVariability.time_domain(data)
(mean = 917.2383533359143, sdnn = 137.19197570712333, rmssd = 27.851698122032825, sdsd = 20.350491197577416, nn50 = 342, pnn50 = 4.413472706155633, nn20 = 2831, pnn20 = 36.53374628984385, rRR = 2.6720295372559373)

Frequency-Domain Analysis

fd = HeartRateVariability.frequency(data)
(vlf = 1317.9631561672747, lf = 90.38016220994561, hf = 176.00784051905248, lfhf_ratio = 0.5135007732803935, tp = 1584.3511588962729)

Nonlinear Analysis

nl = HeartRateVariability.nonlinear(data)
(apen = 2.160517686955837, sampen = 2.160500144698439, hurst = 0.3666486738258125, renyi0 = -6.821367365783195, renyi1 = -6.833600205199867, renyi2 = -6.843489365034748)

Geometric Analysis

g = HeartRateVariability.geometric(data)
(poincare = Plot{Plots.GRBackend() n=1}, recurrence = Plot{Plots.GRBackend() n=1})

The different results in the NamedTuple can be output individually by calling the result name.

g.poincare
g.recurrence

The data used in this example is from the European ST-T Database[1] and was found on Physionet[2].

  • 1Taddei A, Distante G, Emdin M, Pisani P, Moody GB, Zeelenberg C, Marchesi C. The European ST-T Database: standard for evaluating systems for the analysis of ST-T changes in ambulatory electrocardiography. European Heart Journal 13: 1164-1172 (1992).
  • 2Goldberger, A., Amaral, L., Glass, L., Hausdorff, J., Ivanov, P. C., Mark, R., ... & Stanley, H. E. (2000). PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals. Circulation [Online]. 101 (23), pp. e215–e220.