Exemple #1
0
 public BoardShim(int board_id, string port_name)
 {
     this.board_id          = board_id;
     this.port_name         = port_name;
     this.package_length    = BoardInfoGetter.get_package_length(board_id);
     this.fs_hz             = BoardInfoGetter.get_fs_hz(board_id);
     this.num_eeg_channels  = BoardInfoGetter.get_num_eeg_channels(board_id);
     this.first_eeg_channel = BoardInfoGetter.get_first_eeg_channel(board_id);
 }
Exemple #2
0
 public DataHandler(int board_id, double[,] data_from_board = null, string csv_file = null)
 {
     fs_hz             = BoardInfoGetter.get_fs_hz(board_id);
     first_eeg_channel = BoardInfoGetter.get_first_eeg_channel(board_id);
     last_eeg_channel  = first_eeg_channel + BoardInfoGetter.get_num_eeg_channels(board_id) - 1;
     if (data_from_board != null)
     {
         data = data_from_board.Copy();
     }
     else
     {
         if (csv_file != null)
         {
             List <List <double> > temp_board_data = new List <List <double> > ();
             StreamReader          sr = new StreamReader(csv_file);
             string   strline         = "";
             string[] values          = null;
             while (!sr.EndOfStream)
             {
                 List <double> temp = new List <double> ();
                 strline = sr.ReadLine();
                 values  = strline.Split(',');
                 for (int i = 0; i < values.Length; i++)
                 {
                     temp.Add(Convert.ToDouble(values[i], System.Globalization.CultureInfo.InvariantCulture));
                 }
                 temp_board_data.Add(temp);
             }
             sr.Close();
             data = temp_board_data.Select(a => a.ToArray()).ToArray().ToMatrix();
         }
         else
         {
             throw new MissingFieldException("nor data_from_board nor csv_file was specified");
         }
     }
 }