[chronojump] Separate days in the same session for Pmax(F0,V0)
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Separate days in the same session for Pmax(F0,V0)
- Date: Mon, 12 Nov 2018 16:14:36 +0000 (UTC)
commit b3422e243844b29008889bfdb8e0559d9dd45ad5
Author: Xavier Padullés <x padulles gmail com>
Date: Mon Nov 12 17:13:07 2018 +0100
Separate days in the same session for Pmax(F0,V0)
encoder/graph.R | 21 +++++++++++++++++++--
encoder/pfvProfileEvolution.R | 18 ++++++------------
r-scripts/sprintUtil.R | 16 +++++++++++++++-
3 files changed, 40 insertions(+), 15 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 7b9c3068..c7d0e84d 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2884,7 +2884,7 @@ doProcess <- function(options)
n=length(curves[,1])
quitIfNoData(curvesPlot, n, curves, op$OutputData1, op$MinHeight)
- #print(curves, stderr())
+ print(curves, stderr())
#find SmoothingsEC. TODO: fix this
if(CROSSVALIDATESMOOTH) {
@@ -3782,9 +3782,24 @@ doProcess <- function(options)
else {
if(discardingCurves)
curvesHeight = curvesHeight[-discardedCurves]
+
+ #by default use sessions as seriesNames
+ mySeriesNames = curves[,9]
+
+ #special config separate by days
+ separateSessionInDays = TRUE #TODO: pass this from GUI
+ if(separateSessionInDays)
+ {
+ chunks = unlist(strsplit(curves[,7], " ")) #separate "2018-09-06
12:12:4" in two chunks
+ chunks = chunks[seq(1, length(chunks), by = 2)]
+ print("chunks: ")
+ print(chunks)
+ mySeriesNames = chunks
+ }
+
pafCurves = cbind(
- curves[,9], #seriesName
+ mySeriesNames, #seriesName
curves[,4], #exerciseName
curves[,5], #massBody
curves[,6], #massExtra
@@ -3876,6 +3891,8 @@ doProcess <- function(options)
#Pmax(F0,V0) will use pafCurves
if(op$Analysis == "cross" && op$AnalysisVariables[1] == "Pmax(F0,V0)")
{
+ print("KKKKKKKK")
+ print(pafCurves)
pmaxArray = data.frame(pafCurves$series, as.numeric(pafCurves$meanSpeed),
as.numeric(pafCurves$meanForce))
colnames(pmaxArray) = c("date", "meanSpeed", "meanForce")
pfvProfileExecute(pmaxArray)
diff --git a/encoder/pfvProfileEvolution.R b/encoder/pfvProfileEvolution.R
index 52864970..51088726 100644
--- a/encoder/pfvProfileEvolution.R
+++ b/encoder/pfvProfileEvolution.R
@@ -77,8 +77,12 @@ pfvProfileDrawProfilesEvolution <- function(analyzeTable)
{
profiles = pfvProfileGetAnalysisProfiles(analyzeTable)
- f0 = profiles$f0
- v0 = profiles$v0
+ #Clean the data and discard the wrong profiles
+ correctProfiles = which(profiles$f0 > 0 & profiles$v0 > 0)
+ f0 = profiles$f0[correctProfiles]
+ v0 = profiles$v0[correctProfiles]
+ dates = profiles$dates[correctProfiles]
+
if(min(v0) <= 0 || min(f0) <= 0){
plot(0,0,type="n",axes=F,xlab="",ylab="")
text(x=0,y=0,translateToPrint("Some of the F-V profiles is wrong.\nProbably the F0 or V0 is
negative"),cex=1.5)
@@ -86,7 +90,6 @@ pfvProfileDrawProfilesEvolution <- function(analyzeTable)
quit()
}
pmax = f0*v0/4
- dates = profiles$dates
flimits = c(min(f0) - (max(f0) - min(f0))*0.1, max(f0) + (max(f0) - min(f0))*0.1)
vlimits = c(min(v0) - (max(v0) - min(v0))*0.1, max(v0) + (max(v0) - min(v0))*0.1)
@@ -133,12 +136,3 @@ pfvProfileExecute <- function(analyzeTable)
pfvProfileDrawProfilesEvolution(analyzeTable)
}
-
-pfvProfileReadFile <- function(inputFile)
-{
- analyzeTable = read.csv(inputFile, dec = ".", sep = ",")
- colnames(analyzeTable)[which(colnames(analyzeTable)=="series")] = "date"
- return(analyzeTable)
-}
-
-#pfvProfileExecute(pfvProfileReadFile("/tmp/chronojump-last-encoder-analyze-table.txt"))
diff --git a/r-scripts/sprintUtil.R b/r-scripts/sprintUtil.R
index ccc30c00..32c00fba 100644
--- a/r-scripts/sprintUtil.R
+++ b/r-scripts/sprintUtil.R
@@ -139,4 +139,18 @@ splitTime <- function(Vmax, K, position, tolerance = 0.001, initTime = 1)
return(t)
}
-
+drawFVProfile <- function(F0, V0, pngFile)
+{
+ #png(pngFile)
+ par(mar = c(5.1, 4.1, 4.1, 5.1))
+ v = seq(0, V0, by = 0.01)
+ p = (F0 -F0*v/V0)*v
+ plot(c(V0, 0),c(0, F0), type = "l", axes = F, xlab = "Speed [m/s]", ylab = "Force [N]")
+ axis(1, pos = 0)
+ axis(2, pos = 0)
+ par(new = T)
+ plot(v, p, axes = F, type = "l", col = "red", ylab = "", xlab = "")
+ axis(4, pos = V0)
+ mtext(text = "Power [W]", side = 4, line = 2, col = "red")
+ #dev.off()
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]