[chronojump] encoder analyze instantaneous can check/uncheck position
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] encoder analyze instantaneous can check/uncheck position
- Date: Wed, 4 Apr 2018 16:02:33 +0000 (UTC)
commit 5a4394fdf453d9ca39c198f65751d7c887e81d9d
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Apr 4 18:02:02 2018 +0200
encoder analyze instantaneous can check/uncheck position
encoder/graph.R | 128 ++++++++++++++++++++++++++------------------
encoder/util.R | 2 +-
glade/app1.glade | 35 ++++++++++--
src/gui/chronojumpIcons.cs | 1 +
src/gui/encoder.cs | 10 +++-
5 files changed, 114 insertions(+), 62 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index cd7ae02..6297467 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -499,7 +499,7 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, pai
encoderConfigurationName,diameter,diameterExt,anglePush,angleWeight,inertiaMomentum,gearedDown,
#encoderConfiguration stuff
title, subtitle, draw, width, showLabels, marShrink, showAxes, legend,
Analysis, isPropulsive, inertialType, exercisePercentBodyWeight,
- showSpeed, showAccel, showForce, showPower,
+ showPosition, showSpeed, showAccel, showForce, showPower,
triggersOnList #will be empty if cutByTriggers
) {
@@ -584,36 +584,36 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, pai
if(showAxes) {
axis(1) #can be added xmin
- axis(2)
+ if(showPosition)
+ axis(2)
}
- par(new=T)
-# if(superpose)
-# colNormal="gray30"
- yValues = position[startX:length(position)]-min(position[startX:length(position)])
-# if(highlight==FALSE) {
- plot(startX:length(position),yValues,type="l",xlim=xlim,ylim=ylim,
- xlab="",ylab="",col=colPosition,lty=ltyPosition,lwd=2,axes=F)
-
- if(paintMode == "superpose")
- addRepCharsAboveLine(yValues, colPosition, nrep)
- else {
+ if(showPosition)
+ {
par(new=T)
- plot(startX:length(position),yValues,type="h",xlim=xlim,ylim=ylim,
- xlab="",ylab="",col="grey90",lty=lty[1],lwd=1,axes=F)
- }
-# }
-# else
-#
plot(startX:length(position),yValues,type="l",xlim=xlim,ylim=ylim,xlab="",ylab="",col=colNormal,lty=2,lwd=3,axes=F)
+ # if(superpose)
+ # colNormal="gray30"
+ yValues = position[startX:length(position)]-min(position[startX:length(position)])
+ # if(highlight==FALSE) {
+ plot(startX:length(position),yValues,type="l",xlim=xlim,ylim=ylim,
+ xlab="",ylab="",col=colPosition,lty=ltyPosition,lwd=2,axes=F)
- # show horizontal bars on all graphs except on superpose (on this mode only on first graph)
- if(paintMode != "superpose" || nrep == 1)
- {
- abline(h=0,lty=3,col="black")
+ if(paintMode == "superpose")
+ addRepCharsAboveLine(yValues, colPosition, nrep)
+ else {
+ par(new=T)
+ plot(startX:length(position),yValues,type="h",xlim=xlim,ylim=ylim,
+ xlab="",ylab="",col="grey90",lty=lty[1],lwd=1,axes=F)
+ }
+ # }
+ # else
+ #
plot(startX:length(position),yValues,type="l",xlim=xlim,ylim=ylim,xlab="",ylab="",col=colNormal,lty=2,lwd=3,axes=F)
- #always (single or side) show 0 line
- if(showSpeed || showAccel || showForce || showPower)
+ # show horizontal bars on all graphs except on superpose (on this mode only on first
graph)
+ if(paintMode != "superpose" || nrep == 1)
+ {
abline(h=0,lty=3,col="black")
+ }
}
@@ -1160,19 +1160,21 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, pai
#legend, axes and title
if(draw) {
#show 0 line
- if(nrep == 1 && (showSpeed || showAccel || showForce || showPower))
+ if( (paintMode != "superpose" || nrep == 1) &&
+ (showSpeed || showAccel || showForce || showPower) )
{
abline(h=0,lty=3,col="black")
}
#if(legend & showAxes) {}
if(legend) {
- paintVariablesLegend(showSpeed, showAccel, showForce, showPower,
+ paintVariablesLegend(showPosition, showSpeed, showAccel, showForce, showPower,
(triggersOnList != "" && triggersOnList != -1))
}
if(showLabels) {
mtext(paste(translateToPrint("time"),"(ms)"),side=1,adj=1,line=-1,cex=.9)
- mtext(paste(translateToPrint("displacement"),"(mm)"),side=2,adj=1,line=-1,cex=.9)
+ if(showPosition)
+
mtext(paste(translateToPrint("displacement"),"(mm)"),side=2,adj=1,line=-1,cex=.9)
}
#on sideShareX draw a box to see better graphs (to undertand better white space)
@@ -1181,7 +1183,7 @@ paint <- function(displacement, eccon, xmin, xmax, xrange, yrange, knRanges, pai
}
}
-paintVariablesLegend <- function(showSpeed, showAccel, showForce, showPower, showTriggers)
+paintVariablesLegend <- function(showPosition, showSpeed, showAccel, showForce, showPower, showTriggers)
{
colPosition = "black"
colSpeed = cols[1]
@@ -1195,11 +1197,19 @@ paintVariablesLegend <- function(showSpeed, showAccel, showForce, showPower, sho
ltyForce = 1
ltyPower = 1
- legendText=c(paste(translateToPrint("Distance"),"(mm)"))
- lty=c(ltyPosition)
- lwd=c(2)
- colors=c(colPosition)
- ncol=1
+ legendText=NULL
+ lty=NULL
+ lwd=NULL
+ colors=NULL
+ ncol=0
+
+ if(showPosition) {
+ legendText=c(legendText, paste(translateToPrint("Distance"),"(mm)"))
+ lty=c(lty,ltyPosition)
+ lwd=c(lwd,2)
+ colors=c(colors,colPosition)
+ ncol=ncol+1
+ }
if(showSpeed) {
legendText=c(legendText, paste(translateToPrint("Speed"),"(m/s)"))
@@ -1236,8 +1246,10 @@ paintVariablesLegend <- function(showSpeed, showAccel, showForce, showPower, sho
colors=c(colors,"yellow3")
ncol=ncol+1
}
-
-
+
+ if(ncol == 0)
+ return()
+
#plot legend on top exactly out
#http://stackoverflow.com/a/7322792
rng=par("usr")
@@ -3033,10 +3045,11 @@ doProcess <- function(options)
if(op$Analysis=="single")
{
- showSpeed <- (op$AnalysisVariables[1] == "Speed")
- showAccel <- (op$AnalysisVariables[2] == "Accel")
- showForce <- (op$AnalysisVariables[3] == "Force")
- showPower <- (op$AnalysisVariables[4] == "Power")
+ showPosition <- (op$AnalysisVariables[1] == "Position")
+ showSpeed <- (op$AnalysisVariables[2] == "Speed")
+ showAccel <- (op$AnalysisVariables[3] == "Accel")
+ showForce <- (op$AnalysisVariables[4] == "Force")
+ showPower <- (op$AnalysisVariables[5] == "Power")
df = NULL
if(op$Jump>0) {
@@ -3081,7 +3094,7 @@ doProcess <- function(options)
TRUE, #showAxes
TRUE, #legend
op$Analysis, isPropulsive, inertialType, repOp$exPercentBodyWeight,
- showSpeed, showAccel, showForce, showPower,
+ showPosition, showSpeed, showAccel, showForce, showPower,
triggersOnList
)
@@ -3205,9 +3218,16 @@ doProcess <- function(options)
par(mar=c(3, 3.5, 5, marginRight))
- plot(position, #mm
- type="l", xlab="", ylab="",axes=T, lty=1,col="black")
- title(main="All set (experimental!)",line=-2,outer=T)
+ if(showPosition)
+ {
+ plot(position, #mm
+ type="l", xlab="", ylab="",axes=T, lty=1,col="black")
+ } else {
+ plot(position, #mm
+ type="n", xlab="", ylab="",axes=F, lty=1,col="black")
+ axis(1)
+ }
+ title(main="All set (experimental!)",line=-2,outer=T)
mtext(paste(translateToPrint("time"),"(ms)"),side=1,adj=1,line=-1)
#mtext(paste(translateToPrint("displacement"),"(mm)"),side=2,adj=1,line=-1)
@@ -3270,7 +3290,7 @@ doProcess <- function(options)
if(showSpeed || showAccel || showForce || showPower)
abline(h=0,lty=3,col="black")
- paintVariablesLegend(showSpeed && ! isInertial(op$EncoderConfigurationName),
showAccel, showForce, showPower,
+ paintVariablesLegend(showPosition, showSpeed && !
isInertial(op$EncoderConfigurationName), showAccel, showForce, showPower,
(op$TriggersOnList != "" && op$TriggersOnList != -1))
}
@@ -3334,10 +3354,11 @@ doProcess <- function(options)
FALSE, #showAxes
FALSE, #legend
op$Analysis, isPropulsive, inertialType, repOp$exPercentBodyWeight,
- (op$AnalysisVariables[1] == "Speed"), #show speed
- (op$AnalysisVariables[2] == "Accel"), #show accel
- (op$AnalysisVariables[3] == "Force"), #show force
- (op$AnalysisVariables[4] == "Power"), #show power
+ (op$AnalysisVariables[1] == "Position"), #show position
+ (op$AnalysisVariables[2] == "Speed"), #show speed
+ (op$AnalysisVariables[3] == "Accel"), #show accel
+ (op$AnalysisVariables[4] == "Force"), #show force
+ (op$AnalysisVariables[5] == "Power"), #show power
triggersOnList
)
}
@@ -3424,10 +3445,11 @@ doProcess <- function(options)
FALSE, #showAxes
(i==1), #legend
op$Analysis, isPropulsive, inertialType, repOp$exPercentBodyWeight,
- (op$AnalysisVariables[1] == "Speed"), #show speed
- (op$AnalysisVariables[2] == "Accel"), #show accel
- (op$AnalysisVariables[3] == "Force"), #show force
- (op$AnalysisVariables[4] == "Power"), #show power
+ (op$AnalysisVariables[1] == "Position"), #show position
+ (op$AnalysisVariables[2] == "Speed"), #show speed
+ (op$AnalysisVariables[3] == "Accel"), #show accel
+ (op$AnalysisVariables[4] == "Force"), #show force
+ (op$AnalysisVariables[5] == "Power"), #show power
triggersOnList
)
diff --git a/encoder/util.R b/encoder/util.R
index 389cb98..a44a559 100644
--- a/encoder/util.R
+++ b/encoder/util.R
@@ -56,7 +56,7 @@ assignOptions <- function(options) {
# "TimeToPeakPower;Range", or eg: "NoTimeToPeakPower;NoRange"
#
#in Analysis "single" or "side", AnalysisVariables can be:
- # "Speed;Accel;Force;Power", or eg: "NoSpeed;NoAccel;Force;Power"
+ # "Position;Speed;Accel;Force;Power", or eg: "NoPosition;NoSpeed;NoAccel;Force;Power"
#
#in Analysis = "1RMAnyExercise"
#AnalysisVariables = "0.185;method". speed1RM = 0.185m/s
diff --git a/glade/app1.glade b/glade/app1.glade
index 27e2628..d8dc9ba 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1664,6 +1664,9 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkLabel"
id="label_start_selector_jumps">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -22265,7 +22268,7 @@ then click this button.</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label"
translatable="yes">Mode</property>
+ <property name="label"
translatable="yes">Mode:</property>
</widget>
<packing>
<property name="expand">True</property>
@@ -22277,7 +22280,7 @@ then click this button.</property>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="x_options"/>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
@@ -22878,6 +22881,23 @@ then click this button.</property>
</packing>
</child>
<child>
+ <widget class="GtkCheckButton"
id="check_encoder_analyze_show_position">
+ <property name="label"
translatable="yes">Position</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Show
position</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">False</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkCheckButton"
id="check_encoder_analyze_show_speed">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -22898,7 +22918,7 @@ then click this button.</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
@@ -22921,7 +22941,7 @@ then click this button.</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child>
@@ -22944,7 +22964,7 @@ then click this button.</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child>
@@ -22968,7 +22988,7 @@ then click this button.</property>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
</widget>
@@ -24998,6 +25018,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 47d5ed3..246353b 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -485,6 +485,7 @@ public partial class ChronoJumpWindow
UtilGtk.ColorsRadio(viewport_chronopics, radiobutton_encoder_analyze_single);
UtilGtk.ColorsRadio(viewport_chronopics, radiobutton_encoder_analyze_neuromuscular_profile);
+ UtilGtk.ColorsCheckbox(viewport_chronopics, check_encoder_analyze_show_position);
UtilGtk.ColorsCheckbox(viewport_chronopics, check_encoder_analyze_show_speed);
UtilGtk.ColorsCheckbox(viewport_chronopics, check_encoder_analyze_show_accel);
UtilGtk.ColorsCheckbox(viewport_chronopics, check_encoder_analyze_show_force);
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index d028e81..e4730e2 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -160,6 +160,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.CheckButton check_encoder_analyze_show_range;
[Widget] Gtk.Box hbox_encoder_analyze_show_SAFE;
+ [Widget] Gtk.CheckButton check_encoder_analyze_show_position;
[Widget] Gtk.CheckButton check_encoder_analyze_show_speed;
[Widget] Gtk.CheckButton check_encoder_analyze_show_accel;
[Widget] Gtk.CheckButton check_encoder_analyze_show_force;
@@ -3186,10 +3187,15 @@ public partial class ChronoJumpWindow
analysisVariables += ";NoRange";
}
else { //analysis == "single" || analysis == "side" || analysis == "sideShareX" ||
sendAnalysis == "superpose"
+ if(check_encoder_analyze_show_position.Active)
+ analysisVariables = "Position";
+ else
+ analysisVariables = "NoPosition";
+
if(check_encoder_analyze_show_speed.Active)
- analysisVariables = "Speed";
+ analysisVariables += ";Speed";
else
- analysisVariables = "NoSpeed";
+ analysisVariables += ";NoSpeed";
if(check_encoder_analyze_show_accel.Active)
analysisVariables += ";Accel";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]