[chronojump] Big encoder params reorg to allow pass csv on "single" analysis
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Big encoder params reorg to allow pass csv on "single" analysis
- Date: Tue, 2 Feb 2016 19:06:54 +0000 (UTC)
commit dfbc2f582354b08c4c62b14fc10c3bdd5eea787b
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Feb 2 20:04:26 2016 +0100
Big encoder params reorg to allow pass csv on "single" analysis
encoder/call_capture.R | 4 +-
encoder/call_graph.R | 40 +++-----
encoder/capture.R | 16 ++-
encoder/graph.R | 100 ++++++--------------
encoder/util.R | 62 +++++++++++--
glade/chronojump.glade | 249 +++++++++++++++++++++++++++++++++++++++++++++++-
src/encoder.cs | 49 ++++-----
src/encoderRProc.cs | 10 +-
src/gui/encoder.cs | 16 ++--
src/utilEncoder.cs | 43 +++++----
10 files changed, 415 insertions(+), 174 deletions(-)
---
diff --git a/encoder/call_capture.R b/encoder/call_capture.R
index ea581ce..4dcfafd 100644
--- a/encoder/call_capture.R
+++ b/encoder/call_capture.R
@@ -14,9 +14,7 @@ optionsFile <- args[1]
options <- scan(optionsFile, comment.char="#", what=character(), sep="\n")
-
-scriptUtilR = options[28]
-source(scriptUtilR)
+source(paste(options[4], "/util.R", sep=""))
scriptCaptureR = options[1]
diff --git a/encoder/call_graph.R b/encoder/call_graph.R
index c972e03..58daf63 100644
--- a/encoder/call_graph.R
+++ b/encoder/call_graph.R
@@ -3,7 +3,7 @@
# Copyright (C) 2014-2015 Xavier de Blas <xaviblas gmail com>
#
-#Is A LOT faster to call this file from C#, and this file will do a source(scriptGraphR)
+#Is A LOT faster to call this file from C#, and this file will do a source("graph.R")
#than calling that file directly
@@ -19,24 +19,16 @@ options <- scan(optionsFile, comment.char="#", what=character(), sep="\n")
#this code should be the same as utilEncoder.cs RunEncoderGraphRDotNet
#---------------------------------------------------------------------
-OutputData2 <- options[4] #currently used to display processing feedback
-SpecialData <- options[5]
+FeedbackFileBase <- paste(options[5], "/chronojump-encoder-status-", sep="")
+SpecialData <- paste(options[5], "/chronojump-special-data.txt", sep="")
OperatingSystem <- options[27]
EncoderConfigurationName <- ""
-English = unlist(strsplit(options[30], "\\;"))
-Translated = unlist(strsplit(options[31], "\\;"))
+English = unlist(strsplit(options[28], "\\;"))
+Translated = unlist(strsplit(options[29], "\\;"))
-#TODO: now that there's a start and continue of each process from R,
-#instead of pass and script from R,
-#pass the directory
-#and R will source() the needed files (maybe all the first time)
-#and it will not do again when the process is continued (see encoderRProc.cs)
+source(paste(options[4], "/util.R", sep=""))
-scriptUtilR = options[28]
-source(scriptUtilR)
-
-scriptGraphR = options[32]
#Note:
#We just touch this files because in the past we created a unique status file from here
@@ -44,24 +36,18 @@ scriptGraphR = options[32]
#but we read it at the same time from chronojump and this produces some crashes on windows
#now we just touch here, and in chronojump we just read if exist
-#write(paste("(1/5)",translateToPrint("Starting R")), OutputData2)
-print("Creating (OutputData2)1.txt with touch method...")
-file.create(paste(OutputData2,"1.txt",sep=""))
-print("Created")
+print("Creating (FeedbackFileBase)1.txt with touch method...")
+file.create(paste(FeedbackFileBase,"1.txt",sep=""))
-source(scriptGraphR)
+source(paste(options[4], "/graph.R", sep=""))
-#write(paste("(2/5)",translateToPrint("Loading libraries")), OutputData2)
-print("Creating (OutputData2)2.txt with touch method...")
-file.create(paste(OutputData2,"2.txt",sep=""))
-print("Created")
+print("Creating (FeedbackFileBase)2.txt with touch method...")
+file.create(paste(FeedbackFileBase,"2.txt",sep=""))
loadLibraries(OperatingSystem)
-#write(paste("(3/5)",translateToPrint("Starting process")), OutputData2)
-print("Creating (OutputData2)3.txt with touch method...")
-file.create(paste(OutputData2,"3.txt",sep=""))
-print("Created")
+print("Creating (FeedbackFileBase)3.txt with touch method...")
+file.create(paste(FeedbackFileBase,"3.txt",sep=""))
#open stdin connection
f <- file("stdin")
diff --git a/encoder/capture.R b/encoder/capture.R
index 493cd05..b5f043a 100644
--- a/encoder/capture.R
+++ b/encoder/capture.R
@@ -67,11 +67,17 @@ calcule <- function(displacement, op, curveNum)
if(debug)
write("At calcule calling kinematics", stderr())
- kinematicsResult <- kinematicsF(displacement,
- op$MassBody, op$MassExtra, op$ExercisePercentBodyWeight,
- op$EncoderConfigurationName, op$diameter, op$diameterExt, op$anglePush, op$angleWeight,
op$inertiaMomentum, op$gearedDown,
- SmoothingsEC, op$SmoothingOneC,
- g, myEcconKn, isPropulsive)
+
+
+ kinematicsResult <- kinematicsF(
+ displacement,
+ assignRepOptions(
+ TRUE, NULL, NULL,
+ op$MassBody, op$MassExtra, myEcconKn,
op$ExercisePercentBodyWeight,
+ op$EncoderConfigurationName, op$diameter, op$diameterExt,
+ op$anglePush, op$angleWeight, op$inertiaMomentum,
op$gearedDown,
+ ""), #laterality
+ SmoothingsEC, op$SmoothingOneC, g, isPropulsive)
paf = data.frame()
myLaterality = "" #TODO
diff --git a/encoder/graph.R b/encoder/graph.R
index b2eff00..8014d4a 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -628,49 +628,6 @@ findSmoothingsEC <- function(singleFile, displacement, curves, eccon, smoothingO
return(smoothings)
}
-#if single file all repetitions have Roptions, but if not, each one has different values
-assignRepOptions <- function(
- singleFile, curves, i,
- massBody, massExtra, eccon, exPercentBodyWeight,
- econfName, diameter, diameterExt,
- anglePush, angleWeight, inertiaM, gearedDown,
- laterality)
-{
- if(singleFile) {
- return(list(
- massBody = massBody,
- massExtra = massExtra,
- eccon = eccon,
- exPercentBodyWeight = exPercentBodyWeight,
-
- econfName = econfName,
- diameter = diameter,
- diameterExt = diameterExt,
- anglePush = anglePush,
- angleWeight = angleWeight,
- inertiaM = inertiaM,
- gearedDown = gearedDown,
- laterality = laterality
- ))
- } else {
- return(list(
- massBody = curves[i,5],
- massExtra = curves[i,6],
- eccon = curves[i,8],
- exPercentBodyWeight = curves[i,10],
-
- econfName = curves[i,11],
- diameter = curves[i,12],
- diameterExt = curves[i,13],
- anglePush = curves[i,14],
- angleWeight = curves[i,15],
- inertiaM = curves[i,16],
- gearedDown = curves[i,17],
- laterality = curves[i,18]
- ))
- }
-}
-
kinematicRanges <- function(singleFile, displacement, curves,
massBody, massExtra, exercisePercentBodyWeight,
@@ -689,12 +646,7 @@ kinematicRanges <- function(singleFile, displacement, curves,
"") #laterality
kn <- kinematicsF(displacement[curves[i,1]:curves[i,2]],
- #myMassBody, myMassExtra, myExPercentBodyWeight,
-
#myEncoderConfigurationName,myDiameter,myDiameterExt,myAnglePush,myAngleWeight,myInertiaMomentum,myGearedDown,
- repOp,
-
- #smoothingsEC[i], smoothingOneC, g, myEccon, isPropulsive)
- smoothingsEC[i], smoothingOneC, g, isPropulsive)
+ repOp, smoothingsEC[i], smoothingOneC, g, isPropulsive)
if(max(abs(kn$speedy)) > maxSpeedy)
maxSpeedy = max(abs(kn$speedy))
@@ -725,10 +677,9 @@ canJump <- function(encoderConfigurationName)
#find at what pixel (X) of final graph we have a millisecond
#time is the time in ms where we search the pixel
#this function will be moved to C# code
-calculatePixelXByTime <- function (time, xstart, xend, width)
+calculatePixelXByTime <- function (time, width)
{
write("sending coordinates",stderr())
- write(c(xstart,xend),stderr())
write(c("usr",par("usr")),stderr())
write(c("plt",par("plt")),stderr())
@@ -835,8 +786,6 @@ paint <- function(displacement, eccon, xmin, xmax, yrange, knRanges, superpose,
abline(h=0,lty=3,col="black")
#abline(v=seq(from=0,to=length(position),by=500),lty=3,col="gray")
-
- calculatePixelXByTime(100, startX, length(position), width)
}
print(c("smoothing at paint=",smoothing))
@@ -2330,22 +2279,19 @@ doProcess <- function(options)
op$Title=parse(text = paste0("'", op$Title, "'"))
print(c("1 Title=",op$Title))
- #options 30 and 31 is assigned on the top of the file to be available in all functions
+ #options 29 and 30 is assigned on the top of the file to be available in all functions
+ #print(options[29])
#print(options[30])
- #print(options[31])
- #options 32 is this graph.R file and it's used in call_graph.R to call this as source (in RDotNet)
#--- include files ---
- #if(op$scriptOne != "none")
- # source(op$scriptOne)
- if(op$scriptTwo != "none")
- source(op$scriptTwo)
+ if(op$Analysis == "neuromuscularProfile")
+ source(paste(op$EncoderRScriptsPath, "/neuromuscularProfile.R", sep=""))
print(op$File)
print(op$OutputGraph)
print(op$OutputData1)
- print(op$OutputData2)
+ print(op$FeedbackFileBase)
print(op$SpecialData)
#read AnalysisOptions
@@ -2709,9 +2655,9 @@ doProcess <- function(options)
#make some check here, because this file is being readed in chronojump
- #write(paste("(4/5)",translateToPrint("Repetitions processed")), op$OutputData2)
- print("Creating (op$OutputData2)4.txt with touch method...")
- file.create(paste(op$OutputData2,"4.txt",sep=""))
+ #write(paste("(4/5)",translateToPrint("Repetitions processed")), op$FeedbackFileBase)
+ print("Creating (op$FeedbackFileBase)4.txt with touch method...")
+ file.create(paste(op$FeedbackFileBase,"4.txt",sep=""))
print("Created")
#print(curves)
@@ -2761,6 +2707,9 @@ doProcess <- function(options)
(op$AnalysisVariables[4] == "Power") #show power
)
+
+ #calculatePixelXByTime(100, width)
+ write(c(op$Width, par("usr"), par("plt")), op$SpecialData)
#record array of data
write("going to create array of data", stderr())
@@ -2772,7 +2721,9 @@ doProcess <- function(options)
colnames(df)=c("speed","acceleration","force","power")
write("going to write it to file", stderr())
- write.csv(df, op$SpecialData, quote=FALSE)
+ write.csv(df, op$SpecialData, append=TRUE, quote=FALSE) #append #TODO: append no va,
sempre sobreescriu. Val, ho diu l'ajuda q no ho fa perque no seria un csv correcte. Aixi que cal dos arxius
diferents. Un pel csv i l'altra per aquestes dades de calculatePixelXByTime
+ #TODO: el millor es enviar el path a tmp i que aqui es generin els arxius, enlloc de
enviar de C# a R el SpecialData...
+
write("done!", stderr())
}
}
@@ -3198,10 +3149,15 @@ doProcess <- function(options)
for(i in 1:curvesNum) {
#exportCSV exports a signal, for this reason op$MassBody, op$MassExtra are ok. Don't
need to check parameters of different signals
- kn = kinematicsF (displacement[curves[i,1]:curves[i,2]],
- op$MassBody, op$MassExtra, op$ExercisePercentBodyWeight,
-
op$EncoderConfigurationName,op$diameter,op$diameterExt,op$anglePush,op$angleWeight,op$inertiaMomentum,op$gearedDown,
- SmoothingsEC[i], op$SmoothingOneC, g, op$Eccon, isPropulsive)
+ repOp <- assignRepOptions(
+ TRUE, NULL, NULL,
+ op$MassBody, op$MassExtra, op$Eccon,
op$ExercisePercentBodyWeight,
+ op$EncoderConfigurationName,op$diameter,op$diameterExt,
+
op$anglePush,op$angleWeight,op$inertiaMomentum,op$gearedDown,
+ "") #laterality
+
+ kn <- kinematicsF(displacement[curves[i,1]:curves[i,2]],
+ repOp, smoothingsEC[i], op$smoothingOneC, g, isPropulsive)
#fill with NAs in order to have the same length
col1 = displacement[curves[i,1]:curves[i,2]]
@@ -3281,9 +3237,9 @@ doProcess <- function(options)
dev.off()
#make some check here, because this file is being readed in chronojump
- #write(paste("(5/5)",translateToPrint("R tasks done")), op$OutputData2)
- print("Creating (op$OutputData2)5.txt with touch method...")
- file.create(paste(op$OutputData2,"5.txt",sep=""))
+ #write(paste("(5/5)",translateToPrint("R tasks done")), op$FeedbackFileBase)
+ print("Creating (op$FeedbackFileBase)5.txt with touch method...")
+ file.create(paste(op$FeedbackFileBase,"5.txt",sep=""))
print("Created")
write("created ...5.txt", stderr())
diff --git a/encoder/util.R b/encoder/util.R
index 9b8a2ad..b16f6fd 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -32,10 +32,12 @@ assignOptions <- function(options) {
File = options[1],
OutputGraph = options[2],
OutputData1 = options[3],
- OutputData2 = options[4], #currently used to display processing feedback
- SpecialData = options[5], #currently used to write 1RM. variable;result (eg.
"1RM;82.78"). Or to write data on op$Analysis=="single" speed, accel, force, power for each ms
+ EncoderRScriptsPath = options[4],
+ EncoderTempPath = options[5],
+ FeedbackFileBase = paste(options[5], "/chronojump-encoder-status-", sep=""),
+ SpecialData = paste(options[5], "/chronojump-special-data.txt", sep=""),
MinHeight = as.numeric(options[6])*10, #from cm to mm
- ExercisePercentBodyWeight = as.numeric(options[7]), #was
isJump=as.logical(options[6])
+ ExercisePercentBodyWeight = as.numeric(options[7]),
MassBody = as.numeric(options[8]),
MassExtra = as.numeric(options[9]),
Eccon = options[10],
@@ -57,7 +59,7 @@ assignOptions <- function(options) {
EncoderConfigurationName = options[14], #just the name of the EncoderConfiguration
diameter = as.numeric(unlist(strsplit(options[15], "\\;"))), #comes in cm,
will be converted to m. Since 1.5.1 can be different diameters separated by ;
#diameter = getInertialDiametersPerTick(as.numeric(unlist(strsplit("1.5; 1.75; 2.65;
3.32; 3.95; 4.07; 4.28; 4.46; 4.54; 4.77; 4.96; 5.13; 5.3; 5.55", "\\;")))),
- diameterExt = as.numeric(options[16]), #comes in cm, will be converted to m
+ diameterExt = as.numeric(options[16]), #comes in cm, will be converted to m
anglePush = as.numeric(options[17]),
angleWeight = as.numeric(options[18]),
inertiaMomentum = (as.numeric(options[19])/10000.0), #comes in Kg*cm^2 eg: 100;
convert it to Kg*m^2 eg: 0.010
@@ -69,11 +71,8 @@ assignOptions <- function(options) {
Height = as.numeric(options[24]),
DecimalSeparator = options[25],
Title = options[26],
- OperatingSystem = options[27], #if this changes, change it also at start of this R
file
+ OperatingSystem = options[27]#, #if this changes, change it also at start of this R
file
#IMPORTANT, if this grows, change the readLines value on getOptionsFromFile
-
- scriptOne = options[28], #util.R
- scriptTwo = options[29] #neuromuscularProfile.R
))
}
@@ -394,6 +393,53 @@ reduceCurveBySpeed <- function(eccon, row, startT, startH, displacement, smoothi
return(c(startT + x.ini, startT + x.end, startH))
}
+
+#for graph.R, if single file all repetitions have Roptions, but if not, each one has different values
+#for capture.R pass singleFile as TRUE, curves as NULL, and i as NULL
+assignRepOptions <- function(
+ singleFile, curves, i,
+ massBody, massExtra, eccon, exPercentBodyWeight,
+ econfName, diameter, diameterExt,
+ anglePush, angleWeight, inertiaM, gearedDown,
+ laterality)
+{
+ if(singleFile) {
+ return(list(
+ massBody = massBody,
+ massExtra = massExtra,
+ eccon = eccon,
+ exPercentBodyWeight = exPercentBodyWeight,
+
+ econfName = econfName,
+ diameter = diameter,
+ diameterExt = diameterExt,
+ anglePush = anglePush,
+ angleWeight = angleWeight,
+ inertiaM = inertiaM,
+ gearedDown = gearedDown,
+ laterality = laterality
+ ))
+ } else {
+ return(list(
+ massBody = curves[i,5],
+ massExtra = curves[i,6],
+ eccon = curves[i,8],
+ exPercentBodyWeight = curves[i,10],
+
+ econfName = curves[i,11],
+ diameter = curves[i,12],
+ diameterExt = curves[i,13],
+ anglePush = curves[i,14],
+ angleWeight = curves[i,15],
+ inertiaM = curves[i,16],
+ gearedDown = curves[i,17],
+ laterality = curves[i,18]
+ ))
+ }
+}
+
+
+
#go here with every single curve
#repOp has the options for this repetition
#repOp$eccon="c" one time each curve
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 4f9e558..1bc96bb 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -7975,6 +7975,9 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
<child>
@@ -9443,6 +9446,9 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">2</property>
@@ -10552,6 +10558,9 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">4</property>
@@ -17912,6 +17921,182 @@ on current Chronojump version.</property>
<property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
+ <widget class="GtkVBox" id="vbox64">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkVBox" id="vbox68">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">2</property>
+ <child>
+ <widget class="GtkHScale"
id="hscale_encoder_analyze_1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="round_digits">1</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHScale"
id="hscale_encoder_analyze_2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="round_digits">1</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">5</property>
+ <property name="column_spacing">4</property>
+ <property name="row_spacing">4</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label143">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Speed</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label144">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Acceleration</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label145">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Force</property>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label146">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Power</property>
+ </widget>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_encoder_analyze_speed_1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_encoder_analyze_accel_1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_encoder_analyze_force_1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel"
id="label_encoder_analyze_power_1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"/>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkScrolledWindow"
id="scrolledwindow4">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -17938,6 +18123,13 @@ on current Chronojump version.</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -22330,6 +22522,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -23338,6 +23533,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -24838,6 +25036,9 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -25395,6 +25596,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -37345,6 +37549,24 @@ options</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -39340,6 +39562,18 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -40632,9 +40866,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<placeholder/>
</child>
<child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel" id="label218">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -41642,6 +41873,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -45422,6 +45656,9 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -46094,6 +46331,9 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -46781,6 +47021,9 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/encoder.cs b/src/encoder.cs
index d452a51..403d769 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -131,18 +131,21 @@ public class EncoderStruct
public string InputData;
public string OutputGraph;
public string OutputData1;
- public string OutputData2;
- public string SpecialData;
+ public string EncoderRPath; //to load other R scripts
+ public string EncoderTempPath; //use for Status, Special, GraphParams....
public EncoderParams Ep;
- public EncoderStruct(string InputData, string OutputGraph, string OutputData1, string OutputData2,
- string SpecialData, EncoderParams Ep)
+ //pass this to R
+ public EncoderStruct(string InputData, string OutputGraph,
+ string OutputData1,
+ string EncoderRPath, string EncoderTempPath,
+ EncoderParams Ep)
{
this.InputData = InputData;
this.OutputGraph = OutputGraph;
this.OutputData1 = OutputData1;
- this.OutputData2 = OutputData2;
- this.SpecialData = SpecialData;
+ this.EncoderRPath = EncoderRPath;
+ this.EncoderTempPath = EncoderTempPath;
this.Ep = Ep;
}
@@ -154,39 +157,31 @@ public class EncoderGraphROptions
public string inputData;
public string outputGraph;
public string outputData1;
- public string outputData2;
- public string specialData;
+ public string encoderRPath;
+ public string encoderTempPath;
public EncoderParams ep;
public string title;
public string operatingSystem;
- public string scriptUtilR;
- public string scriptNeuromuscularProfile;
public string englishWords;
public string translatedWords;
- public string scriptGraphR;
public EncoderGraphROptions(
string inputData, string outputGraph, string outputData1,
- string outputData2, string specialData,
+ string encoderRPath, string encoderTempPath,
EncoderParams ep,
string title, string operatingSystem,
- string scriptUtilR, string scriptNeuromuscularProfile,
- string englishWords, string translatedWords,
- string scriptGraphR)
+ string englishWords, string translatedWords)
{
this.inputData = inputData;
this.outputGraph = outputGraph;
this.outputData1 = outputData1;
- this.outputData2 = outputData2;
- this.specialData = specialData;
+ this.encoderRPath = encoderRPath;
+ this.encoderTempPath = encoderTempPath;
this.ep = ep;
this.title = title;
this.operatingSystem = operatingSystem;
- this.scriptUtilR = scriptUtilR;
- this.scriptNeuromuscularProfile = scriptNeuromuscularProfile;
this.englishWords = englishWords;
this.translatedWords = translatedWords;
- this.scriptGraphR = scriptGraphR;
}
public override string ToString() {
@@ -194,17 +189,15 @@ public class EncoderGraphROptions
"#inputdata\n" + inputData + "\n" +
"#outputgraph\n" + outputGraph + "\n" +
"#outputdata1\n" + outputData1 + "\n" +
- "#outputdata2\n" + outputData2 + "\n" +
- "#specialdata\n" + specialData + "\n" +
+ "#encoderRPath\n" + encoderRPath + "\n" +
+ "#encoderTempPath\n" + encoderTempPath + "\n" +
ep.ToStringROptions() + "\n" +
"#title\n" + title + "\n" +
"#operatingsystem\n" + operatingSystem + "\n" +
- "#scriptUtilR\n" + scriptUtilR + "\n" +
- "#scriptNeuromuscularProfile\n" + scriptNeuromuscularProfile + "\n" +
"#englishWords\n" + englishWords + "\n" +
- "#translatedWords\n" + translatedWords + "\n" +
- "#scriptGraphR\n" + scriptGraphR + "\n";
+ "#translatedWords\n" + translatedWords + "\n";
}
+
~EncoderGraphROptions() {}
}
@@ -1453,7 +1446,9 @@ public class EncoderAnalyzeInstant
force = new List<double>();
power = new List<double>();
}
-
+
+ //file has a first line with headers
+ //2nd.... full data
public void ReadFile(string filename)
{
List<string> lines = Util.ReadFileAsStringList(filename);
diff --git a/src/encoderRProc.cs b/src/encoderRProc.cs
index 5a20242..04b408f 100644
--- a/src/encoderRProc.cs
+++ b/src/encoderRProc.cs
@@ -416,8 +416,9 @@ public class EncoderRProcAnalyze : EncoderRProc
Util.FileDelete(UtilEncoder.GetEncoderStatusTempBaseFileName() + "5.txt");
//delete 1RM data if exists
- if (File.Exists(es.SpecialData))
- File.Delete(es.SpecialData);
+ string specialData = UtilEncoder.GetEncoderSpecialDataTempFileName();
+ if (File.Exists(specialData))
+ File.Delete(specialData);
try {
@@ -487,8 +488,9 @@ public class EncoderRProcAnalyze : EncoderRProc
Util.FileDelete(UtilEncoder.GetEncoderStatusTempBaseFileName() + "5.txt");
//delete 1RM data if exists
- if (File.Exists(es.SpecialData))
- File.Delete(es.SpecialData);
+ string specialData = UtilEncoder.GetEncoderSpecialDataTempFileName();
+ if (File.Exists(specialData))
+ File.Delete(specialData);
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 50d0027..ed7532e 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -886,8 +886,8 @@ public partial class ChronoJumpWindow
UtilEncoder.GetEncoderDataTempFileName(),
UtilEncoder.GetEncoderGraphTempFileName(),
UtilEncoder.GetEncoderCurvesTempFileName(),
- UtilEncoder.GetEncoderStatusTempBaseFileName(),
- UtilEncoder.GetEncoderSpecialDataTempFileName(),
+ UtilEncoder.GetEncoderScriptsPathWithoutLastSep(),
+ UtilEncoder.GetEncoderTempPathWithoutLastSep(),
ep);
@@ -1678,8 +1678,8 @@ public partial class ChronoJumpWindow
dataFileName,
UtilEncoder.GetEncoderGraphTempFileName(),
Util.GetEncoderExportTempFileName(),
- UtilEncoder.GetEncoderStatusTempBaseFileName(),
- UtilEncoder.GetEncoderSpecialDataTempFileName(),
+ UtilEncoder.GetEncoderScriptsPathWithoutLastSep(),
+ UtilEncoder.GetEncoderTempPathWithoutLastSep(),
ep);
encoderRProcAnalyze.ExportFileName = selectedFileName;
@@ -2985,8 +2985,8 @@ public partial class ChronoJumpWindow
dataFileName,
UtilEncoder.GetEncoderGraphTempFileName(),
UtilEncoder.GetEncoderAnalyzeTableTempFileName(),
- UtilEncoder.GetEncoderStatusTempBaseFileName(),
- UtilEncoder.GetEncoderSpecialDataTempFileName(),
+ UtilEncoder.GetEncoderScriptsPathWithoutLastSep(),
+ UtilEncoder.GetEncoderTempPathWithoutLastSep(),
ep);
//show mass in title except if it's curves because then can be different mass
@@ -4988,8 +4988,8 @@ public partial class ChronoJumpWindow
UtilEncoder.GetEncoderScriptCaptureNoRdotNet(),//1st option used here to
allow to call the main capture script
UtilEncoder.GetEncoderCaptureTempFileName(), //2nd option used here to
print the captured data file
"none", //UtilEncoder.GetEncoderCurvesTempFileName(),
- "none", //UtilEncoder.GetEncoderStatusTempBaseFileName(),
- "none", //SpecialData
+ UtilEncoder.GetEncoderScriptsPathWithoutLastSep(),
+ UtilEncoder.GetEncoderTempPathWithoutLastSep(),
ep);
encoderRProcCapture.StartOrContinue(es);
diff --git a/src/utilEncoder.cs b/src/utilEncoder.cs
index c94d3b2..9260724 100644
--- a/src/utilEncoder.cs
+++ b/src/utilEncoder.cs
@@ -117,6 +117,15 @@ public class UtilEncoder
public static string GetEncoderSpecialDataTempFileName() {
return Path.Combine(Path.GetTempPath(), Constants.EncoderSpecialDataTemp);
}
+ public static string GetEncoderTempPathWithoutLastSep() {
+ string s = Path.GetTempPath(); //is just temp path
+
+ //but send it without the final '\' or '/' (if found)
+ if(s.EndsWith("/") || s.EndsWith("\\"))
+ s = s.Substring(0, s.Length -1);
+
+ return s;
+ }
// public static void MoveTempToEncoderData(int sessionID, int uniqueID)
@@ -207,6 +216,17 @@ public class UtilEncoder
Util.GetDataDir(), "encoder", Constants.EncoderScriptUtilR);
}
+ public static string GetEncoderScriptsPathWithoutLastSep() {
+ string s = System.IO.Path.Combine(Util.GetDataDir(), "encoder");
+
+ //but send it without the final '\' or '/' (if found)
+ if(s.EndsWith("/") || s.EndsWith("\\"))
+ s = s.Substring(0, s.Length -1);
+
+ return s;
+ }
+
+
/********** end of encoder paths ************/
@@ -274,14 +294,6 @@ public class UtilEncoder
public static EncoderGraphROptions PrepareEncoderGraphOptions(string title, EncoderStruct es, bool
neuromuscularProfileDo, bool translate)
{
- string scriptUtilR = GetEncoderScriptUtilR();
-
- string scriptNeuromuscularProfile = "none"; //cannot be blank
- if(neuromuscularProfileDo)
- scriptNeuromuscularProfile = GetEncoderScriptNeuromuscularProfile();
-
- string scriptGraphR = GetEncoderScriptGraph();
-
string operatingSystem = "Linux";
title = Util.RemoveBackSlash(title);
@@ -296,11 +308,9 @@ public class UtilEncoder
es.InputData = es.InputData.Replace("\\","/");
es.OutputGraph = es.OutputGraph.Replace("\\","/");
es.OutputData1 = es.OutputData1.Replace("\\","/");
- es.OutputData2 = es.OutputData2.Replace("\\","/");
- es.SpecialData = es.SpecialData.Replace("\\","/");
- scriptUtilR = scriptUtilR.Replace("\\","/");
- scriptNeuromuscularProfile = scriptNeuromuscularProfile.Replace("\\","/");
- scriptGraphR = scriptGraphR.Replace("\\","/");
+ //es.OutputData2 = es.OutputData2.Replace("\\","/");
+ //es.SpecialData = es.SpecialData.Replace("\\","/");
+ es.EncoderTempPath = es.EncoderTempPath.Replace("\\","/");
operatingSystem = "Windows";
}
@@ -332,13 +342,12 @@ public class UtilEncoder
return new EncoderGraphROptions(
es.InputData, es.OutputGraph, es.OutputData1,
- es.OutputData2, es.SpecialData,
+ //es.OutputData2, es.SpecialData,
+ es.EncoderRPath, es.EncoderTempPath,
es.Ep,
title, operatingSystem,
- scriptUtilR, scriptNeuromuscularProfile,
Util.StringArrayToString(Constants.EncoderEnglishWords,";"),
- Util.StringArrayToString(encoderTranslatedWordsOK,";"),
- scriptGraphR);
+ Util.StringArrayToString(encoderTranslatedWordsOK,";"));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]