[chronojump] RaceAnalyzer. Fixed nls with singular gradient error
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] RaceAnalyzer. Fixed nls with singular gradient error
- Date: Thu, 6 Feb 2020 12:57:01 +0000 (UTC)
commit e69d09b9f6f1d58ec538c8d6db790ada3f010cab
Author: Xavier Padullés <x padulles gmail com>
Date: Thu Feb 6 13:55:46 2020 +0100
RaceAnalyzer. Fixed nls with singular gradient error
r-scripts/sprintEncoder.R | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/r-scripts/sprintEncoder.R b/r-scripts/sprintEncoder.R
index d56fe245..09cff5f2 100644
--- a/r-scripts/sprintEncoder.R
+++ b/r-scripts/sprintEncoder.R
@@ -110,6 +110,8 @@ getSprintFromEncoder <- function(filename, testLength, Mass, Temperature = 25, H
forceBody = accel * Mass + Ka*(speed - Vw)^2
totalForce = forceBody + raceAnalyzer$force
power = totalForce * speed
+ # print("totalTime:")
+ # print(totalTime)
# print("time:")
# print(raceAnalyzer$time)
# print("elapsedTime:")
@@ -598,7 +600,11 @@ tryNLS <- function(data){
start = list(Vmax = max(data[,"speed"]), K = 1),
control=nls.control(warnOnly=TRUE))
# print("model:")
# print(model)
- return(list(regressionDone = TRUE, model = model))
+ if (! model$convInfo$isConv){
+ return(list(regressionDone = FALSE, model = model))
+ } else {
+ return(list(regressionDone = TRUE, model = model))
+ }
},
error=function(cond)
{
@@ -634,7 +640,7 @@ testEncoderCJ <- function(filename, testLength, mass, personHeight, tempC, start
plotFittedForce = FALSE,
plotFittedPower = TRUE,
startAccel,
- plotStartDetection = FALSE)
+ plotStartDetection = TRUE)
exportSprintDynamics(sprintFittedDynamics)
} else
print("Couldn't calculate the sprint model")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]