Quellcode durchsuchen

Removed debug comments

Deben Oldert vor 10 Jahren
Ursprung
Commit
24edbd65c9
2 geänderte Dateien mit 4 neuen und 16 gelöschten Zeilen
  1. 1 11
      code/head.R
  2. 3 5
      code/state.R

+ 1 - 11
code/head.R

@@ -1,5 +1,4 @@
 print("START ANALYZING HEAD")
-#color <- rainbow(length(STATE))
 color <- c("red", "blue", "blue", "green")
 
 #Plot graph
@@ -20,7 +19,7 @@ differ_ <- 0.1
 f <- function(x) (sin((x - 5) / 2.7) / 30) + WALKBASE
 
 # Draw Optimum walk
-lines(WALKING, f(WALKING), col = "red", type = "l")
+lines(WALKING, f(WALKING), col = "orange", type = "l")
 
 # Check if each point is close to optimum track
 WALK <- data.frame(index=WALKING)
@@ -28,19 +27,10 @@ WALK$probability <- 0
 
 for(i in WALKING){
    prob_ <- 1 - abs((abs(DATA[i,]$Head.y - f(i))) / differ_)
-   #print(DATA[i,]$Head.y)
-   #print(f(i))
-   #print(prob_)
-   #print("======")
    WALK[WALK$index==i,]$probability <- if(prob_ > 1) 1 else if(prob_ < 0) 0 else prob_
 }
 
-# points(WALK[WALK$probability == min(WALK$probability),]$index, 0.3)
-# points(WALK[WALK$probability == max(WALK$probability),]$index, 0.3)
-
 # Print out possible fall chance
 print(paste("FALL CHANCE BASED ON STEPS: ", as.character(specify_decimal(100-(mean(WALK$probability)*100), 2)), "%", sep = ""))
 
 print("DONE ANALYZING HEAD")
-# http://stats.stackexchange.com/questions/30975/how-to-add-non-linear-trend-line-to-a-scatter-plot-in-r
-# http://www.mathsisfun.com/geometry/parabola.html

+ 3 - 5
code/state.R

@@ -39,7 +39,6 @@ for(i in size_:(nrow(DATA)-size_)){
 
   for(j in 0:size_-1){
     POINTS[i-j,LETTERS[j+1]] <- state_
-    #POINTS[i,LETTERS[j+1]] <- state_
   }
   POINTS[i,]$index <- DATA[i,]$Time
 
@@ -69,17 +68,16 @@ DATA$index = as.integer(rownames(DATA))
 WALKING <- strtoi(rownames(DATA[DATA$state==1,]))
 
 # CALCULATE STRAIGHT WALKING PATH
-
 yPrediction <-lm(Head.y ~ I(index^2)+index, data=DATA[min(WALKING):max(WALKING),])
-#lines(WALKING, predict(yPrediction, data.frame(index=WALKING)), type = "l", col = "orange")
-
 yPredicted <- as.vector(predict(yPrediction, data.frame(index=WALKING)))
 
 WALKBASE <- mean(c(yPredicted[1], tail(yPredicted, n=1)))
-#WALKBASE <- mean(c(DATA[WALKING[1],]$Head.y, DATA[tail(WALKING, n=1),]$Head.y))
 
 for(i in WALKING[1]:(length(WALKING) + WALKING[1] - 1)){
   DATA[i,]$Head.y <- DATA[i,]$Head.y - (yPredicted[i-WALKING[1]+1] - WALKBASE)
 }
 
 plot(POINTS$probability, type = "l")
+
+# http://stats.stackexchange.com/questions/30975/how-to-add-non-linear-trend-line-to-a-scatter-plot-in-r
+# http://www.mathsisfun.com/geometry/parabola.html