コード例 #1
0
ファイル: fixdur_tracker.py プロジェクト: behinger/fixdur
 def __init__(self, win, filename="TEST.EDF"):
     self.win = win
     EyeLink.__init__(self)
     self._filename = filename
     self.openDataFile(filename)
     #EyeLinkCustomDisplay.__init__(self)
     self._surfs = pygame.display.get_surface()
     pylink.flushGetkeyQueue()
     col = 128
     pylink.setCalibrationColors(
         (0, 0, 0),
         (col, col, col))  #Sets the calibration target and background color
     self.sendCommand("screen_pixel_coords =  0 0 %d %d" %
                      (self._surfs.get_width(), self._surfs.get_height()))
     self.sendMessage("DISPLAY_COORDS  0 0 %d %d" %
                      (self._surfs.get_width(), self._surfs.get_height()))
     self.sendCommand("select_parser_configuration 0")
     self.setFileEventFilter(
         "LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON")
     self.setFileSampleFilter("LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS")
     self.setLinkEventFilter("LEFT,RIGHT,FIXATION,SACCADE,BLINK,BUTTON")
     self.setLinkSampleFilter("LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS")
     self.sendCommand("button_function 5 'accept_target_fixation'")
     self.inner = visual.PatchStim(win,
                                   tex=None,
                                   mask='circle',
                                   units='pix',
                                   size=5,
                                   color=win.color)
     self.outer = visual.PatchStim(win,
                                   tex=None,
                                   mask='circle',
                                   units='pix',
                                   size=20,
                                   color=[128, 128, 128])
コード例 #2
0
    def __init__(self, display, filename="TEST.EDF"):
        EyeLink.__init__(self)
        self._disp = display
        self._filename = filename
        self.openDataFile(filename)

        self._surfs = [0,0,1920,1080]#self._disp.get_rect()
        pylink.flushGetkeyQueue()
        
        col = 128
        print "1"
        pylink.setCalibrationColors((0, 0, 0), (col, col, col)) #Sets the calibration target and background color
        print int(self._surfs[3]/300)
#        pylink.setTargetSize(int(self._surfs[2]/70), int(self._surfs[3]/300)) #select best size for calibration target
        print "12"
        pylink.setCalibrationSounds("off", "off", "off")
        pylink.setDriftCorrectSounds("off", "off", "off")

        self.sendCommand("screen_pixel_coords =  0 0 %d %d" % (self._surfs[2], self._surfs[3]))
        self.sendMessage("DISPLAY_COORDS  0 0 %d %d" % (self._surfs[2], self._surfs[3]))
        
        #self.sendMessage("heuristic_filter" % (self._surfs[2], self._surfs[3]))
        #assert self.getTrackerVersion() == 2
        self.sendCommand("select_parser_configuration 0")
        self.setFileEventFilter("LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON")
        self.setFileSampleFilter("LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS")
        self.setLinkEventFilter("LEFT,RIGHT,FIXATION,SACCADE,BLINK,BUTTON")
        self.setLinkSampleFilter("LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS")
        print "2"
        self.sendCommand("button_function 5 'accept_target_fixation'")
コード例 #3
0
ファイル: eyetracker.py プロジェクト: jooh/pylink-wrapper
 def _init_calibration(self):
     # Sets the calibration target and background color
     pylink.setCalibrationColors((0, 0, 0), (255, 255, 255))
     # select best size for calibration target
     pylink.setTargetSize(self.screenRect.width / 70,
                          self.screenRect.width / 300)
     pylink.setCalibrationSounds("off", "off", "off")
     pylink.setDriftCorrectSounds("off", "off", "off")
コード例 #4
0
 def setup_eyelink(self):
     
     '''Thank you very much
     
     '''
     # call for eyelink
     self.eyelink_tracker = pl.EyeLink("100.1.1.1")
     
     #parameters for eyelink
     self.monitor = monitors.Monitor('testMonitor')
     self.winSize = self.monitor.getSizePix()
     self.foreground = (250,250,250)
     self.background = (127,127,127)
     
     # create file
     self.edfFileName = "cbConfig" + str(self.subjectID)
     if len(self.edfFileName) > 8:
         self.edfFileName = self.edfFileName[0:8]
     pl.getEYELINK().openDataFile(self.edfFileName)
     pl.getEYELINK().setOfflineMode()
 
     #Eyelink - Gets the display surface and sends a mesage to EDF file;
     pl.getEYELINK().sendCommand("screen_pixel_coords =  0 0 %d %d"%(self.winSize[0]-1, self.winSize[1]-1))
     pl.getEYELINK().sendMessage("Resolution %d %d" %((self.winSize[0]-1, self.winSize[1]-1)))
     pl.getEYELINK().sendMessage("EyeToScreen %d" %(self.monitor.getDistance()))
     pl.getEYELINK().sendMessage("MonitorWidth %d" %(self.monitor.getWidth()))
 
     #EyeLink - Set data file contents
     pl.getEYELINK().sendCommand("file_sample_data  = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS,HTARGET,INPUT")
     pl.getEYELINK().sendCommand("link_sample_data  = LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS,HTARGET,INPUT")
 
     #EyeLink - Set Filter contents
     pl.getEYELINK().sendCommand("file_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON,INPUT")
     pl.getEYELINK().sendCommand("link_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,BUTTON,INPUT")
 
     #EyeLink - Set Calibration Environment
     pl.setCalibrationColors(self.foreground, self.background);  	#Sets the calibration target and background color  - background color should match testing background        
     
     pl.flushGetkeyQueue()
     pl.getEYELINK().setOfflineMode()
     winX = int(self.winSize[0])
     winY = int(self.winSize[1])
     pl.openGraphics((winX,winY),32)
     pl.getEYELINK().doTrackerSetup()
     pl.closeGraphics()
     pl.setCalibrationSounds("", "", "");
     pl.setDriftCorrectSounds("", "off", "off");
     
     # close configuration file
     event.clearEvents()
     pl.getEYELINK().closeDataFile()
     transferFileName = self.edfFileName + '.edf' # fileName
     pl.getEYELINK().receiveDataFile(self.edfFileName, transferFileName)
コード例 #5
0
 def eyeTrkCalib(self, colordepth=32):
     """
     callibration. not used?
     @param colordepth - color depth of display (why?)
     """
     sp = self.sp
     pl.openGraphics(sp, colordepth)
     pl.setCalibrationColors((255, 255, 255), (0, 0, 0))
     pl.setTargetSize(int(sp[0] / 70), int(sp[1] / 300))
     pl.setCalibrationSounds("", "", "")
     pl.setDriftCorrectSounds("", "off", "off")
     self.el.doTrackerSetup()
     pl.closeGraphics()
コード例 #6
0
ファイル: eyelinkdep.py プロジェクト: jooh/py-expcontrol
 def calibrate(self):
     '''
     Open a pygame window, run a calibration routine and close it.
     '''
     # start the main calibration/validation interface
     pylink.openGraphics(self.size)
     # these commands cause a hard crash if sent before openGraphics
     pylink.setCalibrationColors(self.fgcolor, self.bgcolor)
     pylink.setTargetSize(self.targetdiameter, self.targethole)
     self.tracker.doTrackerSetup()
     self.eyeused = self.tracker.eyeAvailable()
     pylink.closeGraphics()
     return
コード例 #7
0
 def eyeTrkCalib (el=el,dr=dr,cd=cd):
     # "opens the graphics if the display mode is not set"
     pl.openGraphics(dr,cd)
     pl.setCalibrationColors((255,255,255),(0,177,177))
     pl.setTargetSize(10, 5) 
     pl.setCalibrationSounds("","","")
     el.setCalibrationType('H3')
     pl.setDriftCorrectSounds("","off","off")
     el.disableAutoCalibration()
     el.doTrackerSetup()
     el.drawCalTarget(calTarg1)
     el.drawCalTarget(calTarg2)
     el.drawCalTarget(calTarg3)
     pl.closeGraphics()
     el.setOfflineMode()
コード例 #8
0
ファイル: mcbsf.py プロジェクト: egorananyev/mc
def eyeTrkCalib (el,dr,cd):
    # "opens the graphics if the display mode is not set"
    pl.openGraphics(dr,cd)
    pl.setCalibrationColors((255,255,255),(0,177,177))
    pl.setTargetSize(10, 5) 
    pl.setCalibrationSounds("","","")
    el.setCalibrationType('H3')
    pl.setDriftCorrectSounds("","off","off")
    el.disableAutoCalibration()
    el.doTrackerSetup()
    el.drawCalTarget(calTarg1)
    el.drawCalTarget(calTarg2)
    el.drawCalTarget(calTarg3)
    pl.closeGraphics()
    el.setOfflineMode()
コード例 #9
0
getEYELINK().setOfflineMode()
getEYELINK().sendCommand("screen_pixel_coords =  0 0 %d %d" % (w - 1, h - 1))
getEYELINK().sendMessage("DISPLAY_COORDS  0 0 %d %d" % (w - 1, h - 1))
if getEYELINK().getTrackerVersion() == 2:
    getEYELINK().sendCommand("select_parser_configuration 0")
else:
    getEYELINK().sendCommand("saccade_velocity_threshold = 35")
    getEYELINK().sendCommand("saccade_acceleration_threshold = 9500")
getEYELINK().setFileEventFilter(
    "LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON")
getEYELINK().setFileSampleFilter("LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS")
getEYELINK().setLinkEventFilter("LEFT,RIGHT,FIXATION,SACCADE,BLINK,BUTTON")
getEYELINK().setLinkSampleFilter("LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS")
getEYELINK().sendCommand("pupil_size_diameter = YES")
pylink.setCalibrationColors(
    (255, 255, 255),
    (0, 0, 0))  # Sets the calibration target and background color
pylink.setTargetSize(int(w / 70), int(w / 300))
if getEYELINK().isConnected() and not getEYELINK().breakPressed():
    print('连接成功')
    getEYELINK().doTrackerSetup()
    while True:
        try:
            error = getEYELINK().doDriftCorrect(w // 2, h // 2, 1, 1)
            if error != 27:
                break
            else:
                getEYELINK().doTrackerSetup()
        except:
            getEYELINK().doTrackerSetup()
else:
コード例 #10
0
ファイル: eyeTracker.py プロジェクト: hblumsack/WilsonLab
    def __init__(self, win, clock, sj = "TEST", autoCalibration=True, 
                 saccadeSensitivity = HIGH, calibrationType = 'HV9',
                 calibrationTargetColor = WHITE,
                 calibrationBgColor = BLACK, CalibrationSounds = False
                 ):
        '''
        win: psychopy visual window used for the experiment
 
        clock: psychopy time clock recording time for whole experiment
 
        sj: Subject identifier string (affects EDF filename)
 
        autoCalibration:
         True: enable auto-pacing during calibration
 
        saccadeSensitivity:
         HIGH: Pursuit and neurological work
         LOW:  Cognitive research
 
        calibrationType:
         H3: Horizontal 3-point
         HV3: 3-point calibration, poor linearization
         HV5: 5-point calibration, poor at corners
         HV9: 9-point calibration, best overall
 
        calibrationTargetColor and calibrationBgColor:
         RGB tuple, i.e., (255,0,0) for Red
         One of: BLACK, WHITE, GRAY
 
        calibrationSounds:
         True: enable feedback sounds when calibrating 
 
        '''
        self.edfFileName = str(sj)+".EDF"
        print(self.edfFileName)
        inf = info.RunTimeInfo("J","1",win, refreshTest=None, 
                             userProcsDetailed=False)
        self.screenSize = inf['windowSize_pix']
        self.units = inf['windowUnits']
        self.monitorName = inf['windowMonitor.name']
        monitor = monitors.Monitor(self.monitorName)
 
        print("Connecting to eyetracker.")
        self.tracker = pylink.EyeLink()
        self.timeCorrection = clock.getTime() - self.tracker.trackerTime()
        print("Loading custom graphics")
        genv = EyeLinkCoreGraphicsPsychopy(self.tracker, win, self.screenSize)
        self.tracker.openDataFile(self.edfFileName)
        pylink.flushGetkeyQueue();
        self.tracker.setOfflineMode();
        self.tracker.sendCommand("screen_pixel_coords =  0 0 %d %d"
                                    %( tuple(self.screenSize) ))
        self.tracker.setCalibrationType(calibrationType)
        self.tracker.sendMessage("DISPLAY_COORDS  0 0 %d %d"
                                    %( tuple(self.screenSize) ))
 
        eyelink_ver = self.tracker.getTrackerVersion()
        if eyelink_ver == 3:
            tvstr = self.tracker.getTrackerVersionString()
            vindex = tvstr.find("EYELINK CL")
            tracker_software_ver = int(float(tvstr[(vindex + len("EYELINK CL")):].strip()))
        else: tracker_software_ver = 0
        if eyelink_ver>=2:
            self.tracker.sendCommand("select_parser_configuration %d" %saccadeSensitivity)
        else:
            if saccadeSensitivity == HIGH:
                svt, sat = 22, 5000
            else: svt, sat = 30, 9500
            self.tracker.sendCommand("saccade_velocity_threshold = %d" %svt)
            self.tracker.sendCommand("saccade_acceleration_threshold = %d" %sat)
 
        if eyelink_ver == 2: #turn off scenelink camera stuff
            self.tracker.sendCommand("scene_camera_gazemap = NO")
 
        # set EDF file contents
        self.tracker.sendCommand("file_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON")
        if tracker_software_ver>=4:
            self.tracker.sendCommand("file_sample_data  = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS,HTARGET")
        else:
            self.tracker.sendCommand("file_sample_data  = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS")
        # set link data (used for gaze cursor)
        self.tracker.sendCommand("link_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,BUTTON")
        if tracker_software_ver>=4:
            self.tracker.sendCommand("link_sample_data  = LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS,HTARGET")
        else:
            self.tracker.sendCommand("link_sample_data  = LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS")
 
        #Set the calibration settings:
        pylink.setCalibrationColors( calibrationTargetColor, calibrationBgColor)
        if CalibrationSounds:
            pylink.setCalibrationSounds("", "", "")
            pylink.setDriftCorrectSounds("", "off", "off")
        else:
            pylink.setCalibrationSounds("off", "off", "off")
            pylink.setDriftCorrectSounds("off", "off", "off")
 
        if autoCalibration:
            self.tracker.enableAutoCalibration
        else: self.tracker.disableAutoCalibration
        win.flip()
        print("Opening graphics")
        pylink.openGraphicsEx(genv)
        print("Begining tracker setup")
        self.tracker.doTrackerSetup()
        win.flip()
コード例 #11
0
    def send_calibration_settings(self, settings=None):
        defaults = {
            'automatic_calibration_pacing': 1000,
            'background_color': (0, 0, 0),
            'calibration_area_proportion': (0.5, 0.5),
            'calibration_type': 'HV9',
            'elcl_configuration': 'BTABLER',
            'enable_automatic_calibration': 'YES',
            'error_sound': '',
            'foreground_color': (255, 255, 255),
            'good_sound': '',
            'preamble_text': None,
            'pupil_size_diameter': 'NO',
            'saccade_acceleration_threshold': 9500,
            'saccade_motion_threshold': 0.15,
            'saccade_pursuit_fixup': 60,
            'saccade_velocity_threshold': 30,
            'sample_rate': 1000,
            'target_sound': '',
            'validation_area_proportion': (0.5, 0.5),
        }

        if settings is None:
            settings = {}

        settings.update(defaults)

        self.send_command('elcl_select_configuration = %s' %
                          settings['elcl_configuration'])

        pl.setCalibrationColors(settings['foreground_color'],
                                settings['background_color'])
        pl.setCalibrationSounds(settings['target_sound'],
                                settings['good_sound'],
                                settings['error_sound'])

        if self.eye in ('LEFT', 'RIGHT'):
            self.send_command('active_eye = %s' % self.eye)

        self.send_command('automatic_calibration_pacing = %i' %
                          settings['automatic_calibration_pacing'])

        if self.eye == 'BOTH':
            self.send_command('binocular_enabled = YES')
        else:
            self.send_command('binocular_enabled = NO')

        self.send_command('calibration_area_proportion %f %f' %
                          settings['calibration_area_proportion'])

        self.send_command('calibration_type = %s' %
                          settings['calibration_type'])
        self.send_command('enable_automatic_calibration = %s' %
                          settings['enable_automatic_calibration'])
        if settings['preamble_text'] is not None:
            self.send_command('add_file_preamble_text %s' % '"' +
                              settings['preamble_text'] + '"')
        self.send_command('pupil_size_diameter = %s' %
                          settings['pupil_size_diameter'])
        self.send_command('saccade_acceleration_threshold = %i' %
                          settings['saccade_acceleration_threshold'])
        self.send_command('saccade_motion_threshold = %i' %
                          settings['saccade_motion_threshold'])
        self.send_command('saccade_pursuit_fixup = %i' %
                          settings['saccade_pursuit_fixup'])
        self.send_command('saccade_velocity_threshold = %i' %
                          settings['saccade_velocity_threshold'])
        self.send_command('sample_rate = %i' % settings['sample_rate'])
        self.send_command('validation_area_proportion %f %f' %
                          settings['validation_area_proportion'])
コード例 #12
0
    tracker_software_ver = int(
        float(tvstr[(vindex + len("EYELINK CL")):].strip()))
print('tracker version', eyelink_ver)
print('tracker software v', tracker_software_ver)

# set EDF file contents
pylink.getEYELINK().sendCommand(
    "file_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON")
if tracker_software_ver >= 4:
    pylink.getEYELINK().sendCommand(
        "file_sample_data  = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS,HTARGET")
else:
    pylink.getEYELINK().sendCommand(
        "file_sample_data  = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS")

pylink.setCalibrationColors((0, 0, 0), (255, 255, 255))
#Sets the calibration target and background color
pylink.setTargetSize(int(window_size[0] / 40), int(window_size[0] / 30))
#select best size for calibration target

pylink.beginRealTimeMode(0)
print('started real time mode')
pylink.getEYELINK().startRecording(1, 1, 0, 0)

core.wait(3)

pylink.endRealTimeMode()
pylink.getEYELINK().setOfflineMode()

win.close()
コード例 #13
0
ファイル: eye_tracker_test.py プロジェクト: jakobkolb/fMRI_FF
eyelink_ver = pylink.getEYELINK().getTrackerVersion()
if eyelink_ver == 3:
	tvstr = pylink.getEYELINK().getTrackerVersionString()
	vindex = tvstr.find("EYELINK CL")
	tracker_software_ver = int(float(tvstr[(vindex + len("EYELINK CL")):].strip()))
print 'tracker version', eyelink_ver
print 'tracker software v', tracker_software_ver

# set EDF file contents 
pylink.getEYELINK().sendCommand("file_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON")
if tracker_software_ver>=4:
	pylink.getEYELINK().sendCommand("file_sample_data  = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS,HTARGET")
else:
	pylink.getEYELINK().sendCommand("file_sample_data  = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS")

pylink.setCalibrationColors( (0, 0, 0),(255, 255, 255));  				#Sets the calibration target and background color
pylink.setTargetSize(int(window_size[0]/40), int(window_size[0]/30));	#select best size for calibration target
#-----------------------------------------------------------------------------

pylink.beginRealTimeMode(0)
print 'started real time mode'
pylink.getEYELINK().startRecording(1, 1, 0, 0)

core.wait(3)

pylink.endRealTimeMode()
pylink.getEYELINK().setOfflineMode()

win.close()

if pylink.getEYELINK() != None:
コード例 #14
0
    def __init__(self,
                 win,
                 clock,
                 sj="TEST",
                 autoCalibration=True,
                 saccadeSensitivity=HIGH,
                 calibrationType='HV9',
                 calibrationTargetColor=WHITE,
                 calibrationBgColor=BLACK,
                 CalibrationSounds=False):
        '''
        win: psychopy visual window used for the experiment
 
        clock: psychopy time clock recording time for whole experiment
 
        sj: Subject identifier string (affects EDF filename)
 
        autoCalibration:
         True: enable auto-pacing during calibration
 
        saccadeSensitivity:
         HIGH: Pursuit and neurological work
         LOW:  Cognitive research
 
        calibrationType:
         H3: Horizontal 3-point
         HV3: 3-point calibration, poor linearization
         HV5: 5-point calibration, poor at corners
         HV9: 9-point calibration, best overall
 
        calibrationTargetColor and calibrationBgColor:
         RGB tuple, i.e., (255,0,0) for Red
         One of: BLACK, WHITE, GRAY
 
        calibrationSounds:
         True: enable feedback sounds when calibrating 
 
        '''
        self.edfFileName = str(sj) + ".EDF"
        print(self.edfFileName)
        inf = info.RunTimeInfo("J",
                               "1",
                               win,
                               refreshTest=None,
                               userProcsDetailed=False)
        self.screenSize = inf['windowSize_pix']
        self.units = inf['windowUnits']
        self.monitorName = inf['windowMonitor.name']
        monitor = monitors.Monitor(self.monitorName)

        print("Connecting to eyetracker.")
        self.tracker = pylink.EyeLink()
        self.timeCorrection = clock.getTime() - self.tracker.trackerTime()
        print("Loading custom graphics")
        genv = EyeLinkCoreGraphicsPsychopy(self.tracker, win, self.screenSize)
        self.tracker.openDataFile(self.edfFileName)
        pylink.flushGetkeyQueue()
        self.tracker.setOfflineMode()
        self.tracker.sendCommand("screen_pixel_coords =  0 0 %d %d" %
                                 (tuple(self.screenSize)))
        self.tracker.setCalibrationType(calibrationType)
        self.tracker.sendMessage("DISPLAY_COORDS  0 0 %d %d" %
                                 (tuple(self.screenSize)))

        eyelink_ver = self.tracker.getTrackerVersion()
        if eyelink_ver == 3:
            tvstr = self.tracker.getTrackerVersionString()
            vindex = tvstr.find("EYELINK CL")
            tracker_software_ver = int(
                float(tvstr[(vindex + len("EYELINK CL")):].strip()))
        else:
            tracker_software_ver = 0
        if eyelink_ver >= 2:
            self.tracker.sendCommand("select_parser_configuration %d" %
                                     saccadeSensitivity)
        else:
            if saccadeSensitivity == HIGH:
                svt, sat = 22, 5000
            else:
                svt, sat = 30, 9500
            self.tracker.sendCommand("saccade_velocity_threshold = %d" % svt)
            self.tracker.sendCommand("saccade_acceleration_threshold = %d" %
                                     sat)

        if eyelink_ver == 2:  #turn off scenelink camera stuff
            self.tracker.sendCommand("scene_camera_gazemap = NO")

        # set EDF file contents
        self.tracker.sendCommand(
            "file_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON"
        )
        if tracker_software_ver >= 4:
            self.tracker.sendCommand(
                "file_sample_data  = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS,HTARGET"
            )
        else:
            self.tracker.sendCommand(
                "file_sample_data  = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS")
        # set link data (used for gaze cursor)
        self.tracker.sendCommand(
            "link_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,BUTTON")
        if tracker_software_ver >= 4:
            self.tracker.sendCommand(
                "link_sample_data  = LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS,HTARGET"
            )
        else:
            self.tracker.sendCommand(
                "link_sample_data  = LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS")

        #Set the calibration settings:
        pylink.setCalibrationColors(calibrationTargetColor, calibrationBgColor)
        if CalibrationSounds:
            pylink.setCalibrationSounds("", "", "")
            pylink.setDriftCorrectSounds("", "off", "off")
        else:
            pylink.setCalibrationSounds("off", "off", "off")
            pylink.setDriftCorrectSounds("off", "off", "off")

        if autoCalibration:
            self.tracker.enableAutoCalibration
        else:
            self.tracker.disableAutoCalibration
        win.flip()
        print("Opening graphics")
        pylink.openGraphicsEx(genv)
        print("Begining tracker setup")
        self.tracker.doTrackerSetup()
        win.flip()
コード例 #15
0
ファイル: EyeTracking.py プロジェクト: invibe/ANEMO
    def Start_exp(self):
        # ---------------------------------------------------
        # point de départ de l'expérience
        # ---------------------------------------------------
        pylink.openGraphics((self.screen_width_px, self.screen_height_px),
                            32)  # Initialise les graphiques
        self.eyelink.openDataFile(self.edfFileName)  # Ouvre le fichier EDF.

        # réinitialise les touches et réglez le mode de suivi en mode hors connexion.
        pylink.flushGetkeyQueue()
        self.eyelink.setOfflineMode()

        # Définit le système de coordonnées d'affichage et envoie un message à cet effet au fichier EDF;
        self.eyelink.sendCommand(
            "screen_pixel_coords =  0 0 %d %d" %
            (self.screen_width_px - 1, self.screen_height_px - 1))
        self.eyelink.sendMessage(
            "DISPLAY_COORDS  0 0 %d %d" %
            (self.screen_width_px - 1, self.screen_height_px - 1))

        # ---------------------------------------------------
        # NETOYER ??? version = 3
        # ---------------------------------------------------
        tracker_software_ver = 0
        eyelink_ver = self.eyelink.getTrackerVersion()

        if eyelink_ver == 3:
            tvstr = self.eyelink.getTrackerVersionString()
            vindex = tvstr.find("EYELINK CL")
            tracker_software_ver = int(
                float(tvstr[(vindex + len("EYELINK CL")):].strip()))

        if eyelink_ver >= 2:
            self.eyelink.sendCommand("select_parser_configuration 0")
            if eyelink_ver == 2:  # Éteignez les caméras scenelink
                self.eyelink.sendCommand("scene_camera_gazemap = NO")
        else:
            self.eyelink.sendCommand("saccade_velocity_threshold = 35")
            self.eyelink.sendCommand("saccade_acceleration_threshold = 9500")

        # Définir le contenu du fichier EDF
        self.eyelink.sendCommand(
            "file_event_filter = LEFT,RIGHT,FIXATION,SACCADE,BLINK,MESSAGE,BUTTON,INPUT"
        )
        if tracker_software_ver >= 4:
            self.eyelink.sendCommand(
                "file_sample_data  = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS,HTARGET,INPUT"
            )
        else:
            self.eyelink.sendCommand(
                "file_sample_data  = LEFT,RIGHT,GAZE,AREA,GAZERES,STATUS,INPUT"
            )

        # Définir les données du lien (utilisé pour le curseur du regard)
        self.eyelink.sendCommand(
            "link_event_filter = LEFT,RIGHT,FIXATION,FIXUPDATE,SACCADE,BLINK,BUTTON,INPUT"
        )
        if tracker_software_ver >= 4:
            self.eyelink.sendCommand(
                "link_sample_data  = LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS,HTARGET,INPUT"
            )
        else:
            self.eyelink.sendCommand(
                "link_sample_data  = LEFT,RIGHT,GAZE,GAZERES,AREA,STATUS,INPUT"
            )

        #############################
        # Calibration
        #############################
        pylink.setCalibrationColors(
            (255, 255, 255), (128, 128, 128)
        )  # Définit couleur de la cible d'étalonnage (blanc) et de l'arrière-plan (gris)
        pylink.setTargetSize(self.screen_width_px // 70,
                             self.screen_width_px //
                             300)  # Définit taille de la cible d'étalonnage
        pylink.setCalibrationSounds("", "", "")
        pylink.setDriftCorrectSounds("", "off", "off")