[chronojump] Encoder: export signal to csv primary code
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder: export signal to csv primary code
- Date: Fri, 11 Jan 2013 20:58:09 +0000 (UTC)
commit 9b51310aeb7e0ec7408fee243c530a73193aea83
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Jan 11 21:57:38 2013 +0100
Encoder: export signal to csv primary code
encoder/graph.R | 10 +++++++---
glade/chronojump.glade | 25 +++++++++++++++++++++++--
src/gui/encoder.cs | 31 +++++++++++++++++++++++++++++++
src/util.cs | 4 ++--
4 files changed, 63 insertions(+), 7 deletions(-)
---
diff --git a/encoder/graph.R b/encoder/graph.R
index ece7e54..fcc1151 100644
--- a/encoder/graph.R
+++ b/encoder/graph.R
@@ -960,9 +960,13 @@ print("----------------------------")
# dev.off()
}
if(analysis=="exportCSV") {
- export=cumsum(rawdata)
- file="export.csv" #TODO change this, for not deleting last record
- #TODO....
+ print("Starting export...")
+ file=outputData1;
+ col1=rawdata
+ col2=rawdata.cumsum
+ df=data.frame(cbind(col1,col2))
+ write.csv2(df, file=file, row.names=F)
+ print("Export done.")
}
dev.off()
}
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 74d1a8f..34270d3 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -12258,7 +12258,6 @@ on current Chronojump version.</property>
<property name="spacing">2</property>
<child>
<widget class="GtkEntry" id="entry_encoder_signal_comment">
- <property name="width_request">125</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">â</property>
@@ -12353,6 +12352,29 @@ on current Chronojump version.</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkButton" id="button_encoder_export_signal">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Export session to _CSV (Spreadsheet)</property>
+ <property name="use_action_appearance">False</property>
+ <signal name="clicked" handler="on_button_encoder_export_signal_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkImage" id="image29">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-convert</property>
+ </widget>
+ </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">True</property>
@@ -12368,7 +12390,6 @@ on current Chronojump version.</property>
<property name="spacing">4</property>
<child>
<widget class="GtkProgressBar" id="encoder_pulsebar_capture">
- <property name="width_request">150</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="activity_mode">True</property>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 1df980f..331b67b 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -469,6 +469,37 @@ public partial class ChronoJumpWindow
on_button_encoder_recalculate_clicked (o, args);
}
+ void on_button_encoder_export_signal_clicked (object o, EventArgs args)
+ {
+ string analysisOptions = "-";
+ if(checkbutton_encoder_propulsive.Active)
+ analysisOptions = "p";
+
+ EncoderParams ep = new EncoderParams(
+ (int) spin_encoder_capture_min_height.Value,
+ Convert.ToInt32(
+ Util.FindOnArray(':', 2, 3, UtilGtk.ComboGetActive(combo_encoder_exercise),
+ encoderExercisesTranslationAndBodyPWeight) ),
+ findMass(true),
+ findEccon(false), //do not force ecS (ecc-conc separated)
+ "exportCSV",
+ analysisOptions,
+ Util.ConvertToPoint((double) spin_encoder_smooth.Value), //R decimal: '.'
+ Convert.ToInt32(UtilGtk.ComboGetActive(combo_encoder_analyze_curve_num_combo)),
+ image_encoder_width,
+ image_encoder_height);
+
+ string dataFileName = Util.GetEncoderDataTempFileName();
+
+ EncoderStruct encoderStruct = new EncoderStruct(
+ dataFileName,
+ Util.GetEncoderGraphTempFileName(),
+ "/tmp/export.csv", "NULL", ep);
+
+ Util.RunPythonEncoder(Constants.EncoderScriptGraphCall, "", encoderStruct, false);
+
+ }
+
void on_button_encoder_delete_signal_clicked (object o, EventArgs args)
{
ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString(
diff --git a/src/util.cs b/src/util.cs
index 85d5a40..03f32a5 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1065,7 +1065,7 @@ public class Util
//curves does first graph and then csv curves.
//Wait until this to update encoder gui (if don't wait then treeview will be outdated)
- if(es.Ep.Analysis == "curves")
+ if(es.Ep.Analysis == "curves" || es.Ep.Analysis == "exportCSV")
outputFileCheck = es.OutputData1;
else
outputFileCheck = es.OutputGraph;
@@ -1078,7 +1078,7 @@ public class Util
Console.WriteLine(outputFileCheck);
if (File.Exists(outputFileCheck))
File.Delete(outputFileCheck);
-
+
p = new Process();
p.StartInfo = pinfo;
p.Start();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]