示例#1
0
        private void initializeTimeBins()
        {
            Trial trial = run.Trial;

            timeBins = new List <TimeBin>();

            int start = exportSettings.ExportStart * 1000;
            int end   = exportSettings.ExportEnd * 1000;
            int index = start;

            while (index < end)
            {
                TimeBin timeBin = new TimeBin();
                timeBin.start = index;
                index        += binDuration;
                timeBin.end   = Math.Min(index, end);
                foreach (Behavior behavior in trial.Session.BehavioralTest.GetBehaviors())
                {
                    if (behavior.Type == Behavior.BehaviorType.State)
                    {
                        timeBin.stateBehaviorTotalDuration.Add(behavior, 0.0);
                    }
                }

                timeBins.Add(timeBin);
            }
        }
示例#2
0
        public List <TimeBin> calculateTimeBins()
        {
            RunEvent lastStateRunEvent = stateRunEventsInRange[0];

            int eventIndex = 1;
            int binIndex   = 0;

            while (true)
            {
                TimeBin currentBin = timeBins[binIndex];

                long eventEnd = (eventIndex >= stateRunEventsInRange.Count) ? exportSettings.ExportEnd * 1000 :
                                Math.Max(stateRunEventsInRange[eventIndex].TimeTracked, exportSettings.ExportStart * 1000);

                long eventStartInBin = Math.Max(lastStateRunEvent.TimeTracked, currentBin.start);
                long eventEndInBin   = Math.Min(eventEnd, currentBin.end);

                double currentEventDurationInBin = eventEndInBin - eventStartInBin;

                currentBin.stateBehaviorTotalDuration[lastStateRunEvent.Behavior] += currentEventDurationInBin;

                if (eventEnd < currentBin.end)
                {
                    if (eventIndex >= stateRunEventsInRange.Count)
                    {
                        break;
                    }
                    lastStateRunEvent = stateRunEventsInRange[eventIndex];
                    eventIndex++;
                    continue;
                }
                else
                {
                    binIndex++;
                    if (binIndex >= timeBins.Count)
                    {
                        break;
                    }
                    continue;
                }
            }

            return(timeBins);
        }
示例#3
0
        private void initializeTimeBins()
        {
            Trial trial = run.Trial;

            timeBins = new List<TimeBin>();

            int start = exportSettings.ExportStart * 1000;
            int end = exportSettings.ExportEnd * 1000;
            int index = start;

            while (index < end)
            {
                TimeBin timeBin = new TimeBin();
                timeBin.start = index;
                index += binDuration;
                timeBin.end = Math.Min(index, end);
                foreach (Behavior behavior in trial.Session.BehavioralTest.GetBehaviors())
                {
                    if (behavior.Type == Behavior.BehaviorType.State)
                    {
                        timeBin.stateBehaviorTotalDuration.Add(behavior, 0.0);
                    }
                }

                timeBins.Add(timeBin);
            }
        }