Пример #1
0
 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")
Пример #2
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()
Пример #3
0
 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
Пример #4
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()
Пример #5
0
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()
Пример #6
0
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:
    print('NO')
    getEYELINK().close()
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:
    # File transfer and cleanup!
Пример #8
0
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:
   # File transfer and cleanup!
Пример #9
0
    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")