[chronojump] forceSensor: Added testLength option to RFD graph
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] forceSensor: Added testLength option to RFD graph
- Date: Mon, 4 Dec 2017 18:29:28 +0000 (UTC)
commit 3c55efd604f828dd25235284b348caf56be77488
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Dec 4 19:28:49 2017 +0100
forceSensor: Added testLength option to RFD graph
glade/app1.glade | 96 +++++++++++++++++++++++++++++++++++++
r-scripts/maximumIsometricForce.R | 6 ++-
src/forceSensor.cs | 7 ++-
src/gui/forceSensor.cs | 17 ++++++-
4 files changed, 121 insertions(+), 5 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 10f1990..f1e0025 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1509,6 +1509,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>
@@ -15254,6 +15257,96 @@ Concentric</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="hbox240">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">10</property>
+ <child>
+ <widget class="GtkLabel" id="label201">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Length
of analysis:</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton"
id="radio_force_rfd_duration_percent">
+ <property name="label" translatable="yes">5%
after max force</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_radio_force_rfd_duration_toggled" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox241">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkRadioButton"
id="radio_force_duration_seconds">
+ <property name="label" translatable="yes">This
seconds:</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">radio_force_rfd_duration_percent</property>
+ <signal name="toggled"
handler="on_radio_force_rfd_duration_toggled" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkSpinButton"
id="spin_force_duration_seconds">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ <property
name="primary_icon_activatable">False</property>
+ <property
name="secondary_icon_activatable">False</property>
+ <property
name="primary_icon_sensitive">True</property>
+ <property
name="secondary_icon_sensitive">True</property>
+ <property name="adjustment">2 1 20 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="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -22226,6 +22319,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/r-scripts/maximumIsometricForce.R b/r-scripts/maximumIsometricForce.R
index a711849..c01b498 100644
--- a/r-scripts/maximumIsometricForce.R
+++ b/r-scripts/maximumIsometricForce.R
@@ -62,7 +62,8 @@ assignOptions <- function(options)
hline50fmax.raw = options[10],
hline50fmax.fitted = options[11],
drawRfdOptions = drawRfdOptions,
- drawImpulseOptions = options[16]
+ drawImpulseOptions = options[16],
+ testLength = as.numeric(options[17])
))
}
@@ -109,7 +110,8 @@ getDynamicsFromLoadCellFile <- function(inputFile, averageLength = 0.1, percentC
rfd = getRFD(originalTest)
#Finding the decrease of the foce to detect the end of the maximum voluntary force
- trimmingSamples = getTrimmingSamples(originalTest, rfd, averageLength = averageLength, percentChange
= percentChange)
+ trimmingSamples = getTrimmingSamples(originalTest, rfd, averageLength = averageLength, percentChange
= percentChange,
+ testLength = op$testLength)
startSample = trimmingSamples$startSample
startTime = originalTest$time[startSample]
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index 9888a50..889c2fc 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -376,11 +376,13 @@ public class ForceSensorGraph
bool vline50fmax_fitted;
bool hline50fmax_raw;
bool hline50fmax_fitted;
+ int testLength;
- public ForceSensorGraph(List<ForceSensorRFD> rfdList, ForceSensorImpulse impulse)
+ public ForceSensorGraph(List<ForceSensorRFD> rfdList, ForceSensorImpulse impulse, int testLength)
{
this.rfdList = rfdList;
this.impulse = impulse;
+ this.testLength = testLength;
averageLength = 0.1;
percentChange = 5;
@@ -458,6 +460,9 @@ public class ForceSensorGraph
else
scriptOptions += "\n-1";
+ scriptOptions +=
+ "\n#testLength\n" + testLength.ToString() + "\n";
+
TextWriter writer = File.CreateText(Path.GetTempPath() + "Roptions.txt");
writer.Write(scriptOptions);
writer.Flush();
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index d728d00..a659b62 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -83,7 +83,10 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_force_sensor_graph;
[Widget] Gtk.Viewport viewport_force_sensor_graph;
[Widget] Gtk.Button button_force_sensor_image_save_rfd;
-
+
+ [Widget] Gtk.SpinButton spin_force_duration_seconds;
+ [Widget] Gtk.RadioButton radio_force_duration_seconds;
+
Thread forceCaptureThread;
static bool forceProcessFinish;
static bool forceProcessCancel;
@@ -962,7 +965,12 @@ LogB.Information(" fc R ");
Util.FileDelete(imagePath);
image_force_sensor_graph.Sensitive = false;
- ForceSensorGraph fsg = new ForceSensorGraph(rfdList, impulse);
+ int duration = -1;
+ if(radio_force_duration_seconds.Active)
+ duration = Convert.ToInt32(spin_force_duration_seconds.Value);
+
+ ForceSensorGraph fsg = new ForceSensorGraph(rfdList, impulse, duration);
+
int imageWidth = UtilGtk.WidgetWidth(viewport_force_sensor_graph);
int imageHeight = UtilGtk.WidgetHeight(viewport_force_sensor_graph);
if(imageWidth < 300)
@@ -1140,6 +1148,11 @@ LogB.Information(" fc R ");
fscPoints.GetTimeInPx(0) - textWidth -4, yPx - textHeight/2,
layout_force_text);
}
+ private void on_radio_force_rfd_duration_toggled (object o, EventArgs args)
+ {
+ spin_force_duration_seconds.Sensitive = radio_force_duration_seconds.Active;
+ }
+
private void on_button_force_sensor_image_save_signal_clicked (object o, EventArgs args)
{
checkFile(Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]