[chronojump] on ecc-con single curve, only calculate smoothings for selected curve



commit ce3f4f807c83fcf5f179eaa6d7167f9a67fecac8
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Jul 31 14:39:34 2016 +0200

    on ecc-con single curve, only calculate smoothings for selected curve

 encoder/graph.R            |   19 ++++++++++++++-----
 encoder/graphSmoothingEC.R |   11 ++++++++++-
 2 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index d79f6da..aa4cd6a 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2426,9 +2426,14 @@ doProcess <- function(options)
                        for(i in 1:n)
                                SmoothingsEC[i] = 0
                }
-               else
-                       SmoothingsEC = findSmoothingsEC(singleFile, displacement, curves, op$Eccon, 
op$SmoothingOneC,
+               else {
+                       singleCurveNum <- -1
+                       if(op$Analysis == "single" && op$Jump > 0)
+                               singleCurveNum <- op$Jump
+                       SmoothingsEC <- findSmoothingsEC(singleFile, displacement, curves, singleCurveNum, 
op$Eccon, op$SmoothingOneC,
                                                        NULL, NULL, NULL, NULL) #this row is only needed for 
singleFile (signal)
+               }
+               
                print(c("SmoothingsEC:",SmoothingsEC))
        } else {        #singleFile == True. reads a signal file
                displacement <- scan(file=op$File,sep=",")
@@ -2519,11 +2524,15 @@ doProcess <- function(options)
                        for(i in 1:n)
                                SmoothingsEC[i] = 0
                }
-               else
-                       SmoothingsEC = findSmoothingsEC(
-                                                       singleFile, displacement, curves, op$Eccon, 
op$SmoothingOneC,
+               else {
+                       singleCurveNum <- -1
+                       if(op$Analysis == "single" && op$Jump > 0)
+                               singleCurveNum <- op$Jump
+                       SmoothingsEC <- findSmoothingsEC(
+                                                       singleFile, displacement, curves, singleCurveNum, 
op$Eccon, op$SmoothingOneC,
                                                        op$EncoderConfigurationName, op$diameter, 
op$inertiaMomentum, op$gearedDown 
                                                        ) #second row is needed for singleFile (signal)
+               }
 
                print(c("SmoothingsEC:",SmoothingsEC))
                
diff --git a/encoder/graphSmoothingEC.R b/encoder/graphSmoothingEC.R
index c01f24d..36ebfd2 100644
--- a/encoder/graphSmoothingEC.R
+++ b/encoder/graphSmoothingEC.R
@@ -82,7 +82,10 @@ findSmoothingsECYPoints <- function(eccentric.concentric, conStart, conEnd, x, m
 
 #called on "ec" and "ce" to have a smoothingOneEC for every curve
 #this smoothingOneEC has produce same speeds than smoothing "c"
-findSmoothingsEC <- function(singleFile, displacement, curves, eccon, smoothingOneC,
+
+#on op$Analysis=="single", singleCurveNum is the curve that has to be analysed.
+#On the rest of op$Analysis, singleCurveNum is -1 meaning "All"
+findSmoothingsEC <- function(singleFile, displacement, curves, singleCurveNum, eccon, smoothingOneC,
                             singleFileEncoderConfigurationName, singleFileDiameter, 
singleFileInertiaMomentum, singleFileGearedDown)
 {
        ptm <- as.vector(proc.time()[3])
@@ -108,6 +111,12 @@ findSmoothingsEC <- function(singleFile, displacement, curves, eccon, smoothingO
                        if( (singleFile && eccon == "c") || (! singleFile && curves[i,8] == "c") )
                                smoothings[i] = 0
                        else {
+                               #on op$Analysis=="single", only analyse one curve
+                               if(singleCurveNum > 0 && i != singleCurveNum) {
+                                       smoothings[i] = 0
+                                       next
+                               }
+
 #0 find concentric
                                eccentric.concentric = displacement[curves[i,1]:curves[i,2]]
 


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