public void WriteTrial(TrialData data) { if (!File.Exists(filePath)) { using (StreamWriter sw = File.CreateText(filePath)) { sw.WriteLine(data.GetHeader()); sw.WriteLine(data.ToString()); } } else { using (StreamWriter sw = File.AppendText(filePath)) { sw.WriteLine(data.ToString()); } } didWrite = true; }
/// <summary> /// Called when user makes a judgement and selects a response. Updates the AEPsych model with a new data point. /// </summary> public void ReportResultToServer(int outcome, TrialMetadata metadata = null) { if (recordToCSV) { TrialData trial = new TrialData(DateTime.Now.ToString("hh:mm:ss"), config, outcome, metadata); csvFile.WriteTrial(trial); } AEPsychClient.Log(string.Format("ReportResult: {0}", outcome)); SetState(ExperimentState.WaitingForTellResponse); if (metadata != null) { StartCoroutine(client.Tell(config, outcome, metadata)); } else { StartCoroutine(client.Tell(config, outcome)); } if (useModelExploration) { queryModel.QueryEnabled(false); } }