[chronojump] Preparing graph.R and capture.R to read multiple diameters
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Preparing graph.R and capture.R to read multiple diameters
- Date: Wed, 29 Apr 2015 11:35:34 +0000 (UTC)
commit d80577534df474e2f518c067ce071b32d4da05db
Author: Xavier Padullés <x padulles gmail com>
Date: Tue Apr 28 19:01:56 2015 +0200
Preparing graph.R and capture.R to read multiple diameters
encoder/capture.R | 5 +++--
encoder/graph.R | 3 ++-
encoder/util.R | 4 ++--
3 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/encoder/capture.R b/encoder/capture.R
index 985c371..0625f5c 100644
--- a/encoder/capture.R
+++ b/encoder/capture.R
@@ -187,9 +187,10 @@ doProcess <- function(options)
if(debug)
write("doProcess 2", stderr())
- if(isInertial(op$EncoderConfigurationName))
+ if(isInertial(op$EncoderConfigurationName))
{
- displacement = getDisplacementInertial(displacement, op$EncoderConfigurationName,
op$diameter, op$diameterExt)
+ diametersPerTick = getInertialDiametersPerMs(displacement, op$diameter)
+ displacement = getDisplacementInertial(displacement, op$EncoderConfigurationName,
diametersPerTick, op$diameterExt)
displacement = getDisplacementInertialBody(positionStart, displacement, FALSE,
op$Title) #draw: FALSE
} else {
diff --git a/encoder/graph.R b/encoder/graph.R
index 74eda45..5e52bb5 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -1973,7 +1973,8 @@ doProcess <- function(options)
if(isInertial(op$EncoderConfigurationName))
{
- displacement = getDisplacementInertial(displacement, op$EncoderConfigurationName,
op$diameter, op$diameterExt)
+ diametersPerTick = getInertialDiametersPerMs(displacement, op$diameter)
+ displacement = getDisplacementInertial(displacement, op$EncoderConfigurationName,
diametersPerTick, op$diameterExt)
displacement = getDisplacementInertialBody(0, displacement, curvesPlot, op$Title)
#positionStart is 0 in graph.R. It is different on capture.R because depends on the
start of every repetition
diff --git a/encoder/util.R b/encoder/util.R
index aeff017..acf4bb1 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -27,7 +27,7 @@
#it can be printed safely to stderr. See end capture.R
#used in graph.R and capture.R
-assignOptions <- function(options) {
+assignOptions <- function(options) {
return(list(
File = options[1],
OutputGraph = options[2],
@@ -56,6 +56,7 @@ assignOptions <- function(options) {
AnalysisOptions = options[13],
EncoderConfigurationName = options[14], #just the name of the EncoderConfiguration
diameter = as.numeric(unlist(strsplit(options[15], "\\;"))), #comes in cm,
will be converted to m. Since 1.5.1 can be different diameters separated by ;
+ #diameter = getInertialDiametersPerTick(as.numeric(unlist(strsplit("1.5; 1.75; 2.65;
3.32; 3.95; 4.07; 4.28; 4.46; 4.54; 4.77; 4.96; 5.13; 5.3; 5.55", "\\;")))),
diameterExt = as.numeric(options[16]), #comes in cm, will be converted to m
anglePush = as.numeric(options[17]),
angleWeight = as.numeric(options[18]),
@@ -907,7 +908,6 @@ getInertialDiametersPerTick <- function(d_vector)
# Linear interpolation of the radius across the lenght of the measurement of the diameters
#d.approx <- approx(x=d[,1], y=d[,2], seq(from=1, to=d[length(d[,1]),1]))
- print(d)
d.smoothed <- smooth.spline(d, spar=0.4)
d.approx <- predict(d.smoothed, 0:d[length(d[,1]), 1],0)
return(d.approx$y)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]