[chronojump] Encoder: fixed read curves files ending with comma
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder: fixed read curves files ending with comma
- Date: Sat, 2 Mar 2013 12:04:53 +0000 (UTC)
commit 07c11fd30ab6fb2d7476f972e30d6e162ae3f439
Author: Xavier de Blas <xaviblas gmail com>
Date: Sat Mar 2 13:04:00 2013 +0100
Encoder: fixed read curves files ending with comma
encoder/graph.R | 8 ++++++++
src/util.cs | 8 +++++++-
2 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 0484045..298d608 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -179,6 +179,9 @@ reduceCurveBySpeed <- function(eccon, row, startT, rawdata, smoothing) {
#go here with every single jump
kinematicsF <- function(a, mass, smoothingOne, g, eccon, analysisOptions) {
+ print("length unique x in spline")
+ print(length(unique(1:length(a))))
+
speed <- smooth.spline( 1:length(a), a, spar=smoothingOne)
accel <- predict( speed, deriv=1 )
#speed comes in mm/ms when derivate to accel its mm/ms^2 to convert it to m/s^2 need to *1000 because
it's quadratic
@@ -915,6 +918,11 @@ doProcess <- function(options) {
}
dataTempFile=scan(file=as.vector(inputMultiData$fullURL[i]),sep=",")
+
+ #if curves file ends with comma. Last character will be an NA. remove it
+ #this removes all NAs on a curve
+ dataTempFile = dataTempFile[!is.na(dataTempFile)]
+
dataTempPhase=dataTempFile
processTimes = 1
changePos = 0
diff --git a/src/util.cs b/src/util.cs
index 152c4a2..84251c5 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1307,7 +1307,13 @@ public class Util
contents = contents.Substring(
Convert.ToInt32(startAndDuration[0]),
Convert.ToInt32(startAndDuration[1])-1); //-1 is for not ending file with a
comma
-
+ //don't know why but some curves are stored with a "," as last character
+ //this curves also are in the form: "1, 2, 3, 4," instead of "1,2,3,4"
+ //this produces an NA in reading of curves on graph.R
+ //in the meantime this NA in reading in graph.R has been deleted
+ //dataTempFile = dataTempFile[!is.na(dataTempFile)]
+
+
string fileCurve = uniqueID.ToString() + "-" + personName + "-" +
(++ curveIDMax).ToString() + "-" + timeStamp + ".txt";
string fileCurveFull = GetEncoderSessionDataCurveDir(sessionID) + Path.DirectorySeparatorChar
+ fileCurve;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]