public Window1() { #region scaffolding InitializeComponent(); MouseMove += (_, args) => _lastEyePosition = args.GetPosition(this); Observable.Context = SynchronizationContexts.CurrentDispatcher;//Automatic marshaling of all events to correct context var eyePositions = Observable.Interval(TimeSpan.FromMilliseconds(1)).Select(_ => _lastEyePosition); #endregion eyePositions.Subscribe(point => currentLocation.Content = point); var fixtationFilter = new WindowAverageFixationFilter(windowSize: 8, tolerance: 30); var movements = eyePositions.Movements(); var distance = movements.TotalMovementDistance(); var fixationPositions = eyePositions.Select(fixtationFilter.CurrentFixationPosition); fixationPositions.Subscribe(point => currentFixationPosition.Content = point); movements.Subscribe(move => lastMovement.Content = move); distance.Subscribe(travelled => distanceTravelled.Content = travelled); }
public void ShouldBeBloodyPerformant() { var stopwatch = new Stopwatch(); stopwatch.Start(); //use 48 hours and show memoryconsumption during work. //Also show profiler result and mention optimization possibilities and how DRY code enables them; const int hours = 4; const int herz = 60; var anHoursWorthOfGazeData = GenerateRandomGazePointWalk(hertz: herz, hours: hours); var filter = new WindowAverageFixationFilter(windowSize: 10, tolerance: 20); var fixations = anHoursWorthOfGazeData.Fixations(filter); var fixationCount = fixations.Count(); Console.WriteLine(@"Took {0} to parse {1} hours worth of gaze data at {2} herz. Found {3} fixations", stopwatch.Elapsed, hours, herz, fixationCount); }