[chronojump] Fixed cvRMSSD (needed sqrt and dividing by mean) (and also *100 to be percentage)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixed cvRMSSD (needed sqrt and dividing by mean) (and also *100 to be percentage)
- Date: Wed, 5 May 2021 11:30:00 +0000 (UTC)
commit c2e1a69ee4e46811a35bde15c8f32ade71d56bbf
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed May 5 13:29:04 2021 +0200
Fixed cvRMSSD (needed sqrt and dividing by mean) (and also *100 to be percentage)
src/forceSensor.cs | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index b86c8928..b2a58485 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -1123,15 +1123,25 @@ public class ForceSensorCapturePoints
}
private double getVariabilityCVRMSSD (int countA, int countB, int numSamples)
{
- //Σ(x_i - x_{i+1})^2 /(n-1)) //note pow should be inside the summation
+ //see a test of this method below:
+ //public static void TestVariabilityCVRMSSD()
+
+ //sqrt(Σ( x_i - x_{i+1})^2 /(n-1)) ) //note pow should be inside the summation
double sum = 0;
+ double sumForMean = 0;
for(int i = countA; i < countB; i ++)
{
sum += Math.Pow(forces[i] - forces[i+1], 2);
+ sumForMean += forces[i];
}
- return UtilAll.DivideSafe(sum, numSamples -1);
+ double rmssd = Math.Sqrt(UtilAll.DivideSafe(sum, numSamples -1));
+ LogB.Information("RMSSD: " + rmssd.ToString());
+
+ //sumForMean += forces[countB]; //need this?
+ double mean = sumForMean / numSamples;
+ return 100 * UtilAll.DivideSafe(rmssd, mean);
}
private double getVariabilityOldMethod (int countA, int countB, int numSamples)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]