Commit ae3ab7fc authored by Xavier de Blas's avatar Xavier de Blas

Encoder GROUPAL_CURRENT_SESSION shows name on analyze table

parent 0bb46139
......@@ -3830,7 +3830,6 @@ doProcess <- function(options)
mySeriesNames = chunks #mySeriesNames will be: "2018-09-06" (so different series will have the same series number and analyzed together)
}
pafCurves = cbind(
mySeriesNames, #seriesName
curves[,4], #exerciseName
......@@ -3911,10 +3910,14 @@ doProcess <- function(options)
pafCurvesWrite = pafCurves
if(! singleFile)
{
myTimestamps = curves[,7]
if( length(pafCurvesWrite[,1]) > length(curves[,7]) )
pafCurvesWrite[,1] = c( curves[,7], rep(NA, length(pafCurvesWrite[,1]) - length(curves[,7])) )
myTimestamps = c( myTimestamps, rep(NA, length(pafCurvesWrite[,1]) - length(curves[,7])) )
if(op$AnalysisMode == "GROUPAL_CURRENT_SESSION")
pafCurvesWrite[,1] = paste(pafCurves[,1], myTimestamps) #pafCurves[,1] is the name, needed on 4th analysis mode
else
pafCurvesWrite[,1] = curves[,7]
pafCurvesWrite[,1] = myTimestamps
}
write.csv(pafCurvesWrite, op$OutputData1, quote=FALSE)
#print("curves written")
......
......@@ -98,7 +98,8 @@ assignOptions <- function(options) {
#Unassigned here:
# englishWords [29]
# translatedWords [30]
SeparateSessionInDays = options[35]
SeparateSessionInDays = options[35],
AnalysisMode = options[36]
))
}
......
......@@ -162,7 +162,10 @@ public class EncoderGraphROptions
private bool cutByTriggers;
private string triggerList;
public bool separateSessionInDays;
public AnalysisModes analysisMode; //the four analysisModes
public enum AnalysisModes { CAPTURE, INDIVIDUAL_CURRENT_SET, INDIVIDUAL_CURRENT_SESSION, INDIVIDUAL_ALL_SESSIONS, GROUPAL_CURRENT_SESSION }
public EncoderGraphROptions(
string inputData, string outputGraph, string outputData1,
string encoderRPath, string encoderTempPath,
......@@ -170,7 +173,7 @@ public class EncoderGraphROptions
string title, string operatingSystem,
string englishWords, string translatedWords,
bool debug, bool crossValidate, bool cutByTriggers, string triggerList,
bool separateSessionInDays)
bool separateSessionInDays, AnalysisModes analysisMode)
{
this.inputData = inputData;
this.outputGraph = outputGraph;
......@@ -187,6 +190,7 @@ public class EncoderGraphROptions
this.cutByTriggers = cutByTriggers;
this.triggerList = triggerList;
this.separateSessionInDays = separateSessionInDays;
this.analysisMode = analysisMode;
//ensure triggerList is not null or blank
if(triggerList == null || triggerList == "")
......@@ -209,7 +213,8 @@ public class EncoderGraphROptions
"#crossValidate\n" + Util.BoolToRBool(crossValidate) + "\n" +
"#cutByTriggers\n" + Util.BoolToRBool(cutByTriggers) + "\n" +
"#triggerList\n" + triggerList + "\n" +
"#separateSessionInDays\n" + Util.BoolToRBool(separateSessionInDays) + "\n";
"#separateSessionInDays\n" + Util.BoolToRBool(separateSessionInDays) + "\n" +
"#analysisMode\n" + analysisMode.ToString() + "\n";
}
......
......@@ -259,8 +259,8 @@ public class EncoderRProcCapture : EncoderRProc
false, //crossValidate (unactive on capture at the moment)
(CutByTriggers != Preferences.TriggerTypes.NO_TRIGGERS),
printTriggers(),
false //separateSessionInDays (false at capture)
).ToString();
false, //separateSessionInDays (false at capture)
EncoderGraphROptions.AnalysisModes.CAPTURE).ToString();
TextWriter writer = File.CreateText(optionsFile);
writer.Write(scriptOptions);
......@@ -288,6 +288,7 @@ public class EncoderRProcAnalyze : EncoderRProc
private bool translate;
private bool cutByTriggers;
private TriggerList triggerList;
private EncoderGraphROptions.AnalysisModes analysisMode;
/*
* to avoid problems on some windows. R exports csv to Util.GetEncoderExportTempFileName()
......@@ -301,13 +302,14 @@ public class EncoderRProcAnalyze : EncoderRProc
}
public void SendData(string title, bool neuromuscularProfileDo, bool translate,
bool cutByTriggers, TriggerList triggerList)
bool cutByTriggers, TriggerList triggerList, EncoderGraphROptions.AnalysisModes analysisMode)
{
this.title = title;
this.neuromuscularProfileDo = neuromuscularProfileDo;
this.translate = translate;
this.cutByTriggers = cutByTriggers;
this.triggerList = triggerList;
this.analysisMode = analysisMode;
CancelRScript = false;
}
......@@ -517,7 +519,8 @@ public class EncoderRProcAnalyze : EncoderRProc
CrossValidate,
cutByTriggers,
printTriggers(),
SeparateSessionInDays
SeparateSessionInDays,
analysisMode
).ToString();
TextWriter writer = File.CreateText(optionsFile);
......
......@@ -1437,7 +1437,8 @@ public partial class ChronoJumpWindow
false, //do not use neuromuscularProfile script
preferences.RGraphsTranslate,
(preferences.encoderCaptureCutByTriggers != Preferences.TriggerTypes.NO_TRIGGERS),
triggerList
triggerList,
getAnalysisMode()
);
bool result = encoderRProcAnalyze.StartOrContinue(es);
......@@ -1958,13 +1959,30 @@ public partial class ChronoJumpWindow
false, //do not use neuromuscularProfile script
preferences.RGraphsTranslate,
(preferences.encoderCaptureCutByTriggers != Preferences.TriggerTypes.NO_TRIGGERS),
new TriggerList()
new TriggerList(),
getAnalysisMode()
);
encoderRProcAnalyze.StartOrContinue(encoderStruct);
//encoder_pulsebar_capture.Text = string.Format(Catalog.GetString(
// "Exported to {0}."), UtilEncoder.GetEncoderExportTempFileName());
}
private EncoderGraphROptions.AnalysisModes getAnalysisMode()
{
EncoderGraphROptions.AnalysisModes am = EncoderGraphROptions.AnalysisModes.INDIVIDUAL_CURRENT_SET; //default
if(radio_encoder_analyze_individual_current_set.Active)
am = EncoderGraphROptions.AnalysisModes.INDIVIDUAL_CURRENT_SET;
else if(radio_encoder_analyze_individual_current_session.Active)
am = EncoderGraphROptions.AnalysisModes.INDIVIDUAL_CURRENT_SESSION;
else if(radio_encoder_analyze_individual_all_sessions.Active)
am = EncoderGraphROptions.AnalysisModes.INDIVIDUAL_ALL_SESSIONS;
else if(radio_encoder_analyze_groupal_current_session.Active)
am = EncoderGraphROptions.AnalysisModes.GROUPAL_CURRENT_SESSION;
return am;
}
void on_button_encoder_save_AB_file_selected (string selectedFileName)
{
......@@ -3168,7 +3186,8 @@ public partial class ChronoJumpWindow
encoderSelectedAnalysis == "neuromuscularProfile",
preferences.RGraphsTranslate,
(preferences.encoderCaptureCutByTriggers != Preferences.TriggerTypes.NO_TRIGGERS),
triggerList
triggerList,
getAnalysisMode()
);
encoderRProcAnalyze.StartOrContinue(encoderStruct);
......
......@@ -350,7 +350,7 @@ public class UtilEncoder
public static EncoderGraphROptions PrepareEncoderGraphOptions(
string title, EncoderStruct es, bool neuromuscularProfileDo, bool translate, bool debug, bool crossValidate,
bool cutByTriggers, string triggerStr, bool separateSessionInDays)
bool cutByTriggers, string triggerStr, bool separateSessionInDays, EncoderGraphROptions.AnalysisModes analysisMode)
{
string operatingSystem = OperatingSystemForRGraphs();
......@@ -405,7 +405,7 @@ public class UtilEncoder
title, operatingSystem,
Util.StringArrayToString(Constants.EncoderEnglishWords,";"),
Util.StringArrayToString(encoderTranslatedWordsOK,";"),
debug, crossValidate, cutByTriggers, triggerStr, separateSessionInDays
debug, crossValidate, cutByTriggers, triggerStr, separateSessionInDays, analysisMode
);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment