[chronojump] Force sensor triggers should be now on RFD automatic graph
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Force sensor triggers should be now on RFD automatic graph
- Date: Mon, 19 Oct 2020 15:41:34 +0000 (UTC)
commit ba882739b146ab9e93fe0e100735d48c2a8eeee6
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Oct 19 17:41:11 2020 +0200
Force sensor triggers should be now on RFD automatic graph
r-scripts/maximumIsometricForce.R | 13 ++++++++++---
src/forceSensor.cs | 13 +++++++++++--
src/gui/app1/forceSensor.cs | 2 +-
3 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/r-scripts/maximumIsometricForce.R b/r-scripts/maximumIsometricForce.R
index b1a830f0..5bd6a45d 100644
--- a/r-scripts/maximumIsometricForce.R
+++ b/r-scripts/maximumIsometricForce.R
@@ -51,7 +51,9 @@ assignOptions <- function(options)
title = options[19],
exercise = options[20],
datetime = options[21],
- scriptsPath = options[22]
+ scriptsPath = options[22],
+ triggersOnList = as.numeric(unlist(strsplit(options[23], "\\;"))),
+ triggersOffList = as.numeric(unlist(strsplit(options[24], "\\;")))
))
}
@@ -213,7 +215,7 @@ getDynamicsFromLoadCellFile <- function(captureOptions, inputFile, averageLength
drawDynamicsFromLoadCell <- function(
dynamics, captureOptions, vlineT0=T, vline50fmax.raw=F, vline50fmax.fitted=F,
hline50fmax.raw=F, hline50fmax.fitted=F,
- rfdDrawingOptions, xlimits = NA)
+ rfdDrawingOptions, triggersOn = "", triggersOff = "", xlimits = NA)
{
dynamics$time = dynamics$time - dynamics$startTime
dynamics$tfmax.raw = dynamics$tfmax.raw - dynamics$startTime
@@ -419,6 +421,11 @@ drawDynamicsFromLoadCell <- function(
#Drawing the RFD data
print("-----------RFD-----------")
print(paste("op$drawRfdOptions =", op$drawRfdOptions))
+
+ #triggers
+ abline(v=triggersOn, col="green")
+ abline(v=triggersOff, col="red")
+
legendText = c(
paste("Fmax =", round(dynamics$fmax.fitted, digits = 2), "N"),
@@ -800,7 +807,7 @@ prepareGraph(op$os, pngFile, op$graphWidth, op$graphHeight)
dynamics = getDynamicsFromLoadCellFile(op$captureOptions, dataFile, op$averageLength, op$percentChange,
bestFit = TRUE, testLength = -1)
drawDynamicsFromLoadCell(dynamics, op$captureOptions, op$vlineT0, op$vline50fmax.raw, op$vline50fmax.fitted,
op$hline50fmax.raw, op$hline50fmax.fitted,
- op$drawRfdOptions)
+ op$drawRfdOptions, triggersOn = op$triggersOnList, triggersOff = op$triggersOffList)
# op$drawRfdOptions, xlimits = c(0.5, 1.5))
endGraph()
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index aa6102e1..e0cd32be 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -1357,9 +1357,10 @@ public class ForceSensorGraph
string title;
string exercise;
string datetime;
+ private TriggerList triggerList;
public ForceSensorGraph(ForceSensor.CaptureOptions fsco, List<ForceSensorRFD> rfdList,
- ForceSensorImpulse impulse, int testLength, int percentChange, string title, string
exercise, string datetime)
+ ForceSensorImpulse impulse, int testLength, int percentChange, string title, string
exercise, string datetime, TriggerList triggerList)
{
this.fsco = fsco;
this.rfdList = rfdList;
@@ -1369,6 +1370,7 @@ public class ForceSensorGraph
this.title = title;
this.exercise = exercise;
this.datetime = datetime;
+ this.triggerList = triggerList;
averageLength = 0.1;
vlineT0 = false;
@@ -1425,7 +1427,9 @@ public class ForceSensorGraph
"#title\n" + title + "\n" +
"#exercise\n" + exercise + "\n" +
"#datetime\n" + datetime + "\n" +
- "#scriptsPath\n" + UtilEncoder.GetScriptsPath() + "\n";
+ "#scriptsPath\n" + UtilEncoder.GetScriptsPath() + "\n" +
+ printTriggers(TriggerList.Type3.ON) + "\n" +
+ printTriggers(TriggerList.Type3.OFF);
TextWriter writer = File.CreateText(Path.GetTempPath() + "Roptions.txt");
writer.Write(scriptOptions);
@@ -1434,6 +1438,11 @@ public class ForceSensorGraph
((IDisposable)writer).Dispose();
}
+ private string printTriggers(TriggerList.Type3 type3)
+ {
+ return triggerList.ToRCurvesString(type3);
+ }
+
public static string GetDataDir(int sessionID)
{
System.IO.DirectoryInfo folderSession =
diff --git a/src/gui/app1/forceSensor.cs b/src/gui/app1/forceSensor.cs
index 9a785532..436a49f7 100644
--- a/src/gui/app1/forceSensor.cs
+++ b/src/gui/app1/forceSensor.cs
@@ -2077,7 +2077,7 @@ LogB.Information(" fs R ");
ForceSensorGraph fsg = new ForceSensorGraph(getForceSensorCaptureOptions(), rfdList, impulse,
duration, Convert.ToInt32(spin_force_rfd_duration_percent.Value),
- title, exercise, currentForceSensor.DateTimePublic); //TODO: add triggers
+ title, exercise, currentForceSensor.DateTimePublic, triggerListForceSensor);
int imageWidth = UtilGtk.WidgetWidth(viewport_force_sensor_graph);
int imageHeight = UtilGtk.WidgetHeight(viewport_force_sensor_graph);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]