[chronojump] Fixing neuromuscular with bad data
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Fixing neuromuscular with bad data
- Date: Thu, 24 Apr 2014 19:54:41 +0000 (UTC)
commit 56ba461cf556596787316217a7a4d8edd4d8121e
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Apr 24 21:46:11 2014 +0200
Fixing neuromuscular with bad data
encoder/graph.R | 10 ++++++++++
encoder/neuromuscularProfile.R | 24 ++++++++++++++++++------
src/constants.cs | 2 ++
3 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index f16594e..e37f8b1 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2670,6 +2670,16 @@ doProcess <- function(options) {
quit()
}
npj <- neuromuscularProfileGetData(displacement, curves, (MassBody + MassExtra),
SmoothingOneC)
+
+ if(npj == -1) {
+ plot(0,0,type="n",axes=F,xlab="",ylab="")
+ text(x=0,y=0,paste(translate("Not enough data."), "\n",
+ translate("Need at least three jumps executed on the odd
concentric phases"),
+ " (1 con, 3 con, 5 con, ...)."), cex=1.5)
+ dev.off()
+ write("", OutputData1)
+ quit()
+ }
np.bar.load <- mean(c(
npj[[1]]$e1$rfd.avg,
diff --git a/encoder/neuromuscularProfile.R b/encoder/neuromuscularProfile.R
index d86df55..ee0881e 100644
--- a/encoder/neuromuscularProfile.R
+++ b/encoder/neuromuscularProfile.R
@@ -226,15 +226,27 @@ neuromuscularProfileGetData <- function(displacement, curves, mass, smoothingC)
force <- mass * (accel$y + g)
position = cumsum(d)
+
+ takeoff = NULL
#takeoff = min(which(force <= weight))
takeoff = min(which(force <= 0))
- jumpHeight = (position[length(position)] - position[takeoff]) /10
- print(paste("Jump Height =", jumpHeight))
+ if(! is.null(takeoff)) {
+ jumpHeight = (position[length(position)] - position[takeoff]) /10
+ print(paste("Jump Height =", jumpHeight))
+
+ #store variables
+ nums[count] = i
+ heights[count] = jumpHeight
+ count = count +1
+ }
+ }
- #store variables
- nums[count] = i
- heights[count] = jumpHeight
- count = count +1
+ print(c("nums length",length(nums)))
+ #if less than three jumps are detected (with jump height), then return an error message
+ #this happens if the person stops in the middle of the jump, and then continues,
+ #and jumps are supposed to be in the 1c, 3c, ... and then they change to 4c, 6c, ...
+ if(length(nums) < 3) {
+ return (-1)
}
df=data.frame(cbind(nums,heights))
diff --git a/src/constants.cs b/src/constants.cs
index 18e1fa4..80464a0 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -775,6 +775,7 @@ public class Constants
"Mean speed in concentric propulsive phase",
"Sorry, no curves matched your criteria.",
"Need 6 jumps and 4 phases for each jump",
+ "Need at least three jumps executed on the odd concentric phases",
"Starting R",
"Loading libraries",
"Starting process",
@@ -820,6 +821,7 @@ public class Constants
Catalog.GetString("Mean speed in concentric propulsive phase"),
Catalog.GetString("Sorry, no curves matched your criteria."),
Catalog.GetString("Need 6 jumps and 4 phases for each jump"),
+ Catalog.GetString("Need at least three jumps executed on the odd concentric phases"),
Catalog.GetString("Starting R"),
Catalog.GetString("Loading libraries"),
Catalog.GetString("Starting process"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]