Eyetracker
 
Loading...
Searching...
No Matches
pygaze._eyetracker.pytribe.EyeTribe Class Reference

Public Member Functions

 __init__ (self, logfilename='default', host='localhost', port=6555)
 
 start_recording (self)
 
 stop_recording (self)
 
 log_message (self, message)
 
 sample (self)
 
 pupil_size (self)
 
 close (self)
 

Public Attributes

 calibration = calibration(self._connection)
 

Protected Member Functions

 _pause_sample_processing (self)
 
 _unpause_sample_processing (self)
 
 _heartbeater (self, heartbeatinterval)
 
 _stream_samples (self, queue)
 
 _process_samples (self, queue)
 
 _log_sample (self, sample)
 
 _log_header (self)
 

Protected Attributes

 _logfile = codecs.open('%s.tsv' % (logfilename), 'w', u'utf-8')
 
str _separator = u'\t'
 
 _queue = Queue()
 
 _connection = connection(host=host, port=port)
 
 _tracker = tracker(self._connection)
 
 _heartbeat = heartbeat(self._connection)
 
 _lock = Lock()
 
bool _beating = True
 
float _heartbeatinterval = self._tracker.get_heartbeatinterval() / 1000.0
 
 _hbthread = Thread(target=self._heartbeater, args=[self._heartbeatinterval])
 
bool _streaming = True
 
 _samplefreq = self._tracker.get_framerate()
 
float _intsampletime = 1.0 / self._samplefreq
 
 _clockdiff = None
 
 _newestframe = self._tracker.get_frame()
 
 _ssthread = Thread(target=self._stream_samples, args=[self._queue])
 
bool _processing = True
 
bool _processing_paused = False
 
bool _logdata = False
 
 _currentsample = copy.deepcopy(self._newestframe)
 
 _dpthread = Thread(target=self._process_samples, args=[self._queue])
 
bool _firstlog = False
 

Detailed Description

class for eye tracking and data collection using an EyeTribe tracker

Constructor & Destructor Documentation

◆ __init__()

pygaze._eyetracker.pytribe.EyeTribe.__init__ ( self,
logfilename = 'default',
host = 'localhost',
port = 6555 )
Initializes an EyeTribe instance

        keyword arguments

        logfilename --  string indicating the log file name, including
                        a full path to it's location and an extension
                        (default = 'default.txt')

Member Function Documentation

◆ _heartbeater()

pygaze._eyetracker.pytribe.EyeTribe._heartbeater ( self,
heartbeatinterval )
protected
Continuously sends heartbeats to the tracker, to let it know the
        connection is still alive (it seems to think we could die any
        moment now, and is very keen on reassurance of our good health;
        almost like my grandparents...)

        arguments

        heartbeatinterval   --  float indicating the heartbeatinterval in
                            seconds; note that this is different from
                            the value that the EyeTribe tracker reports:
                            that value is in milliseconds and should be
                            recalculated to seconds here!

◆ _log_header()

pygaze._eyetracker.pytribe.EyeTribe._log_header ( self)
protected
Logs a header to the data file

◆ _log_sample()

pygaze._eyetracker.pytribe.EyeTribe._log_sample ( self,
sample )
protected
Writes a sample to the log file

        arguments

        sample      --  a sample dict, as is returned by
                        tracker.get_frame

◆ _pause_sample_processing()

pygaze._eyetracker.pytribe.EyeTribe._pause_sample_processing ( self)
protected
Halts the processing of samples. Make sure to call this when
        you calibrate the tracker.

◆ _process_samples()

pygaze._eyetracker.pytribe.EyeTribe._process_samples ( self,
queue )
protected
Continuously processes samples, updating the most recent sample
        and writing data to a the log file when self._logdata is set to True

        arguments

        queue       --  a multithreading.Queue instance, to read samples
                        from

◆ _stream_samples()

pygaze._eyetracker.pytribe.EyeTribe._stream_samples ( self,
queue )
protected
Continuously polls the device, and puts all new samples in a
        Queue instance

        arguments

        queue       --  a multithreading.Queue instance, to put samples
                        into

◆ _unpause_sample_processing()

pygaze._eyetracker.pytribe.EyeTribe._unpause_sample_processing ( self)
protected
Continues the processing of samples. Make sure to call this when
        you are done calibrating the tracker.

◆ close()

pygaze._eyetracker.pytribe.EyeTribe.close ( self)
Stops all data streaming, and closes both the connection to the
        tracker and the logfile

◆ log_message()

pygaze._eyetracker.pytribe.EyeTribe.log_message ( self,
message )
Logs a message to the logfile, time locked to the most recent
        sample

◆ pupil_size()

pygaze._eyetracker.pytribe.EyeTribe.pupil_size ( self)
Returns the most recent pupil size sample (an average of the size
        of both pupils)

        arguments

        None

        returns

        pupsize --  a float indicating the pupil size (in arbitrary units)

◆ sample()

pygaze._eyetracker.pytribe.EyeTribe.sample ( self)
Returns the most recent point of regard (=gaze location on screen)
        coordinates (smoothed signal)

        arguments

        None

        returns

        gaze        --  a (x,y) tuple indicating the point of regard

◆ start_recording()

pygaze._eyetracker.pytribe.EyeTribe.start_recording ( self)
Starts data recording

◆ stop_recording()

pygaze._eyetracker.pytribe.EyeTribe.stop_recording ( self)
Stops data recording

Member Data Documentation

◆ _beating

bool pygaze._eyetracker.pytribe.EyeTribe._beating = True
protected

◆ _clockdiff

pygaze._eyetracker.pytribe.EyeTribe._clockdiff = None
protected

◆ _connection

pygaze._eyetracker.pytribe.EyeTribe._connection = connection(host=host, port=port)
protected

◆ _currentsample

pygaze._eyetracker.pytribe.EyeTribe._currentsample = copy.deepcopy(self._newestframe)
protected

◆ _dpthread

pygaze._eyetracker.pytribe.EyeTribe._dpthread = Thread(target=self._process_samples, args=[self._queue])
protected

◆ _firstlog

bool pygaze._eyetracker.pytribe.EyeTribe._firstlog = False
protected

◆ _hbthread

pygaze._eyetracker.pytribe.EyeTribe._hbthread = Thread(target=self._heartbeater, args=[self._heartbeatinterval])
protected

◆ _heartbeat

pygaze._eyetracker.pytribe.EyeTribe._heartbeat = heartbeat(self._connection)
protected

◆ _heartbeatinterval

float pygaze._eyetracker.pytribe.EyeTribe._heartbeatinterval = self._tracker.get_heartbeatinterval() / 1000.0
protected

◆ _intsampletime

float pygaze._eyetracker.pytribe.EyeTribe._intsampletime = 1.0 / self._samplefreq
protected

◆ _lock

pygaze._eyetracker.pytribe.EyeTribe._lock = Lock()
protected

◆ _logdata

bool pygaze._eyetracker.pytribe.EyeTribe._logdata = False
protected

◆ _logfile

pygaze._eyetracker.pytribe.EyeTribe._logfile = codecs.open('%s.tsv' % (logfilename), 'w', u'utf-8')
protected

◆ _newestframe

pygaze._eyetracker.pytribe.EyeTribe._newestframe = self._tracker.get_frame()
protected

◆ _processing

bool pygaze._eyetracker.pytribe.EyeTribe._processing = True
protected

◆ _processing_paused

bool pygaze._eyetracker.pytribe.EyeTribe._processing_paused = False
protected

◆ _queue

pygaze._eyetracker.pytribe.EyeTribe._queue = Queue()
protected

◆ _samplefreq

pygaze._eyetracker.pytribe.EyeTribe._samplefreq = self._tracker.get_framerate()
protected

◆ _separator

str pygaze._eyetracker.pytribe.EyeTribe._separator = u'\t'
protected

◆ _ssthread

pygaze._eyetracker.pytribe.EyeTribe._ssthread = Thread(target=self._stream_samples, args=[self._queue])
protected

◆ _streaming

bool pygaze._eyetracker.pytribe.EyeTribe._streaming = True
protected

◆ _tracker

pygaze._eyetracker.pytribe.EyeTribe._tracker = tracker(self._connection)
protected

◆ calibration

pygaze._eyetracker.pytribe.EyeTribe.calibration = calibration(self._connection)

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