[chronojump] Fixed inertia-momentum.R (EMD was missing)



commit 2b55410005d8266ea1f27850c686bcfe59575a25
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Mar 27 13:34:16 2014 +0100

    Fixed inertia-momentum.R (EMD was missing)

 encoder/inertia-momentum.R |    7 ++++---
 src/utilEncoder.cs         |    7 ++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/encoder/inertia-momentum.R b/encoder/inertia-momentum.R
index d40f9ad..79145fe 100644
--- a/encoder/inertia-momentum.R
+++ b/encoder/inertia-momentum.R
@@ -35,8 +35,6 @@
 #Measure weight
 #Measure distance between centre of axis and centre of weight
 
-library("EMD")
-
 calculate <- function (displacement, mass, length)
 {
        #cumulative movement of the encoder
@@ -83,12 +81,15 @@ print(args)
 optionsFile = args[1]
 print(optionsFile)
 
-options = getOptionsFromFile(optionsFile, 4)
+options = getOptionsFromFile(optionsFile, 5)
 
 fileInput = options[1]
 fileOutput = options[2]
 mass = as.numeric(options[3]) / 1000.0         # g -> Kg
 length = as.numeric(options[4]) / 100.0        #cm -> m
+scriptUtilR = options[5]
+               
+source(scriptUtilR)
 
 displacement = scan(file=fileInput, sep=",")
 
diff --git a/src/utilEncoder.cs b/src/utilEncoder.cs
index 97b1af5..2033f5a 100644
--- a/src/utilEncoder.cs
+++ b/src/utilEncoder.cs
@@ -401,6 +401,9 @@ public class UtilEncoder
                string inputData = GetEncoderDataTempFileName();
                string outputData = GetEncoderSpecialDataTempFileName();
                string operatingSystem = "Linux";
+               
+               string scriptUtilR = GetEncoderScriptUtilR();
+
                        
                pBin="Rscript";
                if (UtilAll.IsWindows()) {
@@ -411,6 +414,7 @@ public class UtilEncoder
                        //On win32 R understands backlash as an escape character and 
                        //a file path uses Unix-like path separator '/'         
                        inputData = inputData.Replace("\\","/");
+                       scriptUtilR = scriptUtilR.Replace("\\","/");
                        operatingSystem = "Windows";
                }
                
@@ -419,7 +423,8 @@ public class UtilEncoder
                        inputData + "\n" + 
                        outputData + "\n" + 
                        Util.ConvertToPoint(weight) + "\n" + 
-                       Util.ConvertToPoint(length) + "\n";
+                       Util.ConvertToPoint(length) + "\n" +
+                       scriptUtilR + "\n";
 
                string optionsFile = Path.GetTempPath() + "Roptions.txt";
                TextWriter writer = File.CreateText(optionsFile);


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