Fixation

physiolabxr.scripting.physio.eyetracking

gap_fill(gaze_xyz, gaze_status, valid_status, gaze_timestamps, max_gap_time=0.075, verbose=True)

Fill gap in gaze data with specific threshold.

Parameters:
gaze_xyz : numpy.ndarray

ndarray of shape (3, timesteps): x, y, z are the 3D gaze vector given by your eyetracker, with z pointing out of the eye straight ahead

gaze_status : numpy.ndarray

ndarray of shape (timesteps, ): the validity of the gaze sample

valid_status : any

the value of the valid status, the valid value should be in the gaze_status array

gaze_timestamps : numpy.ndarray

the timestamps of the gaze samples (in seconds)

max_gap_time : float

maximum gap time, preset to 0.075 seconds

verbose : bool

If True, prints information about the interpolation process. Default is True

Returns:

gaze_xyz

Return type:

numpy.ndarray

fixation_detection_idt(gaze_xyz, timestamps, window_size=0.175, dispersion_threshold_degree=0.5, saccade_min_sample=2, return_last_window_start=False)

Fixation detection using the IDT algorithm.

Parameters:
gaze_xyz : numpy.ndarray

2D numpy array containing (x, y, z) coordinates of gaze points

timestamps : numpy.ndarray

timestamps corresponding to gaze data points

window_size : float

Size of the time window for fixation detection (in seconds). Default is 0.175 seconds.

dispersion_threshold_degree : float

Threshold for dispersion angle to determine fixations (in degrees). Default is 0.5 degrees.

saccade_min_sample : int

the minimal number of samples between consecutive fixations to be considered as a saccade, preset to 2.

return_last_window_start : bool

If True, returns the start of the last window. Default is False.

Returns:

A 2D numpy array containing fixation labels (1 for fixation, 0 for non-fixation) and corresponding center timestamps.

Return type:

numpy.ndarray