[chronojump] ForceSensor graph fixed duration (was int, now double)



commit c89b95ff2178407677a6c72e41f7ece9c194fc10
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Feb 10 16:45:40 2021 +0100

    ForceSensor graph fixed duration (was int, now double)

 r-scripts/maximumIsometricForce.R  |  4 ++--
 src/forceSensor.cs                 | 14 +++++++-------
 src/gui/app1/forceSensor.cs        |  4 ++--
 src/gui/app1/forceSensorAnalyze.cs |  4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)
---
diff --git a/r-scripts/maximumIsometricForce.R b/r-scripts/maximumIsometricForce.R
index 65fcfbb2..5be4aac2 100644
--- a/r-scripts/maximumIsometricForce.R
+++ b/r-scripts/maximumIsometricForce.R
@@ -878,7 +878,7 @@ getBestFit <- function(originalTest
         
         maxMovingAverageForce = max(movingAverageForce[startSample:endSample])
         
-    } else if (testLength <= -1)    #The user selected to detect a decrease in the force
+    } else #The user selected to detect a decrease in the force
     {
         print("Detection of endSample by decrease in the force")
         print(paste("percentChange: ", percentChange))
@@ -970,7 +970,7 @@ getBestFit <- function(originalTest
     }
     
     startSample = startSample -1
-    if (testLength <= -1)
+    if (testLength < 0)
     {
       endSample = endSample -1
     }
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index 60dd2158..3ffc21bd 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -1455,7 +1455,7 @@ public class ForceSensorGraph
        bool vline50fmax_fitted;
        bool hline50fmax_raw;
        bool hline50fmax_fitted;
-       int testLength;
+       double testLength;
        string title;
        string exercise;
        string datetime;
@@ -1468,7 +1468,7 @@ public class ForceSensorGraph
        //private method to help on assigning params
        private void assignGenericParams(
                        List<ForceSensorRFD> rfdList,
-                       ForceSensorImpulse impulse, int testLength, int percentChange,
+                       ForceSensorImpulse impulse, double testLength, int percentChange,
                        bool startEndOptimized, bool decimalIsPoint)
        {
                //generic of any data
@@ -1490,7 +1490,7 @@ public class ForceSensorGraph
        //constructor for analyze one graph of a set from startSample to endSample. singleOrMultiple = true
        public ForceSensorGraph(
                        List<ForceSensorRFD> rfdList,
-                       ForceSensorImpulse impulse, int testLength, int percentChange,
+                       ForceSensorImpulse impulse, double testLength, int percentChange,
                        bool startEndOptimized,
                        bool decimalIsPoint,
                        ForceSensorGraphAB fsgAB
@@ -1512,7 +1512,7 @@ public class ForceSensorGraph
        //constructor for export. singleOrMultiple = false
        public ForceSensorGraph(
                        List<ForceSensorRFD> rfdList,
-                       ForceSensorImpulse impulse, int testLength, int percentChange,
+                       ForceSensorImpulse impulse, double testLength, int percentChange,
                        bool startEndOptimized,
                        bool decimalIsPoint, //this param is not used here. it is in fsgAB_l
                        List<ForceSensorGraphAB> fsgAB_l
@@ -1593,7 +1593,7 @@ public class ForceSensorGraph
                }
 
                scriptOptions +=
-                       "\n#testLength\n" +             testLength.ToString() + "\n" +
+                       "\n#testLength\n" +             Util.ConvertToPoint(testLength) + "\n" +
                        "#captureOptions\n" +           captureOptionsStr + "\n" +      //unused on multiple
                        "#title\n" +                    title + "\n" +                  //unused on multiple
                        "#exercise\n" +                 exercise + "\n" +               //unused on multiple
@@ -2268,7 +2268,7 @@ public class ForceSensorExport
        private int sessionID;
        private List<ForceSensorRFD> rfdList;
        private ForceSensorImpulse impulse;
-       private int duration;
+       private double duration;
        private int durationPercent;
        private double forceSensorElasticEccMinDispl;
        private int forceSensorNotElasticEccMinForce;
@@ -2294,7 +2294,7 @@ public class ForceSensorExport
                        Gtk.ProgressBar progressbar,
                        bool isWindows, int personID, int sessionID,
                        List<ForceSensorRFD> rfdList, ForceSensorImpulse impulse,
-                       int duration, int durationPercent,
+                       double duration, int durationPercent,
                        double forceSensorElasticEccMinDispl,
                        int forceSensorNotElasticEccMinForce,
                        double forceSensorElasticConMinDispl,
diff --git a/src/gui/app1/forceSensor.cs b/src/gui/app1/forceSensor.cs
index 5c828161..9db9f539 100644
--- a/src/gui/app1/forceSensor.cs
+++ b/src/gui/app1/forceSensor.cs
@@ -2143,9 +2143,9 @@ LogB.Information(" fs R ");
                Util.FileDelete(imagePath);
                image_force_sensor_graph.Sensitive = false;
 
-               int duration = -1;
+               double duration = -1;
                if(radio_force_duration_seconds.Active)
-                       duration = Convert.ToInt32(spin_force_duration_seconds.Value);
+                       duration = Convert.ToDouble(spin_force_duration_seconds.Value);
 
                //string title = lastForceSensorFile;
                string title = currentPerson.Name;
diff --git a/src/gui/app1/forceSensorAnalyze.cs b/src/gui/app1/forceSensorAnalyze.cs
index 5e634a62..95f43130 100644
--- a/src/gui/app1/forceSensorAnalyze.cs
+++ b/src/gui/app1/forceSensorAnalyze.cs
@@ -744,9 +744,9 @@ public partial class ChronoJumpWindow
        ForceSensorExport forceSensorExport;
        private void button_force_sensor_export_session (int personID)
        {
-               int duration = -1;
+               double duration = -1;
                if(radio_force_duration_seconds.Active)
-                       duration = Convert.ToInt32(spin_force_duration_seconds.Value);
+                       duration = Convert.ToDouble(spin_force_duration_seconds.Value);
 
                forceSensorExport = new ForceSensorExport (
                                notebook_force_sensor_export,


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