/// <summary> /// Saves a human subject to a data file /// </summary> /// <param name="s"></param> public static void SaveHumanSubject(HumanSubject s) { //Construct a file name for the patient data file string file_name = s.UserName + ".txt"; //Construct a path for the save location string path_name = HumanAcceleratedLearningConfiguration.GetInstance().PrimarySavePath; //Create the directory if it doesn't exist DirectoryInfo info = new DirectoryInfo(path_name); if (!info.Exists) { info.Create(); } //Open the file for writing string full_path_and_file = path_name + file_name; StreamWriter writer = new StreamWriter(full_path_and_file); writer.WriteLine(s.UserName); writer.WriteLine(MathHelperMethods.ConvertDateTimeToMatlabDatenum(s.StartDate).ToString()); //Write out the names of each segment in the order that they were performed in the participant's first visit foreach (var seg in s.FirstVisitStage.StageSegments) { writer.WriteLine(seg.SegmentName); } //Close the file writer.Close(); }
/// <summary> /// Writes a study trial to the file /// </summary> public static void WriteStudyTrial(StreamWriter fid, string foreign_language_word, string native_word, DateTime time_presented) { double matlab_time = MathHelperMethods.ConvertDateTimeToMatlabDatenum(time_presented); fid.WriteLine(foreign_language_word.ToString() + ", " + native_word.ToString() + ", " + matlab_time.ToString()); fid.Flush(); }
/// <summary> /// Writes a study trial for the object location to the file /// </summary> public static void WriteObjectLocationStudyTrial(StreamWriter fid, string image_name, double xpos, double ypos, DateTime time_presented) { double matlab_time = MathHelperMethods.ConvertDateTimeToMatlabDatenum(time_presented); fid.WriteLine("OBJECT, " + image_name + ", " + xpos.ToString("0.##") + ", " + ypos.ToString("0.##") + ", " + matlab_time.ToString()); fid.Flush(); }
public static void WriteTestBlockTrial(StreamWriter fid, TestBlockTrial t) { double matlab_time_presented = MathHelperMethods.ConvertDateTimeToMatlabDatenum(t.PresentationTime); fid.WriteLine(t.ForeignWord + ", " + t.NativeInput + ", " + t.Correct.ToString() + ", " + matlab_time_presented.ToString() + ", " + t.InputLatency.ToString()); fid.Flush(); }
public static void WriteTestBlockTrial(StreamWriter fid, TestBlockTrial_ObjectLocation t) { string pos_x = t.PositionX.ToString(); string pos_y = t.PositionY.ToString(); string cpos_x = t.CorrectPositionX.ToString(); string cpos_y = t.CorrectPositionY.ToString(); string dist = t.DistanceFromCorrectPosition.ToString("0.##"); string correct_bool = t.Correct.ToString(); string latency = t.InputLatency.ToString("0.##"); double matlab_time_presented = MathHelperMethods.ConvertDateTimeToMatlabDatenum(t.PresentationTime); fid.WriteLine(t.ImageName + ", " + pos_x + ", " + pos_y + ", " + cpos_x + ", " + cpos_y + ", " + dist + ", " + correct_bool + ", " + latency + ", " + matlab_time_presented.ToString()); fid.Flush(); }