Exemple #1
0
        public List <SaccadesCountOnInerval> ReadTxtToSaccadesCountOnInervalListSaccades(string filename)
        {
            List <SaccadesCountOnInerval> saccadesRecords = new List <SaccadesCountOnInerval>();

            using (StreamReader rd = new StreamReader(new FileStream(filename, FileMode.Open)))
            {
                char     separator = '\n';
                char     delimiter = '\t';
                string[] str_arr   = { "" };
                string   big_str   = "";
                TobiiCsvReader.ReadPartOfFile(rd, out big_str);
                str_arr = big_str.Split(separator);

                int i = 0;
                for (i = 0; i < str_arr.Length; i++)
                {
                    if (str_arr[i] == "")
                    {
                        continue;
                    }
                    string[] tmp = { "" };
                    tmp = str_arr[i].Split(delimiter);

                    SaccadesCountOnInerval saccadesRecord = new SaccadesCountOnInerval();
                    saccadesRecord.time_beg      = int.Parse(tmp[0]);
                    saccadesRecord.time_end      = int.Parse(tmp[1]);
                    saccadesRecord.SaccadesCount = int.Parse(tmp[2]);

                    saccadesRecords.Add(saccadesRecord);
                }
            }
            return(saccadesRecords);
        }
Exemple #2
0
        public List <SaccadesCountOnInerval> CalcSaccadesOnSlidingWindow(List <TobiiRecord> tobiiRecords, long SlidingWindowSize_msec, long SlidingWindowTimeStep_msec)
        {
            List <SaccadesCountOnInerval> ListSaccadesCountOnInerval = new List <SaccadesCountOnInerval>();

            long tobiiRecordsBeginTime = tobiiRecords.First().time_ms + (long)(SlidingWindowSize_msec / 2);
            long tobiiRecordsEndTime   = tobiiRecords.Last().time_ms - (long)(SlidingWindowSize_msec / 2);

            for (long curTime = tobiiRecordsBeginTime; curTime < tobiiRecordsEndTime; curTime += SlidingWindowTimeStep_msec)
            {
                SaccadesCountOnInerval sc = new SaccadesCountOnInerval();
                sc.time_beg      = curTime;
                sc.time_end      = curTime + SlidingWindowSize_msec;
                sc.SaccadesCount = 0;
                foreach (var tr in tobiiRecords)
                {
                    if (tr.time_ms >= sc.time_beg && tr.time_ms < sc.time_end)
                    {
                        sc.SaccadesCount += 2;
                    }
                }
                ListSaccadesCountOnInerval.Add(sc);
            }
            return(ListSaccadesCountOnInerval);
        }