[chronojump] sprint communication 50% done
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] sprint communication 50% done
- Date: Wed, 22 Mar 2017 16:07:58 +0000 (UTC)
commit 7764496f56453a0f6e74d66f3522082ea4f2b5f5
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Mar 22 17:07:29 2017 +0100
sprint communication 50% done
r-scripts/sprint.R | 79 ++++++++++++++++++++++++++++++++++------------------
src/sprint.cs | 9 ++++--
2 files changed, 58 insertions(+), 30 deletions(-)
---
diff --git a/r-scripts/sprint.R b/r-scripts/sprint.R
index 0e80f6e..cd04672 100644
--- a/r-scripts/sprint.R
+++ b/r-scripts/sprint.R
@@ -366,41 +366,66 @@ drawSprintFromPhotocells <- function(sprintDynamics, splitTimes, positions, titl
}
-#Examples of use
-
-testPhotocells <- function()
+testPhotocellsCJ <- function(positions, splitTimes, mass, personHeight, tempC)
{
- Vmax = 9.54709925453619
- K = 0.818488730889454
- noise = 0
- splitTimes = seq(0,10, by=1)
- #splitTimes = c(0, 1, 5, 10)
- positions = Vmax*(splitTimes + (1/K)*exp(-K*splitTimes)) -Vmax/K
- photocell.noise = data.frame(time = splitTimes + noise*rnorm(length(splitTimes), 0, 1), position =
positions)
- sprint = getSprintFromPhotocell(position = photocell.noise$position, splitTimes =
photocell.noise$time)
- sprintDynamics = getDynamicsFromSprint(K = sprint$K, Vmax = sprint$Vmax, 75, 25, 1.65)
+ sprint = getSprintFromPhotocell(position = positions, splitTimes = splitTimes)
+ sprintDynamics = getDynamicsFromSprint(K = sprint$K, Vmax = sprint$Vmax, mass, tempC, personHeight,
maxTime = max(splitTimes))
print(paste("K =",sprintDynamics$K.fitted, "Vmax =", sprintDynamics$Vmax.fitted))
drawSprintFromPhotocells(sprintDynamics = sprintDynamics, splitTimes, positions, title = "Testing
graph")
}
-#Test wiht data like is coming from Chronojump
-testPhotocellsCJ <- function()
-{
- #Data coming from Chronojump. Example: Usain Bolt
- positions = c(0, 20 , 40 , 70 )
- splitTimes = c(0, 2.73, 4.49, 6.95)
- mass = 75
- tempC = 25
- personHeight = 1.65
- sprint = getSprintFromPhotocell(position = positions, splitTimes = splitTimes)
- sprintDynamics = getDynamicsFromSprint(K = sprint$K, Vmax = sprint$Vmax, mass, tempC, personHeight,
maxTime = max(splitTimes))
- print(paste("K =",sprintDynamics$K.fitted, "Vmax =", sprintDynamics$Vmax.fitted))
- drawSprintFromPhotocells(sprintDynamics = sprintDynamics, splitTimes, positions, title = "Testing
graph")
+args <- commandArgs(TRUE)
+optionsFile <- args[1]
+options <- scan(optionsFile, comment.char="#", what=character(), sep="\n")
+assignOptions <- function(options) {
+ return(list(
+ positions = as.numeric(unlist(strsplit(options[1], "\\;"))),
+ splitTimes = as.numeric(unlist(strsplit(options[2], "\\;"))),
+ mass = as.numeric(options[3]),
+ personHeight = as.numeric(options[4]),
+ tempC = as.numeric(options[5])
+ ))
}
-#testPhotocells()
-#testPhotocellsCJ()
+op <- assignOptions(options)
+#print(op$positions)
+testPhotocellsCJ(op$positions, op$splitTimes, op$mass, op$personHeight, op$tempC)
+
+
+#Examples of use
+
+#testPhotocells <- function()
+#{
+# Vmax = 9.54709925453619
+# K = 0.818488730889454
+# noise = 0
+# splitTimes = seq(0,10, by=1)
+# #splitTimes = c(0, 1, 5, 10)
+# positions = Vmax*(splitTimes + (1/K)*exp(-K*splitTimes)) -Vmax/K
+# photocell.noise = data.frame(time = splitTimes + noise*rnorm(length(splitTimes), 0, 1), position =
positions)
+# sprint = getSprintFromPhotocell(position = photocell.noise$position, splitTimes =
photocell.noise$time)
+# sprintDynamics = getDynamicsFromSprint(K = sprint$K, Vmax = sprint$Vmax, 75, 25, 1.65)
+# print(paste("K =",sprintDynamics$K.fitted, "Vmax =", sprintDynamics$Vmax.fitted))
+# drawSprintFromPhotocells(sprintDynamics = sprintDynamics, splitTimes, positions, title = "Testing
graph")
+#}
+
+#Test wiht data like is coming from Chronojump
+#testPhotocellsCJSample <- function()
+#{
+# #Data coming from Chronojump. Example: Usain Bolt
+# positions = c(0, 20 , 40 , 70 )
+# splitTimes = c(0, 2.73, 4.49, 6.95)
+# mass = 75
+# tempC = 25
+# personHeight = 1.65
+#
+# sprint = getSprintFromPhotocell(position = positions, splitTimes = splitTimes)
+# sprintDynamics = getDynamicsFromSprint(K = sprint$K, Vmax = sprint$Vmax, mass, tempC, personHeight,
maxTime = max(splitTimes))
+# print(paste("K =",sprintDynamics$K.fitted, "Vmax =", sprintDynamics$Vmax.fitted))
+# drawSprintFromPhotocells(sprintDynamics = sprintDynamics, splitTimes, positions, title = "Testing
graph")
+#}
+
# getSprintFromRadar("~/Documentos/Radar/APL_post24.rad")
# getDynamicsFromSprint(K = 0.8184887, Vmax = 9.547099, Mass = 60, Temperature = 25, Height = 1.65 )
diff --git a/src/sprint.cs b/src/sprint.cs
index 83782db..939fe06 100644
--- a/src/sprint.cs
+++ b/src/sprint.cs
@@ -24,11 +24,16 @@ using System.Collections.Generic; //List<T>
public class Sprint
{
+ string optionsFile;
+
public Sprint()
{
+ optionsFile = Path.GetTempPath() + "Roptions.txt";
+
string executable = UtilEncoder.RProcessBinURL();
List<string> parameters = new List<string>();
parameters.Insert(0, "\"" + UtilEncoder.GetScriptSprint() + "\"");
+ parameters.Insert(1, "\"" + optionsFile + "\"");
writeOptionsFile();
@@ -43,12 +48,10 @@ public class Sprint
private void writeOptionsFile()
{
- string optionsFile = Path.GetTempPath() + "Roptions.txt";
-
string scriptOptions =
"#positions\n" + "0;20;40;70" + "\n" +
"#splitTimes\n" + "0;2.73;4.49;6.95" + "\n" +
- "#personMass\n" + "75" + "\n" +
+ "#mass\n" + "75" + "\n" +
"#personHeight\n" + "1.65" + "\n" +
"#tempC\n" + "25" + "\n";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]