Eyetracker |

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

## 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, calibrate=True, validate=True)
| close (self)
| connected (self)
| drift_correction (self, pos=None, fix_triggered=False)
| fix_triggered_drift_correction (self, pos=None, min_samples=10, max_dev=60, reset_threshold=30)
| get_eyetracker_clock_async (self)
| log (self, msg)
| log_var (self, var, val)
| prepare_backdrop (self)
| prepare_drift_correction (self, pos)
| pupil_size (self)
| sample (self)
| send_command (self, cmd)
| set_backdrop (self)
| set_eye_used (self)
| 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)
| draw_drift_correction_target (self, x, y)
| draw_calibration_target (self, x, y)
| 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
| screendist = settings.SCREENDIST
tuple | pixpercm = (self.dispsize[0]/float(self.screensize[0]) + self.dispsize[1]/float(self.screensize[1])) / 2.0
| kb = Keyboard(keylist=['space', 'escape', 'q'], timeout=1)
| errorbeep = Sound(osc='saw',freq=100, length=100)
| outputfile = logfile
str | description = "experiment"
str | participant = "participant"
bool | recording = False
int | eye_used = 0
int | left_eye = 0
int | right_eye = 1
int | binocular = 2
int | errdist = 2
| pxerrdist = deg2pix(self.screendist, self.errdist, self.pixpercm)
int | maxtries = 100
tuple | prevsample = (-1,-1)
int | nvalsamples = 1000
float | fixtresh = 1.5
int | fixtimetresh = 100
| spdtresh = saccade_velocity_threshold
| accthresh = saccade_acceleration_threshold
| blinkthresh = blink_threshold
str | eventdetection = eventdetection
int | weightdist = 10
| controller = TobiiController(display)
list | pxaccuracy = [(numpy.mean(lxacc), numpy.mean(lyacc)), (numpy.mean(rxacc), numpy.mean(ryacc))]
tuple | pxdsttresh = (XRMS, YRMS)
| sampletime = numpy.mean(ist)
| samplerate = int(1000.0 / self.sampletime)
| pxfixtresh = deg2pix(self.screendist, self.fixtresh, self.pixpercm)
| pxspdtresh = deg2pix(self.screendist, self.spdtresh/1000.0, self.pixpercm)
| pxacctresh = deg2pix(self.screendist, self.accthresh/1000.0, self.pixpercm)
Public Attributes inherited from pygaze._eyetracker.baseeyetracker.BaseEyeTracker
| draw_calibration_target = func
| draw_drift_correction_target = func

## Detailed Description

    A class for Tobii EyeTracker objects

## Constructor & Destructor Documentation

## ◆ __init__()

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

    Initializes a TobiiTracker instance

            arguments
            display --  a pygaze.display.Display instance

            keyword arguments
            None

## Member Function Documentation

## ◆ calibrate()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.calibrate | ( |  | self,
|  |  | calibrate = True,
|  |  | validate = True )

    Calibrates the eye tracking system

            arguments
            None

            keyword arguments
            calibrate   --  Boolean indicating if calibration should be
                        performed (default = True)
            validate    --  Boolean indicating if validation should be performed
                        (default = True)

            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.libtobiilegacy.TobiiTracker.close | ( |  | self | ) |

    Neatly close connection to tracker

            arguments
            None

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

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ connected()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.connected | ( |  | self | ) |

    Checks if the tracker is connected

            arguments
            None

            returns
            connected   --  True if connection is established, False if not

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ drift_correction()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.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.libtobiilegacy.TobiiTracker.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.libtobiilegacy.TobiiTracker.get_eyetracker_clock_async | ( |  | self | ) |

    Retrieve difference between tracker time and experiment time

            arguments
            None

            keyword arguments
            None

            returns
            timediff    --  tracker time minus experiment time

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ is_valid_sample()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.is_valid_sample | ( |  | self,
|  |  | gazepos )

    Checks if the sample provided is valid, based on Tobii 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.libtobiilegacy.TobiiTracker.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.

## ◆ log_var()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.log_var | ( |  | self,
|  |  | var,
|  |  | val )

    Writes a variable to the log file

            arguments
            var     -- variable name
            val     -- variable value

            returns
            Nothing -- uses native log function of iViewX to include a line
                       in the log file in a "var NAME VALUE" layout

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ prepare_backdrop()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.prepare_backdrop | ( |  | self | ) |

    Not supported for TobiiTracker (yet)

## ◆ prepare_drift_correction()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.prepare_drift_correction | ( |  | self,
|  |  | pos )

    Not supported for TobiiTracker (yet)

## ◆ pupil_size()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.pupil_size | ( |  | self | ) |

    Returns newest available pupil size

            arguments
            None

            returns
            pupilsize   --  a float or -1 on an error

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ sample()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.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.libtobiilegacy.TobiiTracker.send_command | ( |  | self,
|  |  | cmd )

    Not supported for TobiiTracker (yet)

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ set_backdrop()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.set_backdrop | ( |  | self | ) |

    Not supported for TobiiTracker (yet)

## ◆ set_detection_type()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.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.

## ◆ set_eye_used()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.set_eye_used | ( |  | self | ) |

    Logs the eye_used variable, based on which eye was specified
            (if both eyes are being tracked, the left eye is used)

            arguments
            None

            returns
            Nothing -- logs which eye is used by calling self.log_var, e.g.
                       self.log_var("eye_used", "right")

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ start_recording()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.start_recording | ( |  | self | ) |

    Starts recording eye position

            arguments
            None

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

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ status_msg()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.status_msg | ( |  | self,
|  |  | msg )

    Not supported for TobiiTracker (yet)

Reimplemented from pygaze._eyetracker.baseeyetracker.BaseEyeTracker.

## ◆ stop_recording()

pygaze._eyetracker.libtobiilegacy.TobiiTracker.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.libtobiilegacy.TobiiTracker.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.libtobiilegacy.TobiiTracker.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.libtobiilegacy.TobiiTracker.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.libtobiilegacy.TobiiTracker.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.libtobiilegacy.TobiiTracker.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.libtobiilegacy.TobiiTracker.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.libtobiilegacy.TobiiTracker.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.libtobiilegacy.TobiiTracker.accthresh = saccade_acceleration_threshold

## ◆ binocular

int pygaze._eyetracker.libtobiilegacy.TobiiTracker.binocular = 2

## ◆ blinkthresh

pygaze._eyetracker.libtobiilegacy.TobiiTracker.blinkthresh = blink_threshold

## ◆ controller

pygaze._eyetracker.libtobiilegacy.TobiiTracker.controller = TobiiController(display)

## ◆ description

str pygaze._eyetracker.libtobiilegacy.TobiiTracker.description = "experiment"

## ◆ disp

pygaze._eyetracker.libtobiilegacy.TobiiTracker.disp = display

## ◆ dispsize

pygaze._eyetracker.libtobiilegacy.TobiiTracker.dispsize = settings.DISPSIZE

## ◆ errdist

int pygaze._eyetracker.libtobiilegacy.TobiiTracker.errdist = 2

## ◆ errorbeep

pygaze._eyetracker.libtobiilegacy.TobiiTracker.errorbeep = Sound(osc='saw',freq=100, length=100)

## ◆ eventdetection

pygaze._eyetracker.libtobiilegacy.TobiiTracker.eventdetection = eventdetection

## ◆ eye_used

int pygaze._eyetracker.libtobiilegacy.TobiiTracker.eye_used = 0

## ◆ fixtimetresh

int pygaze._eyetracker.libtobiilegacy.TobiiTracker.fixtimetresh = 100

## ◆ fixtresh

pygaze._eyetracker.libtobiilegacy.TobiiTracker.fixtresh = 1.5

## ◆ kb

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

## ◆ left_eye

int pygaze._eyetracker.libtobiilegacy.TobiiTracker.left_eye = 0

## ◆ maxtries

int pygaze._eyetracker.libtobiilegacy.TobiiTracker.maxtries = 100

## ◆ nvalsamples

pygaze._eyetracker.libtobiilegacy.TobiiTracker.nvalsamples = 1000

## ◆ outputfile

pygaze._eyetracker.libtobiilegacy.TobiiTracker.outputfile = logfile

## ◆ participant

str pygaze._eyetracker.libtobiilegacy.TobiiTracker.participant = "participant"

## ◆ pixpercm

tuple pygaze._eyetracker.libtobiilegacy.TobiiTracker.pixpercm = (self.dispsize[0]/float(self.screensize[0]) + self.dispsize[1]/float(self.screensize[1])) / 2.0

## ◆ prevsample

tuple pygaze._eyetracker.libtobiilegacy.TobiiTracker.prevsample = (-1,-1)

## ◆ pxacctresh

pygaze._eyetracker.libtobiilegacy.TobiiTracker.pxacctresh = deg2pix(self.screendist, self.accthresh/1000.0, self.pixpercm)

## ◆ pxaccuracy

list pygaze._eyetracker.libtobiilegacy.TobiiTracker.pxaccuracy = [(numpy.mean(lxacc), numpy.mean(lyacc)), (numpy.mean(rxacc), numpy.mean(ryacc))]

## ◆ pxdsttresh

tuple pygaze._eyetracker.libtobiilegacy.TobiiTracker.pxdsttresh = (XRMS, YRMS)

## ◆ pxerrdist

pygaze._eyetracker.libtobiilegacy.TobiiTracker.pxerrdist = deg2pix(self.screendist, self.errdist, self.pixpercm)

## ◆ pxfixtresh

pygaze._eyetracker.libtobiilegacy.TobiiTracker.pxfixtresh = deg2pix(self.screendist, self.fixtresh, self.pixpercm)

## ◆ pxspdtresh

pygaze._eyetracker.libtobiilegacy.TobiiTracker.pxspdtresh = deg2pix(self.screendist, self.spdtresh/1000.0, self.pixpercm)

## ◆ recording

bool pygaze._eyetracker.libtobiilegacy.TobiiTracker.recording = False

## ◆ right_eye

int pygaze._eyetracker.libtobiilegacy.TobiiTracker.right_eye = 1

## ◆ samplerate

pygaze._eyetracker.libtobiilegacy.TobiiTracker.samplerate = int(1000.0 / self.sampletime)

## ◆ sampletime

pygaze._eyetracker.libtobiilegacy.TobiiTracker.sampletime = numpy.mean(ist)

## ◆ screen

pygaze._eyetracker.libtobiilegacy.TobiiTracker.screen = Screen()

## ◆ screendist

pygaze._eyetracker.libtobiilegacy.TobiiTracker.screendist = settings.SCREENDIST

## ◆ screensize

pygaze._eyetracker.libtobiilegacy.TobiiTracker.screensize = settings.SCREENSIZE

## ◆ spdtresh

pygaze._eyetracker.libtobiilegacy.TobiiTracker.spdtresh = saccade_velocity_threshold

## ◆ weightdist

int pygaze._eyetracker.libtobiilegacy.TobiiTracker.weightdist = 10

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

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