[chronojump] ForceSensor export datetime separated
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] ForceSensor export datetime separated
- Date: Thu, 18 Feb 2021 17:32:07 +0000 (UTC)
commit 5314a22297e61314d729c0124820075e2358894f
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Feb 18 18:31:47 2021 +0100
ForceSensor export datetime separated
r-scripts/maximumIsometricForce.R | 31 ++++++++++-----------
src/forceSensor.cs | 57 ++++++++++++++++++++++++++++-----------
2 files changed, 58 insertions(+), 30 deletions(-)
---
diff --git a/r-scripts/maximumIsometricForce.R b/r-scripts/maximumIsometricForce.R
index 87e8a57d..6eb06df2 100644
--- a/r-scripts/maximumIsometricForce.R
+++ b/r-scripts/maximumIsometricForce.R
@@ -49,16 +49,17 @@ assignOptions <- function(options)
captureOptions = options[18],
title = options[19],
exercise = options[20],
- datetime = options[21],
- scriptsPath = options[22],
- triggersOnList = as.numeric(unlist(strsplit(options[23], "\\;"))),
- triggersOffList = as.numeric(unlist(strsplit(options[24], "\\;"))),
- startSample = as.numeric(options[25]),
- endSample = as.numeric(options[26]),
- startEndOptimized = options[27], #bool
- singleOrMultiple = options[28], #bool (true is single)
- decimalCharAtExport = options[29],
- maxAvgWindowSeconds = as.numeric(options[30])
+ date = options[21],
+ time = options[22],
+ scriptsPath = options[23],
+ triggersOnList = as.numeric(unlist(strsplit(options[24], "\\;"))),
+ triggersOffList = as.numeric(unlist(strsplit(options[25], "\\;"))),
+ startSample = as.numeric(options[26]),
+ endSample = as.numeric(options[27]),
+ startEndOptimized = options[28], #bool
+ singleOrMultiple = options[29], #bool (true is single)
+ decimalCharAtExport = options[30],
+ maxAvgWindowSeconds = as.numeric(options[31])
))
}
@@ -1082,7 +1083,6 @@ doProcess <- function(pngFile, dataFile, decimalChar, title, exercise, datetime,
{
title = fixTitleAndOtherStrings(title)
exercise = fixTitleAndOtherStrings(exercise)
- datetime = fixDatetime(datetime)
print("Going to enter prepareGraph")
prepareGraph(op$os, pngFile, op$graphWidth, op$graphHeight)
@@ -1105,10 +1105,11 @@ start <- function(op)
{
if(op$singleOrMultiple == "TRUE")
{
+ datetime = paste(op$date, op$time, sep=" ")
dataFile <- paste(tempPath, "/cj_mif_Data.csv", sep="")
pngFile <- paste(tempPath, "/cj_mif_Graph.png", sep="")
doProcess(pngFile, dataFile, op$decimalCharAtFile, op$title, op$exercise,
- op$datetime, op$captureOptions, op$startSample, op$endSample)
+ datetime, op$captureOptions, op$startSample, op$endSample)
} else {
#export
#1) define exportDF and the model vector if model does not succeed
@@ -1128,7 +1129,7 @@ start <- function(op)
if(op$decimalCharAtExport == ",")
maxAvgWindowSecondsHeader = format(maxAvgWindowSecondsHeader, decimal.mark=",")
- exportNames = c("Name","Datetime","Exercise","Set","Repetition","MaxForce (raw)",paste("Max
AVG Force in", maxAvgWindowSecondsHeader, "s (raw)"),"MaxForce (model)")
+ exportNames = c("Name","Date","Time","Exercise","Set","Repetition","MaxForce
(raw)",paste("Max AVG Force in", maxAvgWindowSecondsHeader, "s (raw)"),"MaxForce (model)")
for(i in 1:length(op$drawRfdOptions))
{
RFDoptions = readRFDOptions(op$drawRfdOptions[i])
@@ -1159,7 +1160,7 @@ start <- function(op)
modelOk = FALSE
executing <- tryCatch({
exportModelVector = doProcess(pngFile, as.vector(dataFiles$fullURL[i]),
- dataFiles$decimalChar[i], dataFiles$title[i], dataFiles$exercise[i],
dataFiles$datetime[i],
+ dataFiles$decimalChar[i], dataFiles$title[i], dataFiles$exercise[i],
paste(dataFiles$date[i], dataFiles$time[i], sep=" "),
dataFiles$captureOptions[i], dataFiles$startSample[i],
dataFiles$endSample[i])
#countGraph = countGraph +1 #only adds if not error, so the numbering of
graphs matches rows in CSV
@@ -1174,7 +1175,7 @@ start <- function(op)
exportModelVector = exportModelVectorOnFail #done here and not on the catch,
because it didn't worked there
#mix strings and numbers directly in a data frame to not have numbers as text (and
then cannot export with decimal , or .)
- exportSetDF = data.frame(dataFiles$title[i], fixDatetime(dataFiles$datetime[i]),
dataFiles$exercise[i], dataFiles$set[i], dataFiles$rep[i])
+ exportSetDF = data.frame(dataFiles$title[i], dataFiles$date[i], dataFiles$time[i],
dataFiles$exercise[i], dataFiles$set[i], dataFiles$rep[i])
exportSetDF = cbind (exportSetDF, dataFiles$maxForceRaw[i])
exportSetDF = cbind (exportSetDF, dataFiles$maxAvgForceInWindow[i])
for(j in 1:length(exportModelVector))
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index f010b713..981d5b64 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -297,6 +297,26 @@ public class ForceSensor
{
get { return dateTime; }
}
+ public string DatePublic
+ {
+ get {
+ if(dateTime.Split(new char[] {'_'}).Length == 2)
+ return Util.ChangeChars(dateTime.Split(new char[] {'_'})[0], "-", "/");
+ else
+ return "";
+ }
+ }
+ public string TimePublic
+ {
+ get {
+ if(dateTime.Split(new char[] {'_'}).Length == 2)
+ return Util.ChangeChars(dateTime.Split(new char[] {'_'})[1], "-", ":");
+ else
+ return "";
+ }
+ }
+
+
public string Filename
{
@@ -1516,18 +1536,20 @@ public class ForceSensorGraphAB
public int endSample;
public string title;
public string exercise;
- public string datetime;
+ public string date;
+ public string time;
public TriggerList triggerList;
protected void assignParams(ForceSensor.CaptureOptions fsco, int startSample, int endSample,
- string title, string exercise, string datetime, TriggerList triggerList)
+ string title, string exercise, string date, string time, TriggerList triggerList)
{
this.fsco = fsco;
this.startSample = startSample;
this.endSample = endSample;
this.title = title;
this.exercise = exercise;
- this.datetime = datetime;
+ this.date = date;
+ this.time = time;
this.triggerList = triggerList;
}
@@ -1539,9 +1561,9 @@ public class ForceSensorGraphAB
//constructor for graph on analyze
public ForceSensorGraphAB (
ForceSensor.CaptureOptions fsco, int startSample, int endSample,
- string title, string exercise, string datetime, TriggerList triggerList)
+ string title, string exercise, string date, string time, TriggerList triggerList)
{
- assignParams(fsco, startSample, endSample, title, exercise, datetime, triggerList);
+ assignParams(fsco, startSample, endSample, title, exercise, date, time, triggerList);
}
@@ -1561,9 +1583,9 @@ public class ForceSensorGraphABExport: ForceSensorGraphAB
double maxAvgForceInWindow, double forceSensorAnalyzeMaxAVGInWindowSeconds,
int setCount, int repCount,
ForceSensor.CaptureOptions fsco, int startSample, int endSample,
- string title, string exercise, string datetime, TriggerList triggerList)
+ string title, string exercise, string date, string time, TriggerList triggerList)
{
- assignParams(fsco, startSample, endSample, title, exercise, datetime, triggerList);
+ assignParams(fsco, startSample, endSample, title, exercise, date, time, triggerList);
this.fullURL = fullURL;
this.decimalIsPoint = decimalIsPoint;
@@ -1592,7 +1614,8 @@ public class ForceSensorGraphABExport: ForceSensorGraphAB
fsco.ToString() + ";" +
title + ";" +
exercise + ";" +
- datetime + ";" +
+ date + ";" +
+ time + ";" +
setCount + ";" +
repCount + ";" +
"\"\";\"\";" + // triggers unused on export
@@ -1603,7 +1626,7 @@ public class ForceSensorGraphABExport: ForceSensorGraphAB
public static string PrintCSVHeaderOnExport()
{
return "fullURL;decimalChar;maxForceRaw;maxAvgForceInWindow;" +
- "captureOptions;title;exercise;datetime;set;rep;" +
+ "captureOptions;title;exercise;date;time;set;rep;" +
"triggersON;triggersOFF;" + //unused on export
"startSample;endSample";
}
@@ -1625,7 +1648,8 @@ public class ForceSensorGraph
double testLength;
string title;
string exercise;
- string datetime;
+ string date;
+ string time;
private TriggerList triggerList;
private int startSample;
private int endSample;
@@ -1679,7 +1703,8 @@ public class ForceSensorGraph
this.endSample = fsgAB.endSample;
this.title = fsgAB.title;
this.exercise = fsgAB.exercise;
- this.datetime = fsgAB.datetime;
+ this.date = fsgAB.date;
+ this.time = fsgAB.time;
this.triggerList = fsgAB.triggerList;
}
@@ -1771,7 +1796,8 @@ public class ForceSensorGraph
captureOptionsStr = "-1";
title = "-1";
exercise = "-1";
- datetime = "-1";
+ date = "-1";
+ time = "-1";
}
scriptOptions +=
@@ -1779,7 +1805,8 @@ public class ForceSensorGraph
"#captureOptions\n" + captureOptionsStr + "\n" + //unused on multiple
"#title\n" + title + "\n" + //unused on multiple
"#exercise\n" + exercise + "\n" + //unused on multiple
- "#datetime\n" + datetime + "\n" + //unused on multiple
+ "#date\n" + date + "\n" + //unused on multiple
+ "#time\n" + time + "\n" + //unused on multiple
"#scriptsPath\n" + UtilEncoder.GetScriptsPath() + "\n" +
triggersOnStr + "\n" + //unused on multiple
triggersOffStr + "\n" + //unused on
multiple
@@ -2813,7 +2840,7 @@ public class ForceSensorExport
fs.CaptureOption,
repConcentricSampleStart, //start of
concentric rep
rep.sampleEnd, //end of
eccentric rep
- title, exercise, fs.DateTimePublic, new
TriggerList()
+ title, exercise, fs.DatePublic,
fs.TimePublic, new TriggerList()
));
lastIsCon = false;
@@ -2844,7 +2871,7 @@ public class ForceSensorExport
fs.CaptureOption,
repConcentricSampleStart, //start of concentric
rep
repLast.sampleEnd, //end of
eccentric rep
- title, exercise, fs.DateTimePublic, new TriggerList()
+ title, exercise, fs.DatePublic, fs.TimePublic, new
TriggerList()
));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]