[chronojump] Encoder inertial Loss don't use first 3 repetitions if discard 3 is active



commit 6685238aaa7b49535a4ccd75a5967b2678415919
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Jun 19 19:05:29 2017 +0200

    Encoder inertial Loss don't use first 3 repetitions if discard 3 is active

 src/gui/encoder.cs |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 82e4ef0..2872762 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -4447,13 +4447,28 @@ public partial class ChronoJumpWindow
                double maxThisSet = -100000;
                double minThisSet = 100000;
                double sum = 0;
+               int count = 0;
+
+               string eccon = findEccon(true);
+
+               foreach(double d in data)
+               {
+                       sum += d;
+
+                       //discardFirstThree repetitions if needed for Loss
+                       if(encoderConfigurationCurrent.has_inertia && discardFirstThree &&
+                                       ((eccon == "c" && count < 3) || (eccon != "c" && count < 6)) )
+                       {
+                               count ++;
+                               continue;
+                       }
 
-               foreach(double d in data) {
                        if(d > maxThisSet)
                                maxThisSet = d;
                        if(d < minThisSet)
                                minThisSet = d;
-                       sum += d;
+
+                       count ++;
                }
                if(maxThisSet <= 0)
                        return; 
@@ -4503,8 +4518,6 @@ public partial class ChronoJumpWindow
                        Pango.FontDescription.FromString ("Courier " + 
preferences.encoderCaptureBarplotFontSize.ToString());
                layout_encoder_capture_curves_bars_text.FontDescription.Weight = Pango.Weight.Bold;
                
-               string eccon = findEccon(true);
-
                Rectangle rect;
 
                Gdk.GC my_pen_ecc_con_e; //ecc-con eccentric
@@ -4513,7 +4526,7 @@ public partial class ChronoJumpWindow
                Gdk.GC my_pen;          //pen we are going to use
 
                int dLeft = 0;
-               int count = 0;
+               count = 0;
        
                //to show saved curves on DoPlot        
                TreeIter iter;


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