Exemplo n.º 1
0
        public EEGEmotionizer(Sampler sampler)
        {
            Sampler = sampler;

            Dictionary<Electrode, Waveform> eegWaveforms = Sampler.GetEEGWaveforms();

            Analyzers = new Dictionary<Electrode, EEGAnalyzer>();
            foreach (KeyValuePair<Electrode, Waveform> eegWaveform in eegWaveforms)
            {
                Analyzers.Add(eegWaveform.Key, new EEGAnalyzer(eegWaveform.Value));
            }

            CalculateAverageActivity();
            CalculateEmotions();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Load CSV data in background task
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void worker_DoWork(object sender, DoWorkEventArgs e)
        {
            CSVWorkerArgs args = (CSVWorkerArgs)e.Argument;
            CSVWorkerResult result = new CSVWorkerResult();
            result.Success = false;

            try
            {
                CsvParser parser = new CsvParser(args.CsvFilePath);
                List<List<string>> csvData = parser.Parse();

                int sampleRate = Convert.ToInt32(parser.GetMetaDataDictionary().GetValue("Sample Rate"));

                Sampler sampler = new Sampler(csvData, sampleRate);
                result.Emotionizer = new EEGEmotionizer(sampler);
                result.Success = true;
            }
            catch (System.IO.IOException ex)
            {
                result.ErrorMessage = ex.Message;
                result.Success = false;
            }

            e.Result = result;
        }