Filtering Eye-Tracking Data From an EyeLink 1000: Comparing Heuristic, Savitzky-Golay, IIR and FIR Digital Filters

In a prior report (Raju et al., 2023) we concluded that, if the goal was to preserve events such as saccades, microsaccades, and smooth pursuit in eye-tracking recordings, data with sine wave frequencies less than 75 Hz were the signal and data above 75 Hz were noise. Here, we compare five filters in their ability to preserve signal and remove noise. We compared the proprietary STD and EXTRA heuristic filters provided by our EyeLink 1000 (SR-Research, Ottawa, Canada), a Savitzky- Golay (SG) filter, an infinite impulse response (IIR) filter (low-pass Butterworth), and a finite impulse filter (FIR). For each of the non-heuristic filters, we systematically searched for optimal parameters. Both the IIR and the FIR filters were zero-phase filters. All filters were evaluated on 216 fixation segments (256 samples), from nine subjects. Mean frequency response profiles and amplitude spectra for all five filters are provided. Also, we examined the effect of our filters on a noisy recording. Our FIR filter had the sharpest roll-off of any filter. Therefore, it maintained the signal and removed noise more effectively than any other filter. On this basis, we recommend the use of our FIR filter. We also report on the effect of these filters on temporal autocorrelation.


Introduction
According to Raju et al. [2023], for the study of saccades, microsaccades, and smooth pursuit, frequency components above 100 Hz can be considered as noise.This was based on several forms of analysis: (1) a visual analysis of different frequency components, (2) an analysis of the percent of variance accounted for by various frequency bands, and (3) a detailed study of the effect of low-pass filtering on saccade peak-velocity.Based on the results of these analyses we concluded that signals comprised of sine-wave frequencies below 100 Hz are essential for visualizing eye-movement events and measuring the peak velocity of saccades.Sine-wave frequencies above 100 Hz can be considered noise (see also Bahill et al. [1981], Mack et al. [2017]).
In 1993, Stampe [1993] suggested two "heuristic" filters that were designed for the video-oculography system.One was labeled standard (STD) and was labeled extra (EXTRA).Several manufacturers2 have, over the years, employed these filters.At some (unknown) point in time, SR-Research modified both of the original heuristic filters.However, the date of the change and the nature of the modifications are proprietary.Mack et al. [2017] evaluated moving average (MA) [Kalman, 1960], Savitzky-Golay (SG) [Savitzky and Golay, 1964] and low-pass Butterworth (BW) [Butterworth, 1930] filters.Both the MA filter and the SG filter are FIR-style filters [Chauhan et al., 2018, Chatterjee and Roy, 2018, Mack et al., 2017].They compared the performance of both FIR (MA and SG) and IIR (Butterworth) filters on saccadic movements3 .These authors suggested that for 1000 Hz data, the BW performed better than the various MA or SG filters examined.Based on their analysis, we decided to further study SG, and Butterworth filters (IIR-type).In addition, we also evaluated a standard FIR low-pass filter not evaluated by Mack et al. [2017] 4 .
The main objective of this study is to determine the most effective filtering approach for preserving eye-movement signals below 100 Hz and eliminating frequency components above 100 Hz that are considered noise.We compare the effectiveness of heuristic and digital filters in terms of their ability to preserve signals and eliminate noise.The key analysis is the comparison of the frequency response curves for all filters.In addition, since it is well established that filtering typically increases temporal autocorrelation [Roy et al., 1997] 5 , we also compare the autocorrelation functions for signals processed with all filter types.

Subjects
A total of 23 subjects were recruited (M-17, F-6), Median age was 28 (range: 20 to 69 yrs).A majority (N=14) of participants had normal vision, while 9 subjects needed vision correction.The participants were recruited from laboratory personnel, undergraduate students taking a computer programming course, and friends of the experimenters.The study was approved by the Texas State University institutional review board and all participants provided informed consent.
We report on two datasets, the first dataset is labeled as the "Fixation" dataset.This dataset originally had data from 15 subjects.However, due to blinks and other technical issues, only data from 9 subjects were analyzed.The second dataset ("RS"), contained data when subjects viewed a random saccade task.The RS dataset consisted of 9 subjects.

Data Collection
During the data collection process, the participants were positioned at a fixed distance of 550 millimeters from a 19" (48.26 cm) computer screen (474×297 millimeters, resolution 1680×1050 pixels), where they were presented with visual stimuli.The data was captured using a tower-mounted EyeLink 1000 eye tracker (SR Research in Ottawa, Ontario, Canada) and operated in a monocular mode to record the movement of the dominant eye.The participants' dominant eye was identified using the Miles method [Miles, 1930].The sampling rate was 1000 Hz.For each subject, there were three fixations recorded: (1) Unfiltered; (2) STD filtered, and (3) EXTRA filtered.
For the fixation task, participants were presented with a white circle with a diameter of 0.93 o as a visual stimulus.The circle was positioned at a distance of 3.5 o above the primary position, at the horizontal middle of the screen.Participants were instructed to maintain their gaze on the stationary point for 30 seconds.
For the random saccade task, the participants were instructed to follow the same target that moved randomly across the display monitor, ranging from ± 15 o and ± 9 o of visual angle in the horizontal and vertical directions respectively.The minimum amplitude between adjacent target displacements was 2 o of visual angle.The target positions were randomized for each recording to ensure uniform coverage across the display.The delay between target jumps varied between 1 second and 1.5 seconds, chosen randomly from a uniform distribution.The random saccade task lasted for 30 seconds6 .

Signal Processing of Fixation Data
All fixation recordings lasted 30 seconds (30,000 samples).We used these fixation periods to create amplitude spectra and to determine the frequency response of several filters discussed below.The segment selection was a two-step process.In the first step, we calculated the velocity with a six-point difference approach using velocity = (x t+3 − x t−3 )/dt [Bahill et al., 1982].We then screened the recordings of each subject to find the maximum number of segments of length 2048 samples that did not have any velocity above 25 deg/sec.We rejected any segments which contained velocities above 25 deg/sec to reduce the possibility of saccades or other fast events in our segments.For four of the 16 subjects, we could not find a single segment of 2048 samples that met our criteria.For the remaining subjects, we found 1 to 4 segments.We use these 2048-sample segments for our Fourier analysis.Using the fast Fourier transform (FFT), the ratio of the sampling rate to the segment size (i.e., block size) determines the frequency resolution.For 2048-sample segments, we could discriminate 1024 different frequencies from 0 to 500 Hz.Since these analyses were quite noisy, we decided to break down the 2048-sample segments into 8 256-sample segments.This would still give us reasonable frequency precision of approximately 4 Hz, and it would produce more segments to average (we had 27 2048-sample segments and these produced 216 segments of 256 samples across which to average).Note that we did our averaging using the magnitude spectra rather than averaging the complex FFT data.Cut-off (-3dB) = 100, Zero-phase Finite impulse response (FIR) Number of coefficients, taps = 80 Cut-off (-3dB) = 100, Zero-phase

Digital Filter Design
As we want to retain the frequency components below 100 Hz and remove noise above this, we chose a cut-off of 100 Hz.When we refer to a "cutoff" frequency, we are referring to the -3dB (dB = decibels) point, which is standard in the signal processing literature.At the -3dB point, signals are reduced by 50%.
Before choosing a final set of parameters (order and window length) for the SG filter, we examined the frequency response of SG filters with orders from 2 to 9 and window lengths from 5 to 91 (odd numbers only).For implementing the SG filter we used the python built-in function from Scipy [Virtanen et al., 2020].We were looking for filters that had a -3dB point near 100 Hz.We found 4 sets of parameters that met this criterion.All of these 4 parameter sets produced similar frequency responses so we chose the parameter set with the lowest order and window size (order 2, window size 11).It is generally known that SG filters have substantial ringing in the stop band [Kennedy, 2020] (see Fig. 1).
As we tested various potential parameter settings we noted that higher orders produce fewer and wider ringing lobes, Increasing the window size produces more, smaller (in terms of dB), and narrower ringing lobes.
For our IIR filter, we chose a Butterworth low-pass filter with order = 7 and a cutoff of 100 Hz.We chose order 7 because it has a steep roll-off and appeared to be stable.We formally checked for the stability of the IIR filter with the unit-circle test7 .
FIR filters are always stable.For our FIR filter, we chose 80 taps.We determined this number of taps (N taps ) based on the following formula from [Bellanger, 2000].
Here, N taps = number of taps (filter order) δ 1 = the ripple in passband δ 2 = the suppression in the stop band f s =the sampling rate ∆f = the transition width.
For the IIR filter, we used Butterworth (BW) low-pass filter.The BW filter is maximally flat in the pass band and has no ripples in the stop band.Also, BW filters do not have any linear phase response in contrast to finite impulse response filters [Mack et al., 2017].Mack et al go on to say: "A general observation from the best filter list is the increasing prevalence of BW filters at higher sampling rates, ending in a total absence of other filter types at 1 kHz.This can be explained by considering the smoothness of the signal.At higher sampling rates more noise is present in the data.Such high-frequency noise can be more efficiently suppressed by the steeper roll-off of the BW filters compared to the two FIR filters, resulting in a smoother signal.. . ." [Mack et al., 2017], page 2159.
Typically, low-pass digital filters can have phase and delay effects.Both our FIR and IIR filters are zero-phase and zero-delay.A zero-phase filter can be constructed by first passing the signal through the filter in the forward direction, then reversing the filtered sequence and running it back through the filter.This process doubles the order of the filter and removes both phase and delay effects.
Table 1 represents a list of filters we employed along with their characteristics.

Estimation of Filter Frequency Response
We wanted to estimate the frequency response of each of our five filters.For the designed FIR and IIR filters, the frequency response could be computed directly from the filter coefficients.Due to the zero-phase design, we directly obtained the frequency response after doubling the filter order.
For all filters, we start with an FFT of unfiltered data.Let us label this FFT as "A".We also calculated the FFT for each filtered dataset.Let us label the FFT of the filtered signal as "B".We compute the filter frequency response C by ratio method, C = B A .

Fourier Analysis of Fixation before and after filtering
To further study the effects of the filters, we filtered our fixation data with all five filters.Then we computed the amplitude spectrum of all of these filtered (and unfiltered) signals using FFT[Cooley and Tukey, 1965].These amplitude spectra show how the filters affected the amplitude of the signal that remains after filtering.
The input fixation data consisted of 216 blocks, each 256 samples long, as mentioned earlier.In the first step, each segment was detrended with a 2 nd order polynomial.The residuals of these polynomials have a mean of zero.A Hanning window is then applied to each fixation segment.We then perform an FFT of each detrended and windowed fixation segment The resulting spectra have a frequency resolution of ≈ 4 (3.90625)Hz.With a sample rate of 1000 Hz, spectra can only be calculated from 0 to 500 Hz [Shannon, 1949].With a 3.90625 Hz resolution, we end up with spectra that are 128 points long.These amplitude spectra were averaged across all 216 fixation segments.This produced a relatively clean amplitude spectrum.

Study of the Effects of Filtering on Temporal Auto-correlation
It is known that low-pass filtering can increase temporal autocorrelation [Roy et al., 1997](also see footnote 4).We thought it would be useful to examine the effects of our filtering scheme on temporal autocorrelation.For each fixation segment, we calculated the autocorrelation function (ACF) out to 5 lags.For each filtered set of autocorrelations, we plotted the median.Since Pearson r correlation coefficients are not on a linear scale, prior to statistical testing all of the ACF estimates were transformed using a Fisher-Z transformation.For the first 3 lags, we tested the statistical significance of the differences between autocorrelation estimates for unfiltered and filtered data.We used the Friedman test.We followed up a statistically significant Friedman test with a multiple comparisons comparing all filter levels.Controlled for multiple comparisons employed the Tukey HSD test.

Study of the Effects of Filtering on Positional Signal and Velocity
To illustrate the effect of our filters on actual position traces, we studied the effect of three filtes (SG, IIR, FIR) on an unfiltered exemplar segment with a saccade.Out of 9 subjects from the "RS" dataset, we chose the subject with the noisiest recording.We chose to illustrate instantaneous velocity (velocity ) for this case because it is the noisiest velocity calculation.In Fig. 1, we present the frequency response of STD, EXTRA, SG, IIR, and FIR filters.The Y-axis of the plot is in decibels (dB, reference = 1).The black line represents the frequency response of the STD filter.The red line represents the frequency response of the EXTRA filter.The green line represents the frequency response of the SG filter.The blue and magenta lines represent the frequency response of the IIR and FIR filters, respectively.It appears that all of the filters do a good job of preserving the signal (frequencies less than 100 Hz).However, the filters differ substantially in the degree to which they remove noise-related frequencies.It is obvious that the FIR and IIR filters have much sharper roll-offs than the other filters.Only the IIR and FIR filters ever achieve -30 db (0.1 % of signal amplitude remaining).IIR reaches this point at 127 Hz and FIR at 110 Hz.The SG filter reaches this point at 158 Hz, and the EXTRA filter reaches this point at 332 Hz.The STD never reaches this level of reduction.

Analysis of Filter Frequency Response
Obviously, the digital filters do a much better job of reducing higher frequencies without affecting the lower frequencies.The heuristic filters remove high-frequency signals much more slowly than the digital filters.The maximum amplitude of noise remaining at 500 Hz is -18 dB (1.58 percent of the signal remaining) for the STD filter whereas, for the EXTRA filter, it is -25 dB (0.32 percent of the signal remaining).The signal is effectively reduced to 0 o amplitude (-40 dB) at 135 Hz for the IIR filter and at 114 Hz for the FIR filter.The frequency response of the FIR filter is steeper than all other filters.

Fourier analysis of the unfiltered and filtered signals
In Fig. 2, we present the average amplitude spectra for all 5 signal types.Amplitudes for all signals are much higher in very low frequencies (1-30 Hz).All filtered signals have less amplitude at above 100 Hz.The amplitude of the unfiltered signal reaches a minimum of around 150 Hz and then the amplitude of noise frequencies actually increases as frequencies approach 500 Hz.The STD-filtered signal has a gradual decline in amplitude from about 50 Hz to 500 Hz.The EXTRA-filtered signals remove substantially more noise frequencies than the STD filter.The SG filter has marked ringing in the stop band.The amplitude of the IIR-filtered signal drops sharply at about 75 to 150 Hz and remains essentially 0.000 above 150 Hz.The amplitude of the FIR-filtered signal drops sharply at about 75 Hz to 120 Hz and remains essentially 0.0 above 125 Hz.
Figure 2: Amplitude spectrum of the unfiltered signal and all of the filters evaluated in this report.Segments were chosen as described above.

Effect of Filtering on Temporal Auto-correlation
The median ACF for the first 5 lags is plotted for unfiltered and filtered signals in Fig 3 .In the unfiltered condition, the median lag 1 temporal autocorrelation was ≈ 0.579, and of a total of 216 segments, 178 were statistically significant at the p < 0.05 level.Although the unfiltered data reveals moderately strong temporal autocorrelation, it is clear that the filters do indeed introduce more temporal autocorrelation.For all 216 fixations, filtered at all 5 levels, all 216 segments had a lag 1 temporal autocorrelation that was statistically significant at a p < 0.0001 level.
In Fig. 4, we present boxplots for the Fisher-Z transformed values.In (A), we present the results for lag 1, (B) for lag 2, and (C) for lag 3. P-values from the Friedman tests were all statistically significant (p < 0.0001), (see Table 2).The results of all possible comparisons are presented in Table 2. Comparisons that were not statistically significant are highlighted in yellow.At a glance, it is clear that almost every comparison was statistically significant.For lags 1 and 2, the EXTRA and SG were not statistically significantly different.For lags 1 and 3, EXTRA and IIR were not statistically significantly different.For lag 2 only the SG and the IIR were not statistically different.

Illustration of the Effects of Filtering on Positional Signal and Velocity
In Fig. 5, we illustrate the effect of three filtering schema (SG, IIR, FIR) on a particularly noisy unfiltered segment from our random saccade test.We do not have a method to apply the heuristic STD and EXTRA filters for this analysis since these filter functions are proprietary.Plot (A) shows the effect of filters on the raw signal.Plot (B) represents instantaneous velocity for the unfiltered position channel in (A).Plot (C) shows the effect of our three filters on the instantaneous velocity of the filtered signals in (A).The IIR and FIR filters are much more effective at reducing noise than the SG filter.The differences between the FIR and the IIR are very subtle.

Discussion
In our prior paper [Raju et al., 2023] we determined that sine-waves below 100 Hz comprise signal and sine-waves above 100 Hz comprise noise.In this paper, We compared the frequency response of 5 filters applied to eye-movement fixation signals recorded from an EyeLink 1000 eye-tracking device.We conclude that, if the goal of the filtering process is to retain signal and remove noise, then our FIR filter is the best.This is apparent in the frequency-response and amplitude spectra of the various filtered signals.It is also supported by a visual inspection of a particularly noisy recording with a saccade.A large majority (82%) of unfiltered signals exhibit statistically significant temporal autocorrelation, but all    † In all case df=5, p < 0.0001.our filters substantially increase temporal autocorrelation.If the choice of a filter is based on a desire to impart the least additional temporal autocorrelation, then the heuristic STD filter is the best.
Of course, some may not agree with our 100 Hz cutoff for distinguishing between signal and noise.Although the heuristic filters have no input parameters, the SG, the FIR, and the IIR filter can be designed to have any reasonable cutoff.
Although the FIR filter was the best, the IIR filter (low pass, 7 th order Butterworth) also performed very well.The heuristic filters did tend to reduce signals above 100 Hz, but the roll-off of these filters was very gradual and shallow.The SG filter is undesirable because of its relatively slow, shallow roll-off and because of the large ringing in the stop band.Stampe [1993] promoted heuristic filters in place of other linear filters.He suggested that digital low-pass filters would negatively affect saccade detection but he did not provide any evidence for this claim.It seems to us that the digital filters we propose would improve event detection because the saccade shape would be preserved and noise would be reduced.For example, we think that event detection would be substantially easier in the filtered data in Fig. 5 than in the unfiltered data.However, this remains an empirical question.
We studied the effect of filtering on temporal autocorrelation.As noted above, the unfiltered signals were generally temporally autocorrelated.The lag 1 autocorrelation (ACF) was ≈ 0.58.The lag 1 ACF for the STD filter was ≈ 0.95, and all the remaining filters had lag 1 ACFs ≈ 0.97.The marked increase in temporal autocorrelation as a result of our filters was not surprising [Roy et al., 1997] (see also footnote 4 above).We consider the presence of temporal autocorrelation to be undesirable.It is possible that different eye trackers might induce lower temporal autocorrelation.This has not been studied.Although there are time-series models (ARIMA-type models) that can markedly reduce or eliminate temporal autocorrelation, it is very unlikely (based on some pilot work) that the non-autocorrelated signals produced by such models would be useful to those who study eye movements.So, at least for now, eye-movement researchers will have to live with the presence of temporal autocorrelation.
We recommend that EyeLink users collect their data unfiltered at 1000 Hz.We further recommend that EyeLink 1000 users low-pass filter their data with our FIR filter.In this way, they will retain the needed signal and remove noise.
In the future, it might be interesting to perform the same type of study using other popular eye-tracking devices.Perhaps our analysis would yield different results for different systems.For the present, our results apply to EyeLink 1000 eye-trackers only.

Figure 1 :
Figure 1: Frequency response of all the filters (EyeLink heuristic filters and Digital filters).At -3dB signals are reduced by 50%, at -6dB signals are reduced by 75%, and so on as mentioned in the legend.

Figure 3 :
Figure 3: Effect of filtering on median temporal autocorrelation for unfiltered and filtered fixation segments.

Figure 4 :
Figure 4: Analysis of autocorrelation results.Values plotted are Fisher Z transformed values from the original autocorrelations.Three box-plots that compare all filters.(A) Box-plots represent ACF lag 1. (B) Box-plots represent ACF lag 2. (C) Box-plots represent ACF lag 3.

Figure 5 :
Figure 5: Illustration of the effect of filtering on positional signals and instantaneous velocity.A very noisy stretch of recording during our random saccade task was chosen.(A) Horizontal position signal, including a saccade of ≈ 1.25 degrees of visual angle (dva) for a very noisy unfiltered recording and for filtered position signals of the same recording.Each of the filtered versions has an offset for better visualization.(B) Velocity (instantaneous) channel for the unfiltered data.(C) Velocity (instantaneous) channel of the filtered data.The IIR velocity channel was offset by 50 degrees per second (d/s) and the FIR velocity channel was offset by 100 d/s.

Table 1 :
Digital filter specification

Table 2 :
Testing the Effects of filtering on Temporal Autocorrelation: Multiple Comparison Statistics * * Highlighted values were not statistically significant.