## 3 Methodology
### Deviation Calculation  
In order to analyze the eye movement, the deviation of the eyes during the stimulus process needs to be calculated. During a stimulus process, the position of the eye remains motionless before \begin{table}
\begin{tabular}{c c} \hline
**State Change** & **Stimuli** \\ \hline \([1\ 1]\rightarrow[1\ 0]\) & Covering the left eye in unilateral cover test \\ \([1\ 1]\rightarrow[0\ 1]\) & Covering the right eye in unilateral cover test \\ \([0\ 1]\rightarrow[1\ 0]\) & Uncovering the right eye in alternate cover test \\ \([1\ 0]\rightarrow[0\ 1]\) & Uncovering the left eye in alternate cover test \\ \([1\ 0]\rightarrow[1\ 1]\) & Uncovering the left eye in cover-uncover test \\ \([0\ 1]\rightarrow[1\ 1]\) & Uncovering the right eye in cover-uncover test \\ \hline \end{tabular}
\end{table} 
Table 1: State changes and stimulus. Figure 5: The flowchart of pupil localization. Steps 1 and 2 are omitted here since these two steps are the same as Steps 1 and 2 of Section 3.2, and Step 2 represents the detected exact eye region of Step 2. In (3) The segmented pupil region is marked by the red window on the detected exact region. In (4), (5), and (6), the presented images are enlarged and bilinearly interpolated for a good display. In (7), an ellipse is fit to the contour of the pupil and the red ellipse and the cross separately marks the result of fitting and the center of the pupil. the stimulus occurs; after stimuli, the eye responds. The response can be divided into two scenarios. For the simpler case, the eyeball remains still. For the more complex case, the eyeball starts to move after a short while and then stops moving and keeps still until the next stimuli. Based on the statistics in the database, the eyes complete the movement within 17 frames and the duration of the movement is about 3 frames. The schematic of deviation calculation is shown in Figure 6. The pupil position data within the region from the 6 frames before the detected key frame, to 60 frames after the key frames, are selected as a data matrix. Each row of the matrix corresponds to the frame number, the x, y coordinate of the pupil center. Next, an iterative process is applied to filter out the singular values of pupil detection. The current line of the matrix is subtracted from the previous line of the matrix, and the frame number of the previous line, the difference between the frame numbers \(\Delta\)f, and the difference between the coordinates \(\Delta\)x, \(\Delta\)y are retained. If \(\Delta\)x \(>\)\(\Delta\)f.v, where v is the statistical maximum of the offset of pupil position of two adjacent frames, then this frame is considered to be wrong and the corresponding row in the original matrix is deleted. This process iterates until no rows are deleted or the number of loops exceeds 10. Finally, we use the average of the coordinates of the first five rows of the reserved matrix as the starting position and the average of the last five rows as the ending position, thus, obtaining the deviation of each stimulus, as expressed by the equations:  
\[ \begin{split}\text{Dev}_{\text{P}}^{(\text{x})}&= \Big{|}\text{x}_{\text{e}}\ -\text{x}_{\text{s}}\Big{|};\\ \text{Dev}_{\text{P}}^{(\text{y})}&=\big{|}\text{y} _{\text{e}}\ -\text{ y}_{\text{s}}\big{|},\end{split}  \tag{2}\]  
where xe and ye are the ending positions of the eye in a stimulus, the xs and ys are the starting positions of the eye, and Dev\({}_{\text{P}}^{(\text{x})}\), Dev\({}_{\text{P}}^{(\text{y})}\) are the horizontal and vertical deviations in pixels, respectively. Figure 6: The schematic of deviation calculation. (1) The input data consist of the interval from 6 frames before the key frame to 60 frames after the key frame. The frame pointed to by the red arrow represents the key frame detected, and the symbol “\(\times\)”\(\times\)”\(\surd\)” below the image indicates the abnormality or normality of the pupil detection. (2) With the false frame filtering completed, the abnormal frames are deleted while the normal frames are reserved.