[chronojump] RunEncoder graph with triggers. UNTESTED.
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] RunEncoder graph with triggers. UNTESTED.
- Date: Wed, 5 Feb 2020 20:27:01 +0000 (UTC)
commit 90c2a96020ad040232cf30e26827f636cc315258
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Feb 5 21:25:48 2020 +0100
RunEncoder graph with triggers. UNTESTED.
r-scripts/sprintEncoder.R | 13 ++++++++++++-
src/gui/runEncoder.cs | 17 +++++++++--------
src/runEncoder.cs | 13 +++++++++++--
3 files changed, 32 insertions(+), 11 deletions(-)
---
diff --git a/r-scripts/sprintEncoder.R b/r-scripts/sprintEncoder.R
index 784a8fb8..227c8d4a 100644
--- a/r-scripts/sprintEncoder.R
+++ b/r-scripts/sprintEncoder.R
@@ -45,7 +45,9 @@ assignOptions <- function(options) {
graphHeight = as.numeric(options[9]),
device = options[10],
title = options[11],
- datetime = options[12]
+ datetime = options[12],
+ triggersOnList = as.numeric(unlist(strsplit(options[13], "\\;"))),
+ triggersOffList = as.numeric(unlist(strsplit(options[14], "\\;")))
))
}
@@ -223,6 +225,8 @@ getSprintFromEncoder <- function(filename, testLength, Mass, Temperature = 25, H
plotSprintFromEncoder <- function(sprintRawDynamics, sprintFittedDynamics,
title = "Test graph",
subtitle = "",
+ triggersOn = "",
+ triggersOff = "",
plotRawMeanSpeed = TRUE,
plotRawSpeed = TRUE,
plotRawAccel = FALSE,
@@ -515,6 +519,11 @@ plotSprintFromEncoder <- function(sprintRawDynamics, sprintFittedDynamics,
axis(side = 4, col = "red", line = 4)
}
+ #triggers
+ abline(v=triggersOn, col="green")
+ abline(v=triggersOff, col="red")
+
+
plotSize = par("usr")
legend(x = plotSize[2], y = plotSize[3] + (plotSize[4] - plotSize[3])*0.25,
xjust = 1, yjust = 0.5, cex = 1,
@@ -609,6 +618,8 @@ testEncoderCJ <- function(filename, testLength, mass, personHeight, tempC)
plotSprintFromEncoder(sprintRawDynamic = sprintRawDynamics, sprintFittedDynamics =
sprintFittedDynamics,
title = op$title,
subtitle = op$datetime,
+ triggersOn = op$triggersOnList,
+ triggersOff = op$triggersOffList,
plotRawMeanSpeed = TRUE,
plotRawSpeed = TRUE,
plotRawAccel = FALSE,
diff --git a/src/gui/runEncoder.cs b/src/gui/runEncoder.cs
index 0c31edd3..2041c3c8 100644
--- a/src/gui/runEncoder.cs
+++ b/src/gui/runEncoder.cs
@@ -743,13 +743,6 @@ public partial class ChronoJumpWindow
raceEncoderReadWidgets(); //needed to be able to do R graph
- raceEncoderCopyTempAndDoGraphs();
-
- button_contacts_recalculate.Sensitive = true;
-
- button_video_play_this_test_contacts.Sensitive = (re.VideoURL != "");
- sensitiveLastTestButtons(true);
-
//triggers
triggerListRunEncoder = new TriggerList(
SqliteTrigger.Select(
@@ -758,6 +751,13 @@ public partial class ChronoJumpWindow
);
showRaceAnalyzerTriggers ();
+ raceEncoderCopyTempAndDoGraphs();
+
+ button_contacts_recalculate.Sensitive = true;
+
+ button_video_play_this_test_contacts.Sensitive = (re.VideoURL != "");
+ sensitiveLastTestButtons(true);
+
event_execute_label_message.Text = "Loaded: " + Util.GetLastPartOfPath(re.Filename);
}
@@ -959,7 +959,8 @@ public partial class ChronoJumpWindow
race_analyzer_temperature,
race_analyzer_device,
title,
- dateTimeGraph);
+ dateTimeGraph,
+ triggerListRunEncoder);
reg.CallR(imageWidth, imageHeight);
diff --git a/src/runEncoder.cs b/src/runEncoder.cs
index bdbee1ec..60abce8f 100644
--- a/src/runEncoder.cs
+++ b/src/runEncoder.cs
@@ -294,9 +294,10 @@ public class RunEncoderGraph
private RunEncoder.Devices device;
private string title;
private string datetime;
+ private TriggerList triggerList;
public RunEncoderGraph(int testLength, double mass, double personHeight, double tempC,
RunEncoder.Devices device,
- string title, string datetime)
+ string title, string datetime, TriggerList triggerList)
{
this.testLength = testLength;
this.mass = mass;
@@ -305,6 +306,7 @@ public class RunEncoderGraph
this.device = device;
this.title = title;
this.datetime = datetime;
+ this.triggerList = triggerList;
}
public bool CallR(int graphWidth, int graphHeight)
@@ -335,7 +337,9 @@ public class RunEncoderGraph
"#graphHeight\n" + graphHeight.ToString() + "\n" +
"#device\n" + device.ToString() + "\n" +
"#title\n" + title + "\n" +
- "#datetime\n" + datetime;
+ "#datetime\n" + datetime + "\n" +
+ printTriggers(TriggerList.Type3.ON) + "\n" +
+ printTriggers(TriggerList.Type3.OFF);
TextWriter writer = File.CreateText(Path.GetTempPath() + "Roptions.txt");
@@ -345,6 +349,11 @@ public class RunEncoderGraph
((IDisposable)writer).Dispose();
}
+ private string printTriggers(TriggerList.Type3 type3)
+ {
+ return triggerList.ToRCurvesString(type3);
+ }
+
public static string GetDataDir(int sessionID)
{
System.IO.DirectoryInfo folderSession =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]