[chronojump] Added new encoder analyze intersession mode Pmax(F0,V0)



commit c4bcb8d2bf07b1e186c25d6a555b365123096516
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jan 16 14:29:11 2018 +0100

    Added new encoder analyze intersession mode Pmax(F0,V0)

 encoder/graph.R               |   19 +++++++++++++------
 encoder/pfvProfileEvolution.R |   20 ++++++++++++++++----
 encoder/util.R                |    5 ++++-
 src/gui/encoder.cs            |   26 ++++++++++++++++++--------
 4 files changed, 51 insertions(+), 19 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 6d4c0a9..3c11460 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -2429,7 +2429,7 @@ doProcess <- function(options)
         #--- include files ---
         if(op$Analysis == "neuromuscularProfile")
                 source(paste(op$EncoderRScriptsPath, "/neuromuscularProfile.R", sep=""))
-        if(op$Analysis == "pfvProfileEvolution")
+        else if(op$Analysis == "cross" && op$AnalysisVariables[1] == "Pmax(F0,V0)")
                 source(paste(op$EncoderRScriptsPath, "/pfvProfileEvolution.R", sep=""))
         
         print(op$File)
@@ -3223,6 +3223,10 @@ doProcess <- function(options)
         #since Chronojump 1.3.6, encoder analyze has a treeview that can show the curves
         #when an analysis is done, curves file has to be written
         writeCurves = TRUE
+
+       #declare pafCurves
+       pafCurves = NULL
+
         #but don't writeCurves on exportCSV because outputfile is the same 
         if(op$Analysis == "exportCSV" || op$Analysis=="1RMIndirect")
                 writeCurves = FALSE
@@ -3324,7 +3328,7 @@ doProcess <- function(options)
                                                         (op$AnalysisVariables[2] == "Range")           #show 
range
                                 ) 
                 }
-                else if(op$Analysis == "cross")
+                else if(op$Analysis == "cross" && op$AnalysisVariables[1] != "Pmax(F0,V0)")
                {
                        print("printing PAF")
                         print(paf)
@@ -3463,10 +3467,7 @@ doProcess <- function(options)
                         
                         neuromuscularProfileWriteData(npj, op$OutputData1)
                 }
-                else if(op$Analysis == "pfvProfileEvolution"){
-                        
pfvProfileExecute(paste(op$EncoderTempPath,"/chronojump-last-encoder-analyze-table.txt",sep=""))
-                }
-                
+
                 if(op$Analysis == "curves" || op$Analysis == "curvesAC" || writeCurves) {
                         #create pafCurves to be printed on CSV. This columns are going to be removed:
                         
@@ -3572,6 +3573,12 @@ doProcess <- function(options)
                         #print("curves written")
                 }
         }
+
+       #Pmax(F0,V0) will use pafCurves
+        if(op$Analysis == "cross" && op$AnalysisVariables[1] == "Pmax(F0,V0)")
+       {
+               pfvProfileExecute(pafCurves)
+       }
         
         if(op$Analysis=="1RMIndirect") {
                 #Q <- getMassBodyByExercise(op$MassBody, op$ExercisePercentBodyWeight) + op$MassExtra
diff --git a/encoder/pfvProfileEvolution.R b/encoder/pfvProfileEvolution.R
index a055903..0148e1c 100644
--- a/encoder/pfvProfileEvolution.R
+++ b/encoder/pfvProfileEvolution.R
@@ -120,11 +120,23 @@ pfvProfileDrawProfilesEvolution <- function(analyzeTable)
         mtext("Maximum mean power using the F-V profile of each session", side = 4, line = -2)
 }
 
-pfvProfileExecute <- function(inputFile,graphMode)
+pfvProfileExecute <- function(analyzeTable)
+{
+       #colnames(analyzeTable)[2] = "date"
+       #if reading from "/tmp/chronojump-last-encoder-analyze-table.txt", "series" is the second column, but
+       #using pafCurves "series" is the first column
+       colnames(analyzeTable)[which(colnames(analyzeTable)=="series")] = "date"
+
+       print("analyzeTable[2,]")
+       print(analyzeTable[2,])
+
+       pfvProfileDrawProfilesEvolution(analyzeTable)
+}
+
+pfvProfileReadFile <- function(inputFile)
 {
         analyzeTable = read.csv(inputFile, dec = ".", sep = ",")
-        colnames(analyzeTable)[2] = "date"
-        pfvProfileDrawProfilesEvolution(analyzeTable)
+        return(analyzeTable)
 }
 
-pfvProfileExecute("/tmp/chronojump-last-encoder-analyze-table.txt")
+#pfvProfileExecute(pfvProfileReadFile("/tmp/chronojump-last-encoder-analyze-table.txt"))
diff --git a/encoder/util.R b/encoder/util.R
index f63cb8a..14bf775 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -44,11 +44,14 @@ assignOptions <- function(options) {
                    #in Analysis "cross", AnalysisVariables can be "Force;Speed;mean". 1st is Y, 2nd is X. 
"mean" can also be "max"
                    #Analysis "cross" can have a double XY plot, AnalysisVariables = "Speed,Power;Load;mean"
                    #   1st: Speed,power are Y (left and right), 2n: Load is X.
-                   #In interssession, x should be along time. In order to recicle paintCrossVariables, a 4th 
member is sent: "Date".
+                   #In interssession, x can be date. In order to recicle paintCrossVariables, a 4th member 
is sent: "Date".
                    #   Power;Load;mean;Date will be an Power / Date (with Load as seriesName)
                    #   Speed;Load;mean;Date will be an Speed / Date (with Load as seriesName)
                    #   Force;Load;mean;Date will be an Force / Date (with Load as seriesName)
                    #
+                   #Intersession Pmax(F0,V0) has not Date on X, so AnalusisVariables are:
+                   #   Pmax(F0,V0);Pmax(F0,V0);mean
+                   #
                    #in Analysis "powerBars", AnalysisVariables can be:
                    #   "TimeToPeakPower;Range", or eg: "NoTimeToPeakPower;NoRange"
                    #
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 89af919..6e5d9d0 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -2589,13 +2589,19 @@ public partial class ChronoJumpWindow
                                                encoderAnalyzeCrossTranslation);
                        
                        if(
-                                       crossName == "Power / Load" || crossName == "Speed / Load" || 
-                                       crossName == "Force / Load" || crossName == "Speed,Power / Load" || 
+                                       crossName == "Power / Load" || crossName == "Speed / Load" || 
crossName == "Force / Load" ||
+                                       crossName == "Pmax(F0,V0)" ||
+                                       crossName == "Speed,Power / Load" ||
                                        crossName == "Force,Power / Speed"|| crossName == "Power / Speed" )
                        {
-                               //convert: "Force,Power / Speed" in: "Force,Power;Speed;mean"
-                               string [] crossNameFull = crossName.Split(new char[] {' '});
-                               analysisVariables = crossNameFull[0] + ";" + crossNameFull[2]; //[1]=="/"
+                               if(crossName == "Pmax(F0,V0)")
+                                       analysisVariables = "Pmax(F0,V0);Pmax(F0,V0)"; //this is not used but 
we want to preserve chunks between ';'
+                               else {
+                                       //convert: "Force,Power / Speed" in: "Force,Power;Speed;mean"
+                                       string [] crossNameFull = crossName.Split(new char[] {' '});
+                                       analysisVariables = crossNameFull[0] + ";" + crossNameFull[2]; 
//[1]=="/"
+                               }
+
                                if(check_encoder_analyze_mean_or_max.Active)
                                        analysisVariables += ";mean";
                                else
@@ -3614,15 +3620,19 @@ public partial class ChronoJumpWindow
                if(! dateOnX) {
                        //create combo analyze cross (variables)
                        comboAnalyzeCrossOptions = new string [] { 
-                               "Power / Load", "Speed / Load", "Force / Load", "Speed,Power / Load", 
"Force,Power / Speed", "Power / Speed"
+                               "Power / Load", "Speed / Load", "Force / Load",
+                                       "Pmax(F0,V0)",
+                                       "Speed,Power / Load", "Force,Power / Speed", "Power / Speed"
                        };
                        comboAnalyzeCrossOptionsTranslated = new string [] { 
                                Catalog.GetString("Power / Load"), Catalog.GetString("Speed / Load"), 
-                               Catalog.GetString("Force / Load"), Catalog.GetString("Speed,Power / Load"), 
+                               Catalog.GetString("Force / Load"),
+                               "Pmax(F0,V0)", //will not be translated
+                               Catalog.GetString("Speed,Power / Load"),
                                Catalog.GetString("Force,Power / Speed"), Catalog.GetString("Power / Speed")
                        }; //if added more, change the int in the 'for' below
                        encoderAnalyzeCrossTranslation = new String [comboAnalyzeCrossOptions.Length];
-                       for(int j=0; j < 6 ; j++)
+                       for(int j=0; j < 7 ; j++)
                                encoderAnalyzeCrossTranslation[j] = 
                                        comboAnalyzeCrossOptions[j] + ":" + 
comboAnalyzeCrossOptionsTranslated[j];
                } else {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]