[chronojump] Fix on forcePosition.R detection of pre first rep



commit 043d2b254a94d8f238b0cd0c3cc80d9efa8d6600
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Feb 13 18:44:45 2020 +0100

    Fix on forcePosition.R detection of pre first rep

 r-scripts/forcePosition.R | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/r-scripts/forcePosition.R b/r-scripts/forcePosition.R
index 08bb6da9..d7162ba1 100644
--- a/r-scripts/forcePosition.R
+++ b/r-scripts/forcePosition.R
@@ -139,10 +139,10 @@ getRepetitions <- function(time, position, force, conMinDisplacement, eccMinDisp
 
        # to find if there is a previous extreme than first one with minDisplacement
        searchingFirstExtreme = TRUE
-       minimumPosBeforeFirstExtreme = 1;
-       maximumPosBeforeFirstExtreme = 1;
-       minimumValueBeforeFirstExtreme = position[minimumPosBeforeFirstExtreme];
-       maximumValueBeforeFirstExtreme = position[maximumPosBeforeFirstExtreme];
+       minimumPosBeforeFirstExtreme = 1
+       maximumPosBeforeFirstExtreme = 1
+       minimumValueBeforeFirstExtreme = position[minimumPosBeforeFirstExtreme]
+       maximumValueBeforeFirstExtreme = position[maximumPosBeforeFirstExtreme]
 
         #Detecting the first phase type
         if(position[currentSample] > position[possibleExtremeSample])
@@ -201,7 +201,8 @@ getRepetitions <- function(time, position, force, conMinDisplacement, eccMinDisp
                                {
                                        points(x=samplePreFirst, y=position[samplePreFirst], col="blue", 
cex=8)
                                        extremesSamples_l = c(extremesSamples_l, samplePreFirst)
-                                       lastExtremeSample = possibleExtremeSample
+                                       #lastExtremeSample = possibleExtremeSample
+                                       lastExtremeSample = samplePreFirst
                                }
                                searchingFirstExtreme = FALSE
                        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]