コード例 #1
0
ファイル: Program.cs プロジェクト: node9909/unity-biosignals
        private static void RunEEGCSV(string filepath)
        {
            EEGReader    reader    = new EEGFileReader(filepath);
            EEGProcessor processor = new EEGProcessor(reader, true);

            processor.Start();

            while (!processor.Finished)
            {
                processor.Update();
            }

            List <TrainingValue> results = processor.TrainingValues;


            StringBuilder csv = new StringBuilder();

            foreach (TrainingValue t in results)
            {
                csv.AppendLine(String.Format("{0},{1},{2}", (t.Features[0] + t.Features[1]) / 2, (t.Features[2] + t.Features[3]) / 2, t.State));
            }

            string filename = filepath.Split('.')[0] + ".csv";

            //string filename2 = filename + "-2.csv";

            //filename += "-1.csv";


            File.WriteAllText(filename, String.Empty);
            File.WriteAllText(filename, csv.ToString());
            //File.WriteAllText(filename2, String.Empty);
            //File.WriteAllText(filename2, csv2.ToString());
        }
コード例 #2
0
        internal static List <TrainingValue> getTrainingValues(string filepath)
        {
            EEGReader reader;

            reader = new EEGFileReader(filepath);
            EEGProcessor processor = new EEGProcessor(reader, true);

            processor.Training = true;

            processor.Start();
            while (!processor.Finished)
            {
                processor.Update();
            }

            return(processor.TrainingValues);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: node9909/unity-biosignals
        private static void RunEEG(string filepath = null)
        {
            EEGReader reader;

            if (filepath != null)
            {
                reader = new EEGFileReader(filepath);
            }
            else
            {
                reader = new EEGOSCReader(5005);
            }

            EEGProcessor processor = new EEGProcessor(reader);

            processor.Start();
            while (true)
            {
                processor.Update();
            }
        }