[chronojump] NEW: Encoder intersession analyze date on X
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] NEW: Encoder intersession analyze date on X
- Date: Sun, 15 May 2016 23:57:59 +0000 (UTC)
commit 9a54840d383450f83995300241036766c9039cca
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon May 16 01:54:22 2016 +0200
NEW: Encoder intersession analyze date on X
encoder/graph.R | 43 +++++++++++----
encoder/util.R | 4 ++
glade/chronojump.glade | 86 +++++++++++++++++++++++++++---
src/gui/encoder.cs | 136 ++++++++++++++++++++++++++++++++++--------------
4 files changed, 210 insertions(+), 59 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index a3da7fe..9ddd71b 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -1537,7 +1537,8 @@ paintCrossVariablesLaterality <- function(x, y, laterality, colBalls)
}
#option: mean or max
-paintCrossVariables <- function (paf, varX, varY, option, isAlone, title, singleFile, Eccon, ecconVector,
seriesName,
+paintCrossVariables <- function (paf, varX, varY, option, dateAsX,
+ isAlone, title, singleFile, Eccon, ecconVector, seriesName,
diameter, gearedDown,
do1RM, do1RMMethod, outputData1)
{
@@ -1572,6 +1573,12 @@ paintCrossVariables <- function (paf, varX, varY, option, isAlone, title, single
varX = "Resistant torque"
varXut = "Resistant torque (Kg*cm)"
}
+
+ if(dateAsX) {
+ xCopy <- x
+ x <- as.Date(seriesName)
+ seriesName <- xCopy
+ }
nums.print = NULL
@@ -1656,7 +1663,7 @@ paintCrossVariables <- function (paf, varX, varY, option, isAlone, title, single
paintCrossVariablesLaterality(x, y, laterality, colBalls)
} else {
- if(varY == "Power") {
+ if(varY == "Power" && ! dateAsX) {
#1) fitCurveCalc is calculated first to know plot ylim (curve has to
be inside the plot)
temp.list <- fitCurveCalc(x,y)
fit <- temp.list[[1]]
@@ -1801,11 +1808,14 @@ paintCrossVariables <- function (paf, varX, varY, option, isAlone, title, single
for(i in 1:length(seriesName)) {
thisSerie = which(seriesName == unique(seriesName)[i])
colBalls[thisSerie] = uniqueColors[i]
- #in x axis move a little every series to right in order to compare
- x[thisSerie] = x[thisSerie] + (seqX[i]/5)
+
+ if(! dateAsX) {
+ #in x axis move a little every series to right in order to compare
+ x[thisSerie] = x[thisSerie] + (seqX[i]/5)
+ }
#find min/max Y on power
- if(varY == "Power" && length(unique(x[thisSerie])) >= 3) {
+ if(varY == "Power" && length(unique(x[thisSerie])) >= 3 && ! dateAsX) {
temp.list <- fitCurveCalc(x[thisSerie],y[thisSerie])
y1 <- temp.list[[3]]
if(max(y1) > maxy)
@@ -1823,7 +1833,7 @@ paintCrossVariables <- function (paf, varX, varY, option, isAlone, title, single
thisSerie = which(seriesName == unique(seriesName)[i])
if(length(unique(x[thisSerie])) >= 3) {
- if(varY == "Power") {
+ if(varY == "Power" && ! dateAsX) {
temp.list <- fitCurveCalc(x[thisSerie],y[thisSerie])
x1 <- temp.list[[2]]
y1 <- temp.list[[3]]
@@ -1851,7 +1861,11 @@ paintCrossVariables <- function (paf, varX, varY, option, isAlone, title, single
}
if(isAlone == "ALONE") {
- axis(1)
+ if(dateAsX)
+ axis.Date(1,as.Date(x))
+ else
+ axis(1)
+
axis(2)
mtext(varYut, side=2, line=3)
#box()
@@ -2987,7 +3001,8 @@ doProcess <- function(options)
par(mar=c(5,4,5,5))
analysisVertVars = unlist(strsplit(op$AnalysisVariables[1], "\\,"))
paintCrossVariables(paf, op$AnalysisVariables[2], analysisVertVars[1],
- op$AnalysisVariables[3], "LEFT", "",
+ op$AnalysisVariables[3], FALSE,
+ "LEFT", "",
singleFile,
op$Eccon,
ecconVector,
@@ -2996,7 +3011,8 @@ doProcess <- function(options)
FALSE, FALSE, op$OutputData1)
par(new=T)
paintCrossVariables(paf, op$AnalysisVariables[2], analysisVertVars[2],
- op$AnalysisVariables[3], "RIGHT", op$Title,
+ op$AnalysisVariables[3], FALSE,
+ "RIGHT", op$Title,
singleFile,
op$Eccon,
ecconVector,
@@ -3005,8 +3021,12 @@ doProcess <- function(options)
FALSE, FALSE, op$OutputData1)
} else {
par(mar=c(5,4,5,2))
+ dateAsX <- FALSE
+ if(length(op$AnalysisVariables) == 4 && op$AnalysisVariables[4] == "Date")
+ dateAsX <- TRUE
paintCrossVariables(paf, op$AnalysisVariables[2], op$AnalysisVariables[1],
- op$AnalysisVariables[3], "ALONE", op$Title,
+ op$AnalysisVariables[3], dateAsX,
+ "ALONE", op$Title,
singleFile,
op$Eccon,
ecconVector,
@@ -3023,7 +3043,8 @@ doProcess <- function(options)
ecconVector = createEcconVector(singleFile, op$Eccon, length(curves[,1]), curves[,8])
paintCrossVariables(paf, "Load", "Speed",
- "mean", "ALONE", op$Title,
+ "mean", FALSE,
+ "ALONE", op$Title,
singleFile,
op$Eccon,
ecconVector,
diff --git a/encoder/util.R b/encoder/util.R
index 8b2a3e1..59ac1fe 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -44,6 +44,10 @@ 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".
+ # 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)
#
#in Analysis "powerBars", AnalysisVariables can be:
# "TimeToPeakPower;Range", or eg: "NoTimeToPeakPower;NoRange"
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 1abff8d..0e2864f 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -14979,6 +14979,20 @@ on current Chronojump version.</property>
</packing>
</child>
<child>
+ <widget class="GtkCheckButton"
id="check_encoder_intersession_x_is_date">
+ <property name="label" translatable="yes">Date
on X</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled"
handler="on_check_encoder_intersession_x_is_date_toggled" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkLabel"
id="label_encoder_analyze_side_max">
<property name="can_focus">False</property>
<property name="has_tooltip">True</property>
@@ -14988,7 +15002,7 @@ on current Chronojump version.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
<child>
@@ -15029,7 +15043,7 @@ on current Chronojump version.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -15042,7 +15056,7 @@ on current Chronojump version.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
<child>
@@ -15055,7 +15069,7 @@ on current Chronojump version.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">7</property>
+ <property name="position">8</property>
</packing>
</child>
<child>
@@ -15066,7 +15080,7 @@ on current Chronojump version.</property>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">8</property>
+ <property name="position">9</property>
</packing>
</child>
<child>
@@ -15241,7 +15255,7 @@ on current Chronojump version.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">9</property>
+ <property name="position">10</property>
</packing>
</child>
</widget>
@@ -16328,6 +16342,9 @@ on current Chronojump version.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -20981,6 +20998,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -22115,6 +22135,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -23741,6 +23764,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>
@@ -24424,6 +24450,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -37196,6 +37225,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>
@@ -39695,6 +39742,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>
@@ -40986,9 +41045,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>
@@ -42122,6 +42178,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>
@@ -46142,6 +46201,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>
@@ -46940,6 +47002,9 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -47753,6 +47818,9 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 1953084..85a2509 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -199,6 +199,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_encoder_analyze_side;
[Widget] Gtk.Image image_encoder_analyze_single;
[Widget] Gtk.Image image_encoder_analyze_nmp;
+ [Widget] Gtk.CheckButton check_encoder_intersession_x_is_date;
[Widget] Gtk.Button button_encoder_analyze_help;
@@ -2028,18 +2029,33 @@ public partial class ChronoJumpWindow
encoderAnalyzeCrossTranslation);
if(
- crossName == "Speed / Load" || crossName == "Force / Load" ||
- crossName == "Power / Load" || crossName == "Speed,Power / Load" ||
- crossName == "Force / Speed" || crossName == "Power / Speed")
+ crossName == "Power / Load" || crossName == "Speed / Load" ||
+ crossName == "Force / Load" || crossName == "Speed,Power / Load" ||
+ crossName == "Force / Speed"|| crossName == "Power / Speed" )
{
- //convert: "Force / Speed" in: "cross.Force.Speed.mean"
+ //convert: "Force / Speed" in: "Force;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
analysisVariables += ";max";
+ }
+ else if (crossName == "Power / Date" || crossName == "Speed / Date" || crossName ==
"Force / Date" )
+ {
+ /*
+ * In order to recycle paintCrossVariables in encoder/graph.R,
+ * we send "Force / Date" as "Force;Load;(mean or max);Date" and there
variables will be swapped
+ */
+ //convert: "Force / Date" in: "Force;Load;mean;Date"
+ string [] crossNameFull = crossName.Split(new char[] {' '});
+ analysisVariables = crossNameFull[0] + ";Load";
+ if(check_encoder_analyze_mean_or_max.Active)
+ analysisVariables += ";mean;Date";
+ else
+ analysisVariables += ";max;Date";
}
+
}
string my1RMName = "";
@@ -2093,34 +2109,40 @@ public partial class ChronoJumpWindow
if(encoderAnalysis != "neuromuscularProfile")
{
//if compare persons, select curves for other persons and add
- if(radio_encoder_analyze_groupal_current_session.Active) {
- ArrayList dataPre = new ArrayList();
+ if(radio_encoder_analyze_groupal_current_session.Active)
+ {
+ data = new ArrayList(); //erase data
for (int i=0 ; i < encSelReps.EncoderCompareInter.Count ; i ++) {
- dataPre = SqliteEncoder.Select(
+ ArrayList dataPre = SqliteEncoder.Select(
false, -1,
Util.FetchID(encSelReps.EncoderCompareInter[i].ToString()),
currentSession.UniqueID,
-1,
- "curve", EncoderSQL.Eccons.ALL,
+ "curve", EncoderSQL.Eccons.ALL,
true, true);
- //this curves are added to data, data included currentPerson,
currentSession
foreach(EncoderSQL eSQL in dataPre)
data.Add(eSQL);
}
- } else if(radio_encoder_analyze_individual_all_sessions.Active) {
- ArrayList dataPre = new ArrayList();
+ LogB.Information("ENCODERCOMPAREINTER GROUP");
+ foreach (string str in encSelReps.EncoderCompareInter)
+ LogB.Information(str);
+ } else if(radio_encoder_analyze_individual_all_sessions.Active)
+ {
+ data = new ArrayList(); //erase data
for (int i=0 ; i < encSelReps.EncoderCompareInter.Count ; i ++) {
- dataPre = SqliteEncoder.Select(
+ ArrayList dataPre = SqliteEncoder.Select(
false, -1,
currentPerson.UniqueID,
Util.FetchID(encSelReps.EncoderCompareInter[i].ToString()),
-1,
"curve", EncoderSQL.Eccons.ALL,
- true, true);
- //this curves are added to data, data included currentPerson,
currentSession
+ true, true);
foreach(EncoderSQL eSQL in dataPre)
data.Add(eSQL);
}
+ LogB.Information("ENCODERCOMPAREINTER INTERSESSION");
+ foreach (string str in encSelReps.EncoderCompareInter)
+ LogB.Information(str);
}
}
@@ -2374,6 +2396,7 @@ public partial class ChronoJumpWindow
check_encoder_analyze_eccon_together.Sensitive = true;
block_check_encoder_analyze_eccon_together_if_needed();
+ check_encoder_intersession_x_is_date.Visible = false;
button_encoder_analyze_sensitiveness();
@@ -2410,6 +2433,7 @@ public partial class ChronoJumpWindow
check_encoder_analyze_eccon_together.Sensitive = true;
block_check_encoder_analyze_eccon_together_if_needed();
+ check_encoder_intersession_x_is_date.Visible = false;
button_encoder_analyze_sensitiveness();
@@ -2430,6 +2454,7 @@ public partial class ChronoJumpWindow
//active cross. The only available for comparing
radiobutton_encoder_analyze_cross.Active = true;
+ check_encoder_intersession_x_is_date.Visible = true;
//this analysis only when not comparing
radiobutton_encoder_analyze_powerbars.Visible = false;
@@ -2453,6 +2478,7 @@ public partial class ChronoJumpWindow
//active cross. The only available for comparing
radiobutton_encoder_analyze_cross.Active = true;
+ check_encoder_intersession_x_is_date.Visible = false;
//this analysis only when not comparing
radiobutton_encoder_analyze_powerbars.Visible = false;
@@ -2849,26 +2875,8 @@ public partial class ChronoJumpWindow
combo_encoder_anchorage.Changed +=
new EventHandler(on_combo_encoder_anchorage_changed );
-
- //create combo analyze cross (variables)
- string [] comboAnalyzeCrossOptions = {
- "Power / Load", "Speed / Load", "Force / Load", "Speed,Power / Load", "Force /
Speed", "Power / Speed"
- };
- string [] comboAnalyzeCrossOptionsTranslated = {
- Catalog.GetString("Power / Load"), Catalog.GetString("Speed / Load"),
- Catalog.GetString("Force / Load"), Catalog.GetString("Speed,Power / Load"),
- Catalog.GetString("Force / 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++)
- encoderAnalyzeCrossTranslation[j] =
- comboAnalyzeCrossOptions[j] + ":" + comboAnalyzeCrossOptionsTranslated[j];
- combo_encoder_analyze_cross = ComboBox.NewText ();
- UtilGtk.ComboUpdate(combo_encoder_analyze_cross, comboAnalyzeCrossOptionsTranslated, "");
- combo_encoder_analyze_cross.Active = UtilGtk.ComboMakeActive(combo_encoder_analyze_cross,
- Catalog.GetString(comboAnalyzeCrossOptions[0]));
- combo_encoder_analyze_cross.Changed += new EventHandler
(on_combo_encoder_analyze_cross_changed);
-
+ //create combo analyze cross
+ createComboAnalyzeCross(true, false); //first creation, without "dateInX"
//create combo analyze 1RM
string [] comboAnalyze1RMOptions = { "1RM Any exercise", "1RM Bench Press", "1RM Indirect" };
@@ -2916,11 +2924,6 @@ public partial class ChronoJumpWindow
hbox_combo_encoder_anchorage.ShowAll();
combo_encoder_anchorage.Sensitive = true;
- hbox_combo_encoder_analyze_cross.PackStart(combo_encoder_analyze_cross, true, true, 0);
- hbox_combo_encoder_analyze_cross.ShowAll();
- combo_encoder_analyze_cross.Sensitive = true;
- hbox_combo_encoder_analyze_cross.Visible = false; //do not show hbox at start
-
hbox_combo_encoder_analyze_1RM.PackStart(combo_encoder_analyze_1RM, true, true, 0);
hbox_combo_encoder_analyze_1RM.ShowAll();
combo_encoder_analyze_1RM.Sensitive = true;
@@ -2954,6 +2957,61 @@ public partial class ChronoJumpWindow
combo_encoder_exercise_analyze.Active =
UtilGtk.ComboMakeActive(combo_encoder_exercise_analyze,
Catalog.GetString(((EncoderExercise) encoderExercises[0]).name));
}
+
+ private void createComboAnalyzeCross(bool firstCreation, bool dateOnX)
+ {
+ string [] comboAnalyzeCrossOptions;
+ string [] comboAnalyzeCrossOptionsTranslated;
+
+ if(! dateOnX) {
+ //create combo analyze cross (variables)
+ comboAnalyzeCrossOptions = new string [] {
+ "Power / Load", "Speed / Load", "Force / Load", "Speed,Power / Load", "Force
/ 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 / 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++)
+ encoderAnalyzeCrossTranslation[j] =
+ comboAnalyzeCrossOptions[j] + ":" +
comboAnalyzeCrossOptionsTranslated[j];
+ } else {
+ //create combo analyze cross (variables)
+ comboAnalyzeCrossOptions = new string [] { "Power / Date", "Speed / Date", "Force /
Date" };
+ comboAnalyzeCrossOptionsTranslated = new string [] {
+ Catalog.GetString("Power / Date"),
+ Catalog.GetString("Speed / Date"),
+ Catalog.GetString("Force / Date")
+ }; //if added more, change the int in the 'for' below
+ encoderAnalyzeCrossTranslation = new String [comboAnalyzeCrossOptions.Length];
+ for(int j=0; j < 3 ; j++)
+ encoderAnalyzeCrossTranslation[j] =
+ comboAnalyzeCrossOptions[j] + ":" +
comboAnalyzeCrossOptionsTranslated[j];
+ }
+
+ if(firstCreation)
+ combo_encoder_analyze_cross = ComboBox.NewText ();
+
+ UtilGtk.ComboUpdate(combo_encoder_analyze_cross, comboAnalyzeCrossOptionsTranslated, "");
+ combo_encoder_analyze_cross.Active = UtilGtk.ComboMakeActive(combo_encoder_analyze_cross,
+ Catalog.GetString(comboAnalyzeCrossOptions[0]));
+
+ if(firstCreation) {
+ combo_encoder_analyze_cross.Changed += new EventHandler
(on_combo_encoder_analyze_cross_changed);
+
+ hbox_combo_encoder_analyze_cross.PackStart(combo_encoder_analyze_cross, true, true,
0);
+ hbox_combo_encoder_analyze_cross.ShowAll();
+ combo_encoder_analyze_cross.Sensitive = true;
+ hbox_combo_encoder_analyze_cross.Visible = false; //do not show hbox at start
+ }
+ }
+
+ void on_check_encoder_intersession_x_is_date_toggled (object o, EventArgs args) {
+ createComboAnalyzeCross(false, check_encoder_intersession_x_is_date.Active);
+ }
+
void on_combo_encoder_eccon_changed (object o, EventArgs args)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]