Eyetracker |

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
pygaze._eyetracker.libeyetribe.EyeTribeTracker Class Reference
Inheritance diagram for pygaze._eyetracker.libeyetribe.EyeTribeTracker:

## Public Member Functions
| __init__ (self, display, logfile=settings.LOGFILE, eventdetection=settings.EVENTDETECTION, saccade_velocity_threshold=35, saccade_acceleration_threshold=9500, blink_threshold=settings.BLINKTHRESH, **args)
| calibrate (self)
| close (self)
| connected (self)
| drift_correction (self, pos=None, fix_triggered=False)
| draw_drift_correction_target (self, x, y)
| draw_calibration_target (self, x, y)
| fix_triggered_drift_correction (self, pos=None, min_samples=10, max_dev=60, reset_threshold=30)
| get_eyetracker_clock_async (self)
| log (self, msg)
| prepare_drift_correction (self, pos)
| pupil_size (self)
| sample (self)
| send_command (self, cmd)
| start_recording (self)
| status_msg (self, msg)
| stop_recording (self)
| set_detection_type (self, eventdetection)
| wait_for_event (self, event)
| wait_for_blink_end (self)
| wait_for_blink_start (self)
| wait_for_fixation_end (self)
| wait_for_fixation_start (self)
| wait_for_saccade_end (self)
| wait_for_saccade_start (self)
| is_valid_sample (self, gazepos)
Public Member Functions inherited from pygaze._eyetracker.baseeyetracker.BaseEyeTracker
| __init__ (self)
| log_var (self, var, val)
| set_eye_used (self)
| set_draw_calibration_target_func (self, func)
| set_draw_drift_correction_target_func (self, func)

## Public Attributes
| disp = display
| screen = Screen()
| dispsize = settings.DISPSIZE
| screensize = settings.SCREENSIZE
| kb = Keyboard(keylist=['space', 'escape', 'q'], timeout=1)
| errorbeep = Sound(osc='saw',freq=100, length=100)
| outputfile = logfile
bool | recording = False
int | errdist = 2
int | pxerrdist = 30
int | maxtries = 100
tuple | prevsample = (-1,-1)
int | prevps = -1
float | fixtresh = 1.5
int | fixtimetresh = 100
| spdtresh = saccade_velocity_threshold
| accthresh = saccade_acceleration_threshold
| blinkthresh = blink_threshold
str | eventdetection = eventdetection
int | weightdist = 10
| eyetribe = EyeTribe(logfilename=logfile)
| samplerate = self.eyetribe._samplefreq
float | sampletime = 1000.0 * self.eyetribe._intsampletime
tuple | pxdsttresh = (noise, noise)
tuple | accuracy = ((calibresult['Ldeg'],calibresult['Ldeg']), (calibresult['Rdeg'],calibresult['Rdeg']))
| pxfixtresh = deg2pix(screendist, self.fixtresh, pixpercm)
tuple | pxaccuracy = ((deg2pix(screendist, self.accuracy[0][0], pixpercm),deg2pix(screendist, self.accuracy[0][1], pixpercm)), (deg2pix(screendist, self.accuracy[1][0], pixpercm),deg2pix(screendist, self.accuracy[1][1], pixpercm)))
| pxspdtresh = deg2pix(screendist, self.spdtresh/1000.0, pixpercm)
| pxacctresh = deg2pix(screendist, self.accthresh/1000.0, pixpercm)

## Detailed Description

    A class for EyeTribeTracker objects

## Constructor & Destructor Documentation

## ◆ __init__()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.__init__ | ( |  | self,
|  |  | display,
|  |  | logfile = settings.LOGFILE,
|  |  | eventdetection = settings.EVENTDETECTION,
|  |  | saccade_velocity_threshold = 35,
|  |  | saccade_acceleration_threshold = 9500,
|  |  | blink_threshold = settings.BLINKTHRESH,
|  | ** | args )

    Initializes the EyeTribeTracker object

            arguments
            display -- a pygaze.display.Display instance

            keyword arguments
            logfile -- logfile name (string value); note that this is the
                       name for the eye data log file (default = LOGFILE)

## Member Function Documentation

## ◆ calibrate()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.calibrate | ( |  | self | ) |

    Calibrates the eye tracking system

            arguments
            None

            keyword arguments
            None

            returns
            success -- returns True if calibration succeeded, or False if
                       not; in addition a calibration log is added to the
                       log file and some properties are updated (i.e. the
                       thresholds for detection algorithms)

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ close()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.close | ( |  | self | ) |

    Neatly close connection to tracker

            arguments
            None

            returns
            Nothing -- saves data and sets self.connected to False

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ connected()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.connected | ( |  | self | ) |

    Checks if the tracker is connected

            arguments
            None

            returns
            connected   -- True if connection is established, False if not;
                       sets self.connected to the same value

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ draw_calibration_target()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.draw_calibration_target | ( |  | self,
|  |  | x,
|  |  | y )

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ draw_drift_correction_target()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.draw_drift_correction_target | ( |  | self,
|  |  | x,
|  |  | y )

            Draws the drift-correction target.

            arguments

            x       --  The X coordinate
            y       --  The Y coordinate

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ drift_correction()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.drift_correction | ( |  | self,
|  |  | pos = None,
|  |  | fix_triggered = False )

    Performs a drift check

            arguments
            None

            keyword arguments
            pos         -- (x, y) position of the fixation dot or None for
                           a central fixation (default = None)
            fix_triggered   -- Boolean indicating if drift check should be
                           performed based on gaze position (fix_triggered
                           = True) or on spacepress (fix_triggered =
                           False) (default = False)

            returns
            checked     -- Boolaan indicating if drift check is ok (True)
                           or not (False); or calls self.calibrate if 'q'
                           or 'escape' is pressed

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ fix_triggered_drift_correction()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.fix_triggered_drift_correction | ( |  | self,
|  |  | pos = None,
|  |  | min_samples = 10,
|  |  | max_dev = 60,
|  |  | reset_threshold = 30 )

    Performs a fixation triggered drift correction by collecting
            a number of samples and calculating the average distance from the
            fixation position

            arguments
            None

            keyword arguments
            pos         -- (x, y) position of the fixation dot or None for
                           a central fixation (default = None)
            min_samples     -- minimal amount of samples after which an
                           average deviation is calculated (default = 10)
            max_dev     -- maximal deviation from fixation in pixels
                           (default = 60)
            reset_threshold -- if the horizontal or vertical distance in
                           pixels between two consecutive samples is
                           larger than this threshold, the sample
                           collection is reset (default = 30)

            returns
            checked     -- Boolaan indicating if drift check is ok (True)
                           or not (False); or calls self.calibrate if 'q'
                           or 'escape' is pressed

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ get_eyetracker_clock_async()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.get_eyetracker_clock_async | ( |  | self | ) |

    Not supported for EyeTribeTracker (yet)

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ is_valid_sample()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.is_valid_sample | ( |  | self,
|  |  | gazepos )

    Checks if the sample provided is valid, based on EyeTribe specific
            criteria (for internal use)

            arguments
            gazepos     --  a (x,y) gaze position tuple, as returned by
                            self.sample()

            returns
            valid       --  a Boolean: True on a valid sample, False on
                            an invalid sample

## ◆ log()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.log | ( |  | self,
|  |  | msg )

    Writes a message to the log file

            arguments
            ms      -- a string to include in the log file

            returns
            Nothing -- uses native log function of iViewX to include a line
                       in the log file

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ prepare_drift_correction()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.prepare_drift_correction | ( |  | self,
|  |  | pos )

    Not supported for EyeTribeTracker (yet)

## ◆ pupil_size()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.pupil_size | ( |  | self | ) |

    Return pupil size

            arguments
            None

            returns
            pupil size  -- returns pupil diameter for the eye that is currently
                       being tracked (as specified by self.eye_used) or -1
                       when no data is obtainable

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ sample()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.sample | ( |  | self | ) |

    Returns newest available gaze position

            arguments
            None

            returns
            sample  -- an (x,y) tuple or a (-1,-1) on an error

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ send_command()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.send_command | ( |  | self,
|  |  | cmd )

    Sends a command to the eye tracker

            arguments
            cmd     --  the command to be sent to the EyeTribe, which should
                        be a list with the following information:
                            [category, request, values]

            returns
            Nothing

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ set_detection_type()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.set_detection_type | ( |  | self,
|  |  | eventdetection )

    Set the event detection type to either PyGaze algorithms, or
            native algorithms as provided by the manufacturer (only if
            available: detection type will default to PyGaze if no native
            functions are available)

            arguments
            eventdetection  --  a string indicating which detection type
                            should be employed: either 'pygaze' for
                            PyGaze event detection algorithms or
                            'native' for manufacturers algorithms (only
                            if available; will default to 'pygaze' if no
                            native event detection is available)
            returns     --  detection type for saccades, fixations and
                            blinks in a tuple, e.g.
                            ('pygaze','native','native') when 'native'
                            was passed, but native detection was not
                            available for saccade detection

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ start_recording()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.start_recording | ( |  | self | ) |

    Starts recording eye position

            arguments
            None

            returns
            Nothing -- sets self.recording to True when recording is
                       successfully started

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ status_msg()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.status_msg | ( |  | self,
|  |  | msg )

    Not supported for EyeTribeTracker (yet)

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ stop_recording()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.stop_recording | ( |  | self | ) |

    Stop recording eye position

            arguments
            None

            returns
            Nothing -- sets self.recording to False when recording is
                       successfully started

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ wait_for_blink_end()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.wait_for_blink_end | ( |  | self | ) |

    Waits for a blink end and returns the blink ending time

            arguments
            None

            returns
            timestamp       --  blink ending time in milliseconds, as
                            measured from experiment begin time

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ wait_for_blink_start()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.wait_for_blink_start | ( |  | self | ) |

    Waits for a blink start and returns the blink starting time

            arguments
            None

            returns
            timestamp       --  blink starting time in milliseconds, as
                            measured from experiment begin time

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ wait_for_event()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.wait_for_event | ( |  | self,
|  |  | event )

    Waits for event

            arguments
            event       -- an integer event code, one of the following:
                        3 = STARTBLINK
                        4 = ENDBLINK
                        5 = STARTSACC
                        6 = ENDSACC
                        7 = STARTFIX
                        8 = ENDFIX

            returns
            outcome -- a self.wait_for_* method is called, depending on the
                       specified event; the return values of corresponding
                       method are returned

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ wait_for_fixation_end()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.wait_for_fixation_end | ( |  | self | ) |

    Returns time and gaze position when a fixation has ended;
            function assumes that a 'fixation' has ended when a deviation of
            more than self.pxfixtresh from the initial fixation position has
            been detected (self.pxfixtresh is created in self.calibration,
            based on self.fixtresh, a property defined in self.__init__)

            arguments
            None

            returns
            time, gazepos   -- time is the starting time in milliseconds (from
                           expstart), gazepos is a (x,y) gaze position
                           tuple of the position from which the fixation
                           was initiated

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ wait_for_fixation_start()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.wait_for_fixation_start | ( |  | self | ) |

    Returns starting time and position when a fixation is started;
            function assumes a 'fixation' has started when gaze position
            remains reasonably stable (i.e. when most deviant samples are
            within self.pxfixtresh) for five samples in a row (self.pxfixtresh
            is created in self.calibration, based on self.fixtresh, a property
            defined in self.__init__)

            arguments
            None

            returns
            time, gazepos   -- time is the starting time in milliseconds (from
                           expstart), gazepos is a (x,y) gaze position
                           tuple of the position from which the fixation
                           was initiated

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ wait_for_saccade_end()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.wait_for_saccade_end | ( |  | self | ) |

    Returns ending time, starting and end position when a saccade is
            ended; based on Dalmaijer et al. (2013) online saccade detection
            algorithm

            arguments
            None

            returns
            endtime, startpos, endpos   -- endtime in milliseconds (from
                                   expbegintime); startpos and endpos
                                   are (x,y) gaze position tuples

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ wait_for_saccade_start()

pygaze._eyetracker.libeyetribe.EyeTribeTracker.wait_for_saccade_start | ( |  | self | ) |

    Returns starting time and starting position when a saccade is
            started; based on Dalmaijer et al. (2013) online saccade detection
            algorithm

            arguments
            None

            returns
            endtime, startpos   -- endtime in milliseconds (from expbegintime);
                           startpos is an (x,y) gaze position tuple

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## Member Data Documentation

## ◆ accthresh

pygaze._eyetracker.libeyetribe.EyeTribeTracker.accthresh = saccade_acceleration_threshold

## ◆ accuracy

tuple pygaze._eyetracker.libeyetribe.EyeTribeTracker.accuracy = ((calibresult['Ldeg'],calibresult['Ldeg']), (calibresult['Rdeg'],calibresult['Rdeg']))

## ◆ blinkthresh

pygaze._eyetracker.libeyetribe.EyeTribeTracker.blinkthresh = blink_threshold

## ◆ disp

pygaze._eyetracker.libeyetribe.EyeTribeTracker.disp = display

## ◆ dispsize

pygaze._eyetracker.libeyetribe.EyeTribeTracker.dispsize = settings.DISPSIZE

## ◆ errdist

int pygaze._eyetracker.libeyetribe.EyeTribeTracker.errdist = 2

## ◆ errorbeep

pygaze._eyetracker.libeyetribe.EyeTribeTracker.errorbeep = Sound(osc='saw',freq=100, length=100)

## ◆ eventdetection

pygaze._eyetracker.libeyetribe.EyeTribeTracker.eventdetection = eventdetection

## ◆ eyetribe

pygaze._eyetracker.libeyetribe.EyeTribeTracker.eyetribe = EyeTribe(logfilename=logfile)

## ◆ fixtimetresh

int pygaze._eyetracker.libeyetribe.EyeTribeTracker.fixtimetresh = 100

## ◆ fixtresh

pygaze._eyetracker.libeyetribe.EyeTribeTracker.fixtresh = 1.5

## ◆ kb

pygaze._eyetracker.libeyetribe.EyeTribeTracker.kb = Keyboard(keylist=['space', 'escape', 'q'], timeout=1)

## ◆ maxtries

int pygaze._eyetracker.libeyetribe.EyeTribeTracker.maxtries = 100

## ◆ outputfile

pygaze._eyetracker.libeyetribe.EyeTribeTracker.outputfile = logfile

## ◆ prevps

int pygaze._eyetracker.libeyetribe.EyeTribeTracker.prevps = -1

## ◆ prevsample

tuple pygaze._eyetracker.libeyetribe.EyeTribeTracker.prevsample = (-1,-1)

## ◆ pxacctresh

pygaze._eyetracker.libeyetribe.EyeTribeTracker.pxacctresh = deg2pix(screendist, self.accthresh/1000.0, pixpercm)

## ◆ pxaccuracy

tuple pygaze._eyetracker.libeyetribe.EyeTribeTracker.pxaccuracy = ((deg2pix(screendist, self.accuracy[0][0], pixpercm),deg2pix(screendist, self.accuracy[0][1], pixpercm)), (deg2pix(screendist, self.accuracy[1][0], pixpercm),deg2pix(screendist, self.accuracy[1][1], pixpercm)))

## ◆ pxdsttresh

tuple pygaze._eyetracker.libeyetribe.EyeTribeTracker.pxdsttresh = (noise, noise)

## ◆ pxerrdist

int pygaze._eyetracker.libeyetribe.EyeTribeTracker.pxerrdist = 30

## ◆ pxfixtresh

pygaze._eyetracker.libeyetribe.EyeTribeTracker.pxfixtresh = deg2pix(screendist, self.fixtresh, pixpercm)

## ◆ pxspdtresh

pygaze._eyetracker.libeyetribe.EyeTribeTracker.pxspdtresh = deg2pix(screendist, self.spdtresh/1000.0, pixpercm)

## ◆ recording

bool pygaze._eyetracker.libeyetribe.EyeTribeTracker.recording = False

## ◆ samplerate

pygaze._eyetracker.libeyetribe.EyeTribeTracker.samplerate = self.eyetribe._samplefreq

## ◆ sampletime

pygaze._eyetracker.libeyetribe.EyeTribeTracker.sampletime = 1000.0 * self.eyetribe._intsampletime

## ◆ screen

pygaze._eyetracker.libeyetribe.EyeTribeTracker.screen = Screen()

## ◆ screensize

pygaze._eyetracker.libeyetribe.EyeTribeTracker.screensize = settings.SCREENSIZE

## ◆ spdtresh

pygaze._eyetracker.libeyetribe.EyeTribeTracker.spdtresh = saccade_velocity_threshold

## ◆ weightdist

int pygaze._eyetracker.libeyetribe.EyeTribeTracker.weightdist = 10

The documentation for this class was generated from the following file:

- C:/Users/lurax/eyetrackingTobii/pygaze/_eyetracker/libeyetribe.py