void CreateNewPPList(string filePath)
        {
            // create example table
            DataTable exampleData = new DataTable();

            // create headers
            foreach (var header in startup.participantDataPoints.Select(x => x.internalName))
            {
                exampleData.Columns.Add(new DataColumn(header, typeof(string)));
            }

            // create example row
            DataRow row1 = exampleData.NewRow();

            foreach (var dataPoint in startup.participantDataPoints)
            {
                row1[dataPoint.internalName] = dataPoint.controller.GetDefault();
            }
            row1["ppid"] = "test";

            exampleData.Rows.Add(row1);

            // save, this is single threaded in this case
            fileIOManager.WriteCSV(exampleData, filePath);

            // re-read it back in
            CheckSetList(filePath);
        }
        /// <summary>
        /// Finalises the session logger, saving the data and detaching its logging method from handling Debug.Log messages
        /// </summary>
        public void Finalise()
        {
            string filepath = Path.Combine(session.path, "log.csv");

            fileIOManager.ManageInWorker(() => fileIOManager.WriteCSV(table, filepath));
            Application.logMessageReceived -= HandleLog;
        }
예제 #3
0
        /// <summary>
        /// Finalises the session logger, saving the data and detaching its logging method from handling Debug.Log messages
        /// </summary>
        public void Finalise()
        {
            WriteFileInfo fileInfo = new WriteFileInfo(
                WriteFileType.Log,
                session.BasePath,
                session.experimentName,
                session.ppid,
                session.FolderName,
                "log.csv"
                );

            fileIOManager.ManageInWorker(() => fileIOManager.WriteCSV(table, fileInfo));
            Application.logMessageReceived -= HandleLog;
            session.cleanUp -= Finalise;
        }
예제 #4
0
        /// <summary>
        /// Save tracking data for this trial
        /// </summary>
        /// <param name="tracker">The tracker to take data from to save</param>
        /// <returns>Path to the saved file</returns>
        public string SaveTrackerData(Tracker tracker)
        {
            string fname = string.Format("{0}_{1}_T{2:000}.csv", tracker.objectName, tracker.measurementDescriptor, currentTrialNum);
            string fpath = Path.Combine(path, fname);

            List <string[]> dataCopy = tracker.GetDataCopy();

            fileIOManager.ManageInWorker(() => fileIOManager.WriteCSV(tracker.header, dataCopy, fpath));

            // return relative path so it can be stored in behavioural data
            Uri fullPath = new Uri(fpath);
            Uri basePath = new Uri(experimentPath);

            return(basePath.MakeRelativeUri(fullPath).ToString());
        }
예제 #5
0
        /// <summary>
        /// Save tracking data for this trial
        /// </summary>
        /// <param name="tracker">The tracker to take data from to save</param>
        /// <returns>Name of the saved file</returns>
        public string SaveTrackerData(Tracker tracker)
        {
            string fname = string.Format("{0}_{1}_T{2:000}.csv", tracker.objectName, tracker.measurementDescriptor, currentTrialNum);

            WriteFileInfo fileInfo = new WriteFileInfo(
                WriteFileType.Tracker,
                this.basePath,
                experimentName,
                ppid,
                folderName,
                fname
                );

            List <string[]> dataCopy = tracker.GetDataCopy();

            fileIOManager.ManageInWorker(() => fileIOManager.WriteCSV(tracker.header, dataCopy, fileInfo));

            // return name of the file so it can be stored in behavioural data
            return(fileInfo.FileName);
        }