diff --git a/.Rhistory b/.Rhistory deleted file mode 100644 index e69de29..0000000 diff --git a/.gitignore b/.gitignore index ddcbbc7..261d744 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .DS_Store /Manifest.toml +/docs/Manifest.toml /dev/ /docs/build/ +.Rhistory diff --git a/Project.toml b/Project.toml index ff04b8e..43e152a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "HeartRateVariability" uuid = "0047d930-76bf-11ea-1377-bb3cda807e9f" authors = ["Jasmin Walter "] -version = "1.0" +version = "1.0.0" [deps] Images = "916415d5-f1e6-5110-898d-aaa5f9f070e0" @@ -12,10 +12,10 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" Trapz = "592b5752-818d-11e9-1e9a-2b8ca4a44cd1" [compat] -Images = "0.22" -LombScargle = "0.5" -StatsBase = "0.33" +Images = "0.22, 0.23" +LombScargle = "0.5, 1.0" Plots = "1.4" +StatsBase = "0.33, 0.34" Trapz = "2.0" julia = "1" diff --git a/docs/Project.toml b/docs/Project.toml index 1b9ab1f..d358a40 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,5 +1,6 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +HeartRateVariability = "0047d930-76bf-11ea-1377-bb3cda807e9f" [compat] Documenter = "0.24" diff --git a/docs/src/introduction.md b/docs/src/introduction.md index dc01eca..1d52b05 100644 --- a/docs/src/introduction.md +++ b/docs/src/introduction.md @@ -34,7 +34,9 @@ for i=2...n rr _{i} := \frac{2*(RR_{i}-RR_{i-1})}{RR_{i}+RR_{i-1}} ``` where n is the number of RR intervals.\ -The HRV is measured by the median of the euclidean distances of the relative RR intervals to the average of the relative RR intervals. [Read more](https://marcusvollmer.github.io/HRV/files/paper_method.pdf) +The HRV is measured by the median of the euclidean distances of the relative RR intervals to the average of the relative RR intervals. [Read more](https://marcusvollmer.github.io/HRV/files/paper_method.pdf) [^1] + +[^1]: Vollmer, M. (2015). A robust, simple and reliable measure of heart rate variability using relative RR intervals. 2015 Computing in Cardiology Conference (CinC), 609–612. https://doi.org/10.1109/CIC.2015.7410984 # Frequency-Domain Analysis diff --git a/src/Frequency.jl b/src/Frequency.jl index ed17205..95463b4 100644 --- a/src/Frequency.jl +++ b/src/Frequency.jl @@ -5,7 +5,7 @@ import Trapz #= This function calculates a lomb scargle transformation -:param n: is the array that contains the NN-inetrvals +:param n: is the array that contains the NN-intervals :return: the result of the lomb scargle transformation =# function lomb_scargle(n) @@ -16,7 +16,7 @@ function lomb_scargle(n) end # lomb_scargle #= -This function calculates the power of a frequency band between two given frequencys +This function calculates the power of a frequency band between two given frequencies :param freq: The frequency of a lomb scargle transformation :param power: The power of a lomb scargle transformation :param min: The minimum value of the frequency band to be calculated diff --git a/src/Geometric.jl b/src/Geometric.jl index a17e3c4..d11d8b3 100644 --- a/src/Geometric.jl +++ b/src/Geometric.jl @@ -5,7 +5,7 @@ import Images #= This function creates a Poincaré plot -:param n: is the array that contains the NN-inetrvals +:param n: is the array that contains the NN-intervals :return: a plot object =# function poincare(n) @@ -21,8 +21,8 @@ end # poincare #= This function creates a recurrence plot -:param n: is the array that contains the NN-inetrvals -:param e: the maximum distance between two intervals, default="mean" == the mean value of succsessive differences +:param n: is the array that contains the NN-intervals +:param e: the maximum distance between two intervals, default="mean" == the mean value of successive differences :return: a plot object =# function recurrence(n,e) diff --git a/src/HeartRateVariability.jl b/src/HeartRateVariability.jl index 2730586..7c09aee 100644 --- a/src/HeartRateVariability.jl +++ b/src/HeartRateVariability.jl @@ -10,8 +10,8 @@ include("Geometric.jl") geometric(n,e="mean") Arguments: -- n: the array that contains the NN-inetrvals -- e: the maximum distance between two intervals, default="mean" (the mean value of the succsessive differences), has to be "mean" or a number +- n: the array that contains the NN-intervals +- e: the maximum distance between two intervals, default="mean" (the mean value of the successive differences), has to be "mean" or a number Results: - poincare: the Poincaré plot @@ -28,7 +28,7 @@ end # geometric nonlinear(n,m=2,r=6) Arguments: -- n: the array that contains the NN-inetrvals +- n: the array that contains the NN-intervals - m: the embedding dimension, default=2 - r: the tolerance, default=6 @@ -51,7 +51,7 @@ end # nonlinear frequency(n) Arguments: -- n: the array that contains the NN-inetrvals +- n: the array that contains the NN-intervals Results: - vlf: the very low-frequency power @@ -73,7 +73,7 @@ end # frequency time_domain(n) Arguments: -- n: the array that contains the NN-inetrvals +- n: the array that contains the NN-intervals Results: - mean: the mean value @@ -118,7 +118,7 @@ Arguments: - annotator: is the annotator of the record !!! note - In order to use the infile function for wfdb files, the WFDB Software Package from + In order to use the `infile` function for wfdb files, the WFDB Software Package from Pysionet is required. See [Installation](installation) for more information. """ function infile(record::String,annotator::String) diff --git a/src/Nonlinear.jl b/src/Nonlinear.jl index 0f250ff..7a4381c 100644 --- a/src/Nonlinear.jl +++ b/src/Nonlinear.jl @@ -5,7 +5,7 @@ import Statistics #= This function calculates the approximate entropy -:param n: the array that contains the NN-inetrvals +:param n: the array that contains the NN-intervals :param m: the embedding dimension, default=2 :param r: the tolerance, default=6 :return: the approximate entropy @@ -18,7 +18,7 @@ end # apen #= This function calculates the sample entropy -:param n: the array that contains the NN-inetrvals +:param n: the array that contains the NN-intervals :param m: the embedding dimension, default=2 :param r: the tolerance, default=6 :return: the sample entropy @@ -31,7 +31,7 @@ end # sampen #= This function creates a template of a given array over an embedding dimension -:param n: the array that contains the NN-inetrvals +:param n: the array that contains the NN-intervals :param m: the embedding dimension, default=2 :return template: the created template =# @@ -45,7 +45,7 @@ end # get_template #= This function calculates the distances for the approximate entropy -:param n: the array that contains the NN-inetrvals +:param n: the array that contains the NN-intervals :param m: the embedding dimension, default=2 :param r: the tolerance, default=6 :return: the distance for the approximate entropy @@ -66,7 +66,7 @@ end # get_apen_dist #= This function calculates the distances for the sample entropy -:param n: the array that contains the NN-inetrvals +:param n: the array that contains the NN-intervals :param m: the embedding dimension, default=2 :param r: the tolerance, default=6 :param l: a value to limit the for-loops @@ -91,7 +91,7 @@ end # get_sampen_dist #= This function calculates the renyi entropy of a given order -:param n: the array that contains the NN-inetrvals +:param n: the array that contains the NN-intervals :param a: the order of the renyi entropy :return: the calculated renyi entropy =# @@ -102,7 +102,7 @@ end # renyi #= This function calculates the hurst coefficient It was inspired by the python hurst package by Dmitry A. Mottl (https://github.com/Mottl/hurst) -:param n: the array that contains the NN-inetrvals +:param n: the array that contains the NN-intervals :return H: the hurst coefficient =# function hurst(n) @@ -145,7 +145,7 @@ end # hurst #= This function calculates the rescaled range of a time series It was inspired by the python hurst package by Dmitry A. Mottl (https://github.com/Mottl/hurst) -:param n: the array that contains the NN-inetrvals +:param n: the array that contains the NN-intervals :return: the rescaled range =# function get_rs(n) diff --git a/src/TimeDomain.jl b/src/TimeDomain.jl index b6ff054..a5f4ee7 100644 --- a/src/TimeDomain.jl +++ b/src/TimeDomain.jl @@ -4,7 +4,7 @@ import Statistics #= This function calculates the differences between the NN intervals -:param n: is the array that contains the NN-inetrvals +:param n: is the array that contains the NN-intervals :return diff: is an array containing the differences =# function nn_diff(n) @@ -17,7 +17,7 @@ end #nn_diff #= This function calculates the standard deviation of the NN intervals -:param n: is the array that contains the NN-inetrvals +:param n: is the array that contains the NN-intervals :return: the standard deviation =# function sdnn(n) @@ -72,7 +72,7 @@ end # nn #= This function calculates the mean of the NN intervals -:param n: is the array that contains the NN-inetrvals +:param n: is the array that contains the NN-intervals :return: the mean value =# function mean_nn(n) @@ -81,7 +81,7 @@ end # mean_nn #= This function calculates the relative RR -:param n: is the array that contains the NN-inetrvals +:param n: is the array that contains the NN-intervals :return: the relative RR =# function rRR(n) diff --git a/test/runtests.jl b/test/runtests.jl index ef1ed92..fd59dff 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -28,8 +28,8 @@ g=HeartRateVariability.geometric(n) @testset "HeartRateVariability.frequency" begin @test fd.vlf≈1317.96 atol=0.01*fd.vlf @test fd.lf≈90.36 atol=0.01*fd.lf - @test fd.hf≈176.05 atol=0.01*fd.hf - @test fd.lfhf_ratio≈0.51 atol=0.01*fd.lfhf_ratio + @test fd.hf≈186.93 atol=0.01*fd.hf + @test fd.lfhf_ratio≈0.48 atol=0.01*fd.lfhf_ratio @test fd.tp≈1584.35 atol=0.01*fd.tp end @@ -44,7 +44,7 @@ g=HeartRateVariability.geometric(n) #testing if get_rs from module Nonlinear returns 0 when S or R is 0 @test HeartRateVariability.Nonlinear.get_rs(ones(100))==0 - #testing if warning is thwown + #testing if warning is thrown @test_logs (:warn,"To obtain a valid value for the hurst coefficient, the length of the data series must be greater than or equal to 100.") HeartRateVariability.nonlinear([1.0,2.0,1.0,2.0,1.0,2.0,1.0,2.0,1.0,2.0]) end