[chronojump] maximumIsometricForce.R code reorg on title, datetime
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] maximumIsometricForce.R code reorg on title, datetime
- Date: Fri, 31 Jan 2020 17:38:30 +0000 (UTC)
commit e6efeb98113f12440e4bb00ea7bb921f8f8f7de4
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Jan 31 18:34:42 2020 +0100
maximumIsometricForce.R code reorg on title, datetime
r-scripts/maximumIsometricForce.R | 23 ++---------------------
r-scripts/scripts-util.R | 21 +++++++++++++++++++++
2 files changed, 23 insertions(+), 21 deletions(-)
---
diff --git a/r-scripts/maximumIsometricForce.R b/r-scripts/maximumIsometricForce.R
index c5482e2a..208aa387 100644
--- a/r-scripts/maximumIsometricForce.R
+++ b/r-scripts/maximumIsometricForce.R
@@ -54,25 +54,6 @@ assignOptions <- function(options)
))
}
-fixTitleAndOtherStrings <- function(str)
-{
- print(c("1 fixTitle=", str))
- #unicoded titles arrive here like this "\\", convert to "\", as this is difficult, do like this:
- #http://stackoverflow.com/a/17787736
- str=parse(text = paste0("'", str, "'"))
- print(c("2 fixTitle=", str))
-
- #convert str to spaces
- str=gsub('_',' ', str)
- str=gsub('-',' ', str)
-
- return (str)
-}
-fixDatetime <- function(str)
-{
- str=gsub('_',' ', str)
- str=gsub('-',':', str)
-}
#-------------- get params -------------
args <- commandArgs(TRUE)
@@ -89,14 +70,14 @@ options <- scan(optionsFile, comment.char="#", what=character(), sep="\n")
op <- assignOptions(options)
print(op)
+source(paste(op$scriptsPath, "/scripts-util.R", sep=""))
+
op$title = fixTitleAndOtherStrings(op$title)
op$exercise = fixTitleAndOtherStrings(op$exercise)
titleFull = paste(op$title, op$exercise, sep=" - ")
op$datetime = fixDatetime(op$datetime)
-source(paste(op$scriptsPath, "/scripts-util.R", sep=""))
-
#Fits the data to the model f = fmax*(1 - exp(-K*t))
#Important! It fits the data with the axes moved to initf and startTime. The real maximum force is fmax +
initf
diff --git a/r-scripts/scripts-util.R b/r-scripts/scripts-util.R
index 118c30cc..0ca864ce 100644
--- a/r-scripts/scripts-util.R
+++ b/r-scripts/scripts-util.R
@@ -1,3 +1,24 @@
+fixTitleAndOtherStrings <- function(str)
+{
+ print(c("1 fixTitle=", str))
+ #unicoded titles arrive here like this "\\", convert to "\", as this is difficult, do like this:
+ #http://stackoverflow.com/a/17787736
+ str=parse(text = paste0("'", str, "'"))
+ print(c("2 fixTitle=", str))
+
+ #convert str to spaces
+ str=gsub('_',' ', str)
+ str=gsub('-',' ', str)
+
+ return (str)
+}
+
+fixDatetime <- function(str)
+{
+ str=gsub('_',' ', str)
+ str=gsub('-',':', str)
+}
+
#Function to get the interpolated x at a given y
interpolateXAtY <- function(X, Y, desiredY){
if(max(Y) < desiredY){
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]