[chronojump] Encoder: done graphs load-power, force-speed. ...
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder: done graphs load-power, force-speed. ...
- Date: Mon, 4 Jun 2012 19:09:36 +0000 (UTC)
commit cf910f53af164217f941878bf1cac49d3505c7b4
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Jun 4 21:06:13 2012 +0200
Encoder: done graphs load-power, force-speed. ...
encoder/graph.R | 108 ++++++++++-
glade/chronojump.glade | 459 ++++++++++++++++++++++++++++-----------------
src/encoder.cs | 15 +-
src/gui/encoder.cs | 121 ++++++++++---
src/gui/genericWindow.cs | 15 ++-
5 files changed, 501 insertions(+), 217 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index 8ba0074..3f5daf2 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -137,7 +137,8 @@ kinematicsF <- function(a, mass, smoothingOne, g) {
force <- mass*(accel$y+g) #g:9.81 (used when movement is against gravity)
power <- force*speed$y
- return(list(speedy=speed$y, accely=accel$y, force=force, power=power))
+
+ return(list(speedy=speed$y, accely=accel$y, force=force, power=power, mass=mass))
}
powerBars <- function(kinematics) {
@@ -147,7 +148,13 @@ powerBars <- function(kinematics) {
peakPower <- max(kinematics$power)
peakPowerT <- min(which(kinematics$power == peakPower))
pp_ppt <- peakPower / (peakPowerT/1000) # ms->s
- return(data.frame(meanSpeed, maxSpeed, meanPower,peakPower,peakPowerT,pp_ppt))
+ meanForce <- mean(abs(kinematics$force))
+ maxForce <- max(abs(kinematics$force))
+
+ #here paf is generated
+ #mass is not used by powerBars, but used by Kg/W (loadVSPower)
+ #meanForce and maxForce are not used by powerBars, but used by F/S (forceVSSpeed)
+ return(data.frame(meanSpeed, maxSpeed, meanPower,peakPower,peakPowerT,pp_ppt, kinematics$mass,meanForce,maxForce))
}
kinematicRanges <- function(singleFile,rawdata,curves,mass,smoothingOne,g) {
@@ -400,9 +407,80 @@ paintPowerPeakPowerBars <- function(paf, myEccons) {
plot(bp[2,],paf[,5],type="o",lwd=2,xlim=c(1,n*3+.5),axes=F,xlab="",ylab="",col=pafColors[3])
legend("bottom",col=pafColors, lty=c(0,0,1), lwd=c(1,1,2), pch=c(15,15,NA), legend=c("Power","Peak Power", "Time at Peak Power"), ncol=3, inset=-.2)
axis(4)
- mtext("time at peak power (s)", side=4, line=-1)
+ mtext("Time at peak power (s)", side=4, line=-1)
+}
+
+paintLoadVSPower <- function (paf, option) {
+ power=(paf[,3])
+ peakPower=(paf[,4])
+ x=(paf[,7]) #mass
+
+ if(option == "mean") {
+ y=power
+ ylab="Power (W)"
+ }
+ else {
+ y=peakPower
+ ylab="Peak Power (W)"
+ }
+
+ #problem with balls is that two values two close looks bad
+ #suboption="balls"
+ suboption="side"
+ if(suboption == "balls") {
+ cexBalls = 3
+ cexNums = 1
+ adjHor = 0.5
+ nums=as.character(1:length(x))
+ } else if (suboption == "side") {
+ cexBalls = 1.5
+ cexNums = .7
+ adjHor = 0
+ nums=paste(" ",as.character(1:length(x)))
+ }
+
+ plot(x,y, xlab="Displaced mass (Kg)", ylab=ylab,pch=21,bg="gold",cex=cexBalls)
+ text(x,y,nums,adj=c(adjHor,0.5),cex=cexNums)
+ lines(smooth.spline(x,y),col="red")
}
+paintForceVSSpeed <- function (paf,option) {
+ meanSpeed=(paf[,1])
+ maxSpeed=(paf[,2])
+ meanForce=(paf[,8])
+ maxForce=(paf[,9])
+
+ if(option == "mean") {
+ x=meanSpeed
+ y=meanForce
+ xlab="Mean speed (m/s)"
+ ylab="Mean force (N)"
+ } else {
+ x=maxSpeed
+ y=maxForce
+ xlab="Max speed (m/s)"
+ ylab="Max force (N)"
+ }
+
+ #problem with balls is that two values two close looks bad
+ #suboption="balls"
+ suboption="side"
+ if(suboption == "balls") {
+ cexBalls = 3
+ cexNums = 1
+ adjHor = 0.5
+ nums=as.character(1:length(x))
+ } else if (suboption == "side") {
+ cexBalls = 1.5
+ cexNums = .7
+ adjHor = 0
+ nums=paste(" ",as.character(1:length(x)))
+ }
+
+ plot(x,y, xlab=xlab, ylab=ylab,pch=21,bg="gold",cex=cexBalls)
+ text(x,y,nums,adj=c(adjHor,0.5),cex=cexNums)
+ lines(smooth.spline(x,y,spar=.5),col="red")
+}
find.mfrow <- function(n) {
if(n<=3) return(c(1,n))
else if(n<=6) return(c(2,ceiling(n/2)))
@@ -673,10 +751,15 @@ if(length(args) < 3) {
par(new=T)
}
par(new=F)
- print(knRanges)
+ #print(knRanges)
}
- if(analysis=="powerBars" || analysis=="curves") {
+ if(
+ analysis == "powerBars" ||
+ analysis == "loadVSPowerMean" || analysis == "loadVSPowerPeak" ||
+ analysis == "forceVSSpeedMean" || analysis == "forceVSSpeedMax" ||
+ analysis == "curves")
+ {
paf = data.frame()
for(i in 1:n) {
myMass = mass
@@ -689,10 +772,19 @@ if(length(args) < 3) {
}
paf=rbind(paf,(powerBars(kinematicsF(rawdata[curves[i,1]:curves[i,2]], myMass, mySmoothingOne, g))))
}
- if(analysis=="powerBars") {
+ #print(paf)
+
+ if(analysis == "powerBars")
paintPowerPeakPowerBars(paf, curves[,8]) #myEccon
- }
- if(analysis=="curves") {
+ else if(analysis == "loadVSPowerMean")
+ paintLoadVSPower(paf,"mean")
+ else if(analysis == "loadVSPowerPeak")
+ paintLoadVSPower(paf,"peak")
+ else if(analysis == "forceVSSpeedMean")
+ paintForceVSSpeed(paf,"mean")
+ else if(analysis == "forceVSSpeedMax")
+ paintForceVSSpeed(paf,"max")
+ else if(analysis == "curves") {
paf=cbind(curves[,1],curves[,2]-curves[,1],rawdata.cumsum[curves[,2]]-curves[,3],paf)
colnames(paf)=c("start","width","height","meanSpeed","maxSpeed",
"meanPower","peakPower","peakPowerT","pp_ppt")
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index c079e54..37d9fd9 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -24788,44 +24788,46 @@ Evaluator can use real name or nickname.</property>
<child>
<widget class="GtkHBox" id="hbox63">
<property name="visible">True</property>
- <property name="spacing">20</property>
- <child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_data_current_signal">
- <property name="label" translatable="yes">Current signal</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_radiobutton_encoder_analyze_data_current_signal_toggled"/>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
<child>
<widget class="GtkHBox" id="hbox73">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="spacing">12</property>
<child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_data_user_curves">
- <property name="label" translatable="yes">User curves</property>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_data_current_signal">
+ <property name="label" translatable="yes">Current signal</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">radiobutton_encoder_analyze_data_current_signal</property>
- <signal name="toggled" handler="on_radiobutton_encoder_analyze_data_user_curves_toggled"/>
+ <signal name="toggled" handler="on_radiobutton_encoder_analyze_data_current_signal_toggled"/>
</widget>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox_encoder_user_curves_num">
+ <widget class="GtkHBox" id="hbox89">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_data_user_curves">
+ <property name="label" translatable="yes">User curves</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton_encoder_analyze_data_current_signal</property>
+ <signal name="toggled" handler="on_radiobutton_encoder_analyze_data_user_curves_toggled"/>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox_encoder_user_curves_num">
<property name="visible">True</property>
<property name="sensitive">False</property>
<child>
@@ -24855,152 +24857,29 @@ Evaluator can use real name or nickname.</property>
<property name="position">2</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="button_encoder_analyze_data_show_user_curves">
- <property name="label" translatable="yes">Show</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked" handler="on_button_encoder_analyze_data_show_user_curves_clicked"/>
- </widget>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- <child>
- <widget class="GtkLabel" id="label72">
- <property name="visible">True</property>
- <property name="label" translatable="yes"><b>Data</b></property>
- <property name="use_markup">True</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkFrame" id="frame14">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.69999998807907104</property>
- <property name="shadow_type">out</property>
- <child>
- <widget class="GtkAlignment" id="alignment17">
- <property name="visible">True</property>
- <property name="top_padding">4</property>
- <property name="bottom_padding">4</property>
- <property name="left_padding">10</property>
- <property name="right_padding">10</property>
- <child>
- <widget class="GtkHBox" id="hbox87">
- <property name="visible">True</property>
- <property name="spacing">12</property>
- <child>
- <widget class="GtkHBox" id="hbox88">
- <property name="visible">True</property>
- <property name="spacing">12</property>
- <child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_powerbars">
- <property name="label" translatable="yes">Power bars</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_radiobutton_encoder_analyze_powerbars_toggled"/>
- </widget>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_side">
- <property name="label" translatable="yes">Side compare</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton_encoder_analyze_powerbars</property>
- <signal name="toggled" handler="on_radiobutton_encoder_analyze_side_toggled"/>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox74">
- <property name="visible">True</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_single">
- <property name="label" translatable="yes">Single curve</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton_encoder_analyze_powerbars</property>
- <signal name="toggled" handler="on_radiobutton_encoder_analyze_single_toggled"/>
</widget>
<packing>
- <property name="position">0</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkSpinButton" id="spin_encoder_analyze_curve_num">
+ <widget class="GtkButton" id="button_encoder_analyze_data_show_user_curves">
+ <property name="label" translatable="yes">Show</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
- <property name="invisible_char">â</property>
- <property name="adjustment">1 1 40 1 10 0</property>
- <property name="climb_rate">1</property>
- <property name="snap_to_ticks">True</property>
- <property name="numeric">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_button_encoder_analyze_data_show_user_curves_clicked"/>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_superpose">
- <property name="label" translatable="yes">Superpose</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton_encoder_analyze_powerbars</property>
- <signal name="toggled" handler="on_radiobutton_encoder_analyze_superpose_toggled"/>
- </widget>
- <packing>
- <property name="position">3</property>
+ <property name="position">1</property>
</packing>
</child>
</widget>
@@ -25011,15 +24890,14 @@ Evaluator can use real name or nickname.</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox79">
+ <widget class="GtkHBox" id="hbox_encoder_analyze_eccon">
<property name="visible">True</property>
- <property name="spacing">10</property>
+ <property name="spacing">6</property>
<child>
<widget class="GtkLabel" id="label_encoder_analyze_eccon">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Ecc-conc phases</property>
+ <property name="label" translatable="yes">Eccentric-concentric</property>
</widget>
<packing>
<property name="expand">False</property>
@@ -25029,9 +24907,9 @@ Evaluator can use real name or nickname.</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox_encoder_analyze_eccon">
+ <widget class="GtkHBox" id="hbox_encoder_analyze_eccon_dins">
<property name="visible">True</property>
- <property name="spacing">8</property>
+ <property name="spacing">4</property>
<child>
<widget class="GtkRadioButton" id="radiobutton_encoder_eccon_together">
<property name="label" translatable="yes">Together</property>
@@ -25082,6 +24960,112 @@ Evaluator can use real name or nickname.</property>
</widget>
</child>
<child>
+ <widget class="GtkLabel" id="label72">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Data</b></property>
+ <property name="use_markup">True</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkFrame" id="frame14">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.69999998807907104</property>
+ <property name="shadow_type">out</property>
+ <child>
+ <widget class="GtkAlignment" id="alignment17">
+ <property name="visible">True</property>
+ <property name="top_padding">4</property>
+ <property name="bottom_padding">4</property>
+ <property name="left_padding">10</property>
+ <property name="right_padding">10</property>
+ <child>
+ <widget class="GtkHBox" id="hbox88">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_powerbars">
+ <property name="label" translatable="yes">Power bars</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_radiobutton_encoder_analyze_powerbars_toggled"/>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_load_vs_power">
+ <property name="label" translatable="yes">Load / Power</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton_encoder_analyze_powerbars</property>
+ <signal name="toggled" handler="on_radiobutton_encoder_analyze_load_vs_power_toggled"/>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_force_vs_speed">
+ <property name="label" translatable="yes">Force / Speed</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton_encoder_analyze_powerbars</property>
+ <signal name="toggled" handler="on_radiobutton_encoder_analyze_force_vs_speed_toggled"/>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_side">
+ <property name="label" translatable="yes">Side compare</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton_encoder_analyze_powerbars</property>
+ <signal name="toggled" handler="on_radiobutton_encoder_analyze_side_toggled"/>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_single">
+ <property name="label" translatable="yes">Single curve</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton_encoder_analyze_powerbars</property>
+ <signal name="toggled" handler="on_radiobutton_encoder_analyze_single_toggled"/>
+ </widget>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ <child>
<widget class="GtkLabel" id="label87">
<property name="visible">True</property>
<property name="label" translatable="yes"><b>Mode</b></property>
@@ -25108,18 +25092,113 @@ Evaluator can use real name or nickname.</property>
<child>
<widget class="GtkHBox" id="hbox75">
<property name="visible">True</property>
- <property name="homogeneous">True</property>
+ <property name="spacing">12</property>
<child>
- <widget class="GtkButton" id="button_encoder_analyze">
- <property name="label" translatable="yes">Analyze</property>
- <property name="width_request">150</property>
+ <widget class="GtkHBox" id="hbox92">
<property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_underline">True</property>
- <signal name="clicked" handler="on_button_encoder_analyze_clicked"/>
+ <child>
+ <widget class="GtkHBox" id="hbox_encoder_analyze_curve_num">
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label83">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Curve num.</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton" id="spin_encoder_analyze_curve_num">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">â</property>
+ <property name="adjustment">1 1 40 1 10 0</property>
+ <property name="climb_rate">1</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox_encoder_analyze_load_vs_power">
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_load_vs_power_mean">
+ <property name="label" translatable="yes">Mean power</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_load_vs_power_peak">
+ <property name="label" translatable="yes">Peak power</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton_encoder_analyze_load_vs_power_mean</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox_encoder_analyze_force_vs_speed">
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_force_vs_speed_mean">
+ <property name="label" translatable="yes">Mean values</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="radiobutton_encoder_analyze_force_vs_speed_max">
+ <property name="label" translatable="yes">Max values</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">radiobutton_encoder_analyze_force_vs_speed_mean</property>
+ </widget>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -25129,16 +25208,48 @@ Evaluator can use real name or nickname.</property>
</packing>
</child>
<child>
- <widget class="GtkProgressBar" id="encoder_pulsebar_analyze">
- <property name="width_request">150</property>
+ <widget class="GtkHBox" id="hbox74">
<property name="visible">True</property>
- <property name="activity_mode">True</property>
- <property name="show_text">True</property>
- <property name="pulse_step">0.10000000149</property>
+ <property name="spacing">20</property>
+ <property name="homogeneous">True</property>
+ <child>
+ <widget class="GtkButton" id="button_encoder_analyze">
+ <property name="label" translatable="yes">Analyze</property>
+ <property name="width_request">150</property>
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="on_button_encoder_analyze_clicked"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="padding">12</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkProgressBar" id="encoder_pulsebar_analyze">
+ <property name="width_request">150</property>
+ <property name="visible">True</property>
+ <property name="activity_mode">True</property>
+ <property name="show_text">True</property>
+ <property name="pulse_step">0.10000000149</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
diff --git a/src/encoder.cs b/src/encoder.cs
index fdbcb9a..06985ab 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -244,14 +244,15 @@ public class EncoderSQL
return date;
}
- public string [] ToStringArray () {
- string [] str = new String [6];
+ public string [] ToStringArray (int count) {
+ string [] str = new String [7];
str[0] = uniqueID;
- str[1] = exerciseName;
- str[2] = ecconLong;
- str[3] = extraWeight;
- str[4] = GetDate(true);
- str[5] = description;
+ str[1] = count.ToString();
+ str[2] = exerciseName;
+ str[3] = ecconLong;
+ str[4] = extraWeight;
+ str[5] = GetDate(true);
+ str[6] = description;
return str;
}
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index fb36e52..f1bd4d7 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -67,12 +67,21 @@ public partial class ChronoJumpWindow
[Widget] Gtk.RadioButton radiobutton_encoder_analyze_powerbars;
[Widget] Gtk.RadioButton radiobutton_encoder_analyze_single;
[Widget] Gtk.RadioButton radiobutton_encoder_analyze_side;
- [Widget] Gtk.RadioButton radiobutton_encoder_analyze_superpose;
- [Widget] Gtk.Label label_encoder_analyze_eccon;
+ //[Widget] Gtk.RadioButton radiobutton_encoder_analyze_superpose;
[Widget] Gtk.Box hbox_encoder_analyze_eccon;
[Widget] Gtk.RadioButton radiobutton_encoder_eccon_both;
[Widget] Gtk.RadioButton radiobutton_encoder_eccon_together;
+ [Widget] Gtk.Box hbox_encoder_analyze_curve_num;
[Widget] Gtk.SpinButton spin_encoder_analyze_curve_num;
+
+ [Widget] Gtk.Box hbox_encoder_analyze_load_vs_power;
+ [Widget] Gtk.RadioButton radiobutton_encoder_analyze_load_vs_power_mean;
+ [Widget] Gtk.RadioButton radiobutton_encoder_analyze_load_vs_power_peak;
+
+ [Widget] Gtk.Box hbox_encoder_analyze_force_vs_speed;
+ [Widget] Gtk.RadioButton radiobutton_encoder_analyze_force_vs_speed_mean;
+ [Widget] Gtk.RadioButton radiobutton_encoder_analyze_force_vs_speed_max;
+
[Widget] Gtk.Viewport viewport_image_encoder_analyze;
[Widget] Gtk.Image image_encoder_analyze;
[Widget] Gtk.ProgressBar encoder_pulsebar_analyze;
@@ -85,7 +94,7 @@ public partial class ChronoJumpWindow
int image_encoder_width;
int image_encoder_height;
- private string encoderAnalysis="powerBars";
+ private static string encoderAnalysis="powerBars";
private string ecconLast;
private string encoderTimeStamp;
private string encoderSignalUniqueID;
@@ -96,8 +105,9 @@ public partial class ChronoJumpWindow
//TODO: auto close capturing window
- //TODO: Put person name in graph (at title,with small separation, or inside graph at topright) (if we click on another person on treeview person, we need to know wich person was last generated graph)
+ //TODO: Put person name in graph (at title,with small separation, or inside graph at topright) (if we click on another person on treeview person, we need to know wich person was last generated graph). Put also exercise name and weight
//TODO: laterality have to be shown on treeviews: signal and curve. also check that is correct in database
+ //TODO: the load (Kg) in graphs has to account the exercice body percent and the extra
//TODO: put chronopic detection in a generic place. Done But:
//TODO: solve the problem of connecting two different chronopics
@@ -122,7 +132,7 @@ public partial class ChronoJumpWindow
//the glade cursor_changed does not work on mono 1.2.5 windows
treeview_encoder_curves.CursorChanged += on_treeview_encoder_curves_cursor_changed;
createEncoderCombos();
- spin_encoder_analyze_curve_num.SetRange(1,1);
+ spin_encoder_analyze_curve_num.SetRange(0,0);
}
//TODO: garantir path windows
@@ -262,12 +272,13 @@ public partial class ChronoJumpWindow
ArrayList data = SqliteEncoder.Select(false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve");
ArrayList dataPrint = new ArrayList();
- foreach(EncoderSQL es in data) {
- dataPrint.Add(es.ToStringArray());
- }
+ int count = 1;
+ foreach(EncoderSQL es in data)
+ dataPrint.Add(es.ToStringArray(count++));
string [] columnsString = {
Catalog.GetString("ID"),
+ Catalog.GetString("Curve"),
Catalog.GetString("Exercise"),
Catalog.GetString("Contraction"),
Catalog.GetString("Extra weight"),
@@ -282,6 +293,11 @@ public partial class ChronoJumpWindow
genericWin.SetTreeview(columnsString, dataPrint);
genericWin.ShowButtonCancel(false);
genericWin.SetButtonAcceptSensitive(true);
+
+ //used when we don't need to read data,
+ //and we want to ensure next window will be created at needed size
+ genericWin.DestroyOnAccept=true;
+
genericWin.SetButtonAcceptLabel(Catalog.GetString("Close"));
}
@@ -290,12 +306,13 @@ public partial class ChronoJumpWindow
ArrayList data = SqliteEncoder.Select(false, -1, currentPerson.UniqueID, currentSession.UniqueID, "signal");
ArrayList dataPrint = new ArrayList();
- foreach(EncoderSQL es in data) {
- dataPrint.Add(es.ToStringArray());
- }
+ int count = 1;
+ foreach(EncoderSQL es in data)
+ dataPrint.Add(es.ToStringArray(count++));
string [] columnsString = {
Catalog.GetString("ID"),
+ Catalog.GetString("Signal"),
Catalog.GetString("Exercise"),
Catalog.GetString("Contraction"),
Catalog.GetString("Extra weight"),
@@ -316,7 +333,10 @@ public partial class ChronoJumpWindow
protected void on_encoder_load_signal_accepted (object o, EventArgs args)
{
genericWin.Button_accept.Clicked -= new EventHandler(on_encoder_load_signal_accepted);
+
int uniqueID = genericWin.TreeviewSelectedRowID();
+
+ genericWin.HideAndNull();
ArrayList data = SqliteEncoder.Select(false, uniqueID,
currentPerson.UniqueID, currentSession.UniqueID, "signal");
@@ -381,6 +401,7 @@ public partial class ChronoJumpWindow
ArrayList data = SqliteEncoder.Select(false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve");
label_encoder_user_curves_num.Text = data.Count.ToString();
+ spin_encoder_analyze_curve_num.SetRange(1, data.Count);
}
string encoderSaveSignalOrCurve (string mode, int selectedID)
@@ -490,7 +511,7 @@ public partial class ChronoJumpWindow
//TODO: in the future plot a "no curves" message,
//or beter done allow to analyze if there's no curves
}
-
+
encoderThreadStart(encoderModes.ANALYZE);
}
@@ -500,13 +521,31 @@ public partial class ChronoJumpWindow
{
EncoderParams ep = new EncoderParams();
string dataFileName = "";
+
+ //use this send because we change it to send it to R
+ //but we don't want to change encoderAnalysis because we want to know again if == "loadVSPower"
+ string sendAnalysis = encoderAnalysis;
+
+ if(sendAnalysis == "loadVSPower") {
+ if(radiobutton_encoder_analyze_load_vs_power_mean.Active)
+ sendAnalysis = "loadVSPowerMean";
+ else
+ sendAnalysis = "loadVSPowerPeak";
+ }
+ if(sendAnalysis == "forceVSSpeed") {
+ if(radiobutton_encoder_analyze_force_vs_speed_mean.Active)
+ sendAnalysis = "forceVSSpeedMean";
+ else
+ sendAnalysis = "forceVSSpeedMax";
+ }
+
if(radiobutton_encoder_analyze_data_user_curves.Active) {
string myEccon = "ec";
if(! radiobutton_encoder_eccon_together.Active)
myEccon = "ecS";
int myCurveNum = -1;
- if(encoderAnalysis == "single")
+ if(sendAnalysis == "single")
myCurveNum = (int) spin_encoder_analyze_curve_num.Value;
//-1 because data will be different on any curve
@@ -517,7 +556,7 @@ public partial class ChronoJumpWindow
encoderExercisesTranslationAndBodyPWeight) ),
"-1", //mass
myEccon, //this decides if analysis will be together or separated
- encoderAnalysis,
+ sendAnalysis,
"-1",
myCurveNum,
image_encoder_width,
@@ -554,7 +593,7 @@ public partial class ChronoJumpWindow
encoderExercisesTranslationAndBodyPWeight) ),
findMass(true),
findEccon(false), //do not force ecS (ecc-conc separated)
- encoderAnalysis,
+ sendAnalysis,
Util.ConvertToPoint((double) spin_encoder_smooth.Value), //R decimal: '.'
(int) spin_encoder_analyze_curve_num.Value,
image_encoder_width,
@@ -589,39 +628,71 @@ public partial class ChronoJumpWindow
spin_encoder_analyze_curve_num.SetRange(1, Convert.ToInt32(label_encoder_user_curves_num.Text));
}
+
//show curve_num only on simple and superpose
private void on_radiobutton_encoder_analyze_single_toggled (object obj, EventArgs args) {
- spin_encoder_analyze_curve_num.Sensitive=true;
+ hbox_encoder_analyze_curve_num.Visible=true;
+ hbox_encoder_analyze_load_vs_power.Visible=false;
+ hbox_encoder_analyze_force_vs_speed.Visible=false;
encoderAnalysis="single";
//together, mandatory
- label_encoder_analyze_eccon.Sensitive=false;
hbox_encoder_analyze_eccon.Sensitive=false;
radiobutton_encoder_eccon_together.Active = true;
}
+ /*
private void on_radiobutton_encoder_analyze_superpose_toggled (object obj, EventArgs args) {
- spin_encoder_analyze_curve_num.Sensitive=true;
+ hbox_encoder_analyze_curve_num.Visible=true;
+ hbox_encoder_analyze_load_vs_power.Visible=false;
+ hbox_encoder_analyze_force_vs_speed.Visible=false;
encoderAnalysis="superpose";
+
//together, mandatory
- label_encoder_analyze_eccon.Sensitive=false;
hbox_encoder_analyze_eccon.Sensitive=false;
radiobutton_encoder_eccon_together.Active = true;
}
+ */
private void on_radiobutton_encoder_analyze_side_toggled (object obj, EventArgs args) {
- spin_encoder_analyze_curve_num.Sensitive=false;
+ hbox_encoder_analyze_curve_num.Visible=false;
+ hbox_encoder_analyze_load_vs_power.Visible=false;
+ hbox_encoder_analyze_force_vs_speed.Visible=false;
encoderAnalysis="side";
+
//together, mandatory
- label_encoder_analyze_eccon.Sensitive=false;
hbox_encoder_analyze_eccon.Sensitive=false;
radiobutton_encoder_eccon_together.Active = true;
}
private void on_radiobutton_encoder_analyze_powerbars_toggled (object obj, EventArgs args) {
- spin_encoder_analyze_curve_num.Sensitive=false;
+ hbox_encoder_analyze_curve_num.Visible=false;
+ hbox_encoder_analyze_load_vs_power.Visible=false;
+ hbox_encoder_analyze_force_vs_speed.Visible=false;
encoderAnalysis="powerBars";
-
- label_encoder_analyze_eccon.Sensitive=true;
+
hbox_encoder_analyze_eccon.Sensitive=true;
}
+
+ private void on_radiobutton_encoder_analyze_load_vs_power_toggled (object obj, EventArgs args) {
+ hbox_encoder_analyze_curve_num.Visible=false;
+ hbox_encoder_analyze_load_vs_power.Visible=true;
+ hbox_encoder_analyze_force_vs_speed.Visible=false;
+
+ //analyze button will check the mean, peak radios
+ encoderAnalysis="loadVSPower";
+
+ hbox_encoder_analyze_eccon.Sensitive=false;
+ }
+
+ private void on_radiobutton_encoder_analyze_force_vs_speed_toggled (object obj, EventArgs args) {
+ hbox_encoder_analyze_curve_num.Visible=false;
+ hbox_encoder_analyze_load_vs_power.Visible=false;
+ hbox_encoder_analyze_force_vs_speed.Visible=true;
+
+ //analyze button will check the mean, max radios
+ encoderAnalysis="forceVSSpeed";
+
+ hbox_encoder_analyze_eccon.Sensitive=false;
+ }
+
private string findMass(bool includePerson) {
double mass = spin_encoder_extra_weight.Value;
@@ -724,10 +795,8 @@ public partial class ChronoJumpWindow
/*
if(Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_eccon),
encoderEcconTranslation) == "Concentric") {
- label_encoder_analyze_eccon.Sensitive=false;
hbox_encoder_analyze_eccon.Sensitive=false;
} else if(radiobutton_encoder_analyze_powerbars.Active) {
- label_encoder_analyze_eccon.Sensitive=true;
hbox_encoder_analyze_eccon.Sensitive=true;
}
*/
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index 6ce5393..a2eaacf 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -61,8 +61,15 @@ public class GenericWindow
static GenericWindow GenericWindowBox;
private TreeStore store;
+
+ //used to read data, see if it's ok, and print an error message.
+ //if all is ok, destroy it with HideAndNull()
public bool HideOnAccept;
+ //used when we don't need to read data,
+ //and we want to ensure next window will be created at needed size
+ public bool DestroyOnAccept;
+
public GenericWindow ()
{
Glade.XML gladeXML;
@@ -88,6 +95,7 @@ public class GenericWindow
GenericWindowBox.label_header.Text = textHeader;
GenericWindowBox.generic_window.Show ();
GenericWindowBox.HideOnAccept = true;
+ GenericWindowBox.DestroyOnAccept = false;
return GenericWindowBox;
}
@@ -105,6 +113,7 @@ public class GenericWindow
GenericWindowBox.label_header.Text = textHeader;
GenericWindowBox.generic_window.Show ();
GenericWindowBox.HideOnAccept = true;
+ GenericWindowBox.DestroyOnAccept = false;
return GenericWindowBox;
}
@@ -205,7 +214,7 @@ public class GenericWindow
{
//adjust window to be bigger
generic_window.Resizable = true;
- scrolled_window_treeview.WidthRequest = 500;
+ scrolled_window_treeview.WidthRequest = 550;
scrolled_window_treeview.HeightRequest = 250;
store = getStore(columnsString.Length);
@@ -297,10 +306,12 @@ public class GenericWindow
{
if(HideOnAccept)
GenericWindowBox.generic_window.Hide();
- //GenericWindowBox = null;
+ if(DestroyOnAccept)
+ GenericWindowBox = null;
}
//when ! HideOnAccept, use this to close window
+ //also is better to call it always tat is closed clicking on accept (after data has been readed)
public void HideAndNull() {
GenericWindowBox.generic_window.Hide();
GenericWindowBox = null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]