diff --git a/src/TimeDomain.jl b/src/TimeDomain.jl index b6ff054..901a995 100644 --- a/src/TimeDomain.jl +++ b/src/TimeDomain.jl @@ -10,7 +10,7 @@ This function calculates the differences between the NN intervals function nn_diff(n) diff=[] for i in 1:length(n)-1 - push!(diff,abs(n[i+1]-n[i])) + push!(diff,n[i+1]-n[i]) end return diff end #nn_diff @@ -63,7 +63,7 @@ with an interval smaller than x ms function nn(diff,x) count=0 for d in diff - if d>x + if abs(d)>x count+=1 end end diff --git a/test/runtests.jl b/test/runtests.jl index ef1ed92..2c600ae 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,7 +17,7 @@ g=HeartRateVariability.geometric(n) @test td.mean≈917.24 atol=0.1 @test td.sdnn≈137.19 atol=0.1 @test td.rmssd≈27.85 atol=0.1 - @test td.sdsd≈20.35 atol=0.1 + @test td.sdsd≈27.85 atol=0.1 @test td.nn50≈342 atol=1 @test td.pnn50≈4.41 atol=0.1 @test td.nn20≈2831 atol=1