From c5d585fa3c00a9b6f1813fe3752371a3b8a67865 Mon Sep 17 00:00:00 2001 From: Alberto Barradas Date: Wed, 11 Dec 2024 03:04:04 +0100 Subject: [PATCH] Fix: bug affecting sdsd feature --- src/TimeDomain.jl | 4 ++-- test/runtests.jl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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