.. _analysis: Reading SimpleGazeTracker data file for offline analysis ========================================================== SimpleGazeTracker CSV file can be imported to Matlab/Octave workspace by using 'ReadDataFile' command. Import will take several minutes if the data file contains hundreds of trials. .. code-block:: matlab data = SimpleGazeTracker('ReadDataFile','data.csv') data = 1x240 struct array containing the fields: STARTREC T L R LP RP MSG C CAL PARAM ======== ========================= ========================================================================================== Member Data type Description ======== ========================= ========================================================================================== STARTREC 1x6 numerical array Date of starting recording (Year, Month, Day, Hour, Minute, Second). T Nx1 numerical array Timestamps (N = number of samples). L Nx2 numerical array Gaze position of the left eye (N = number of samples). The 1st and 2nd columns represent horizontal and vertical position, respectively. R Nx2 numerical array Gaze position of the right eye (N = number of samples). The 1st and 2nd columns represent horizontal and vertical position, respectively. LP Nx1 numerical array Area of left pupil (unit is pixel^2). RP Nx1 numerical array Area of right pupil (unit is pixel^2). MSG Nx2 Cell array The 1st column holds timestamp. The 2nd column holds messages. C (reserved) (reserved) CAL MxN numerical array Precision and accuracy at each calibration point (M = number of calibration points, N = 6 or 10). Data layout is the same as that in SimpleGazeTracker data file. **New feature in 0.3.0**. PARAM Scalar structure Parameters embedded in the data file. ======== ========================= ========================================================================================== Following code returns recording date of the 4th trial. .. code-block:: matlab octave-3.6.4.exe:34> data(4).STARTREC ans = 2013 2 27 13 10 14 Following code plots the horizontal gaze position of the left eye during the 1st trial. .. code-block:: matlab octave-3.6.4.exe:38> plot(data(1).T, data(1).L(:,1)) .. figure:: analysis001.png Following code shows X-Y plot of the gaze position of the left eye during the 1st trial. .. code-block:: matlab octave-3.6.4.exe:40> plot(data(1).L(:,1), data(1).L(:,2), 'r.-') .. figure:: analysis002.png MSG member holds messages inserted during the trial. .. code-block:: matlab octave-3.6.4.exe:45> data(45).MSG ans = { [1,1] = 0 [2,1] = 598.80 [3,1] = 2013.4 [4,1] = 2163.4 [1,2] = TRIAL45 300 1 -150 [2,2] = START [3,2] = FIXOFF [4,2] = TRGON } octave-3.6.4.exe:46> data(45).MSG{3,1} %timestamp of the 3rd message ans = 2013.4 octave-3.6.4.exe:47> data(45).MSG{3,2} %message of the 3rd message ans = FIXOFF PARAM member holds parameters embedded in the data file. Usually, embedded parameters are constant during recording. Althogh these parameters are embedded to be used by **GazeParser** library, they may be useful for data analysis on Matlab/Octave. .. code-block:: matlab octave-3.6.4.exe:50> data(1).PARAM ans = scalar structure containing the fields: SimpleGazeTrackerDataFile = [](0x0) TRACKER_VERSION = 0.5.1 DATAFORMAT = { [1,1] = T [1,2] = X [1,3] = Y [1,4] = P } SACCADE_MINIMUM_DURATION = 12 SACCADE_ACCELERATION_THRESHOLD = 3800.0 SCREEN_WIDTH = 1920 FILTER_WN = 0.25 DOTS_PER_CENTIMETER_H = 37.7 TRACKER_ORIGIN = BottomLeft RECORDED_EYE = L FILTER_ORDER = 3 BLINK_MINIMUM_DURATION = 50 FILTER_SIZE = 5 FILTER_TYPE = butter_filtfilt DOTS_PER_CENTIMETER_V = 37.7 VIEWING_DISTANCE = 57.2957795131 SACCADE_VELOCITY_THRESHOLD = 40.0 SCREEN_ORIGIN = BottomLeft FIXATION_MINIMUM_DURATION = 12 SCREEN_HEIGHT = 1080