def __init__(self, win, io_config="eyelink1000.yaml", enabled=True): """Initialization of class with address required :param str msg: Marker/message to be sent to tracker """ #Populate defaults self.enabled = enabled self.io_config = io_config self.win = win self.eyetracker = False self.io = False #Initialize eyetracker if enabled (via enabled) if self.enabled == True: from psychopy.iohub import EventConstants, ioHubConnection, load, Loader #Load the specified iohub configuration file converting it to a python dict. io_config_data = load(file(self.io_config, 'r'), Loader=Loader) #Create an ioHubConnection instance, which starts the ioHubProcess, and informs it of the requested devices and their configurations. self.io = ioHubConnection(io_config_data) #Create a link to the tracker via iohub if self.io.getDevice('tracker'): self.eyetracker = self.io.getDevice('tracker')
# Load the specified iohub configuration file # converting it to a python dict. # io_config = load(file('./SRR_eyelink_std.yaml', 'r'), Loader=Loader) # Add / Update the session code to be unique. Here we use the psychopy # getDateStr() function for session code generation # session_info = io_config.get('data_store').get('session_info') session_info.update(code="S_%s" % (getDateStr())) # Create an ioHubConnection instance, which starts the ioHubProcess, and # informs it of the requested devices and their configurations. # io = ioHubConnection(io_config) keyboard = io.devices.keyboard eyetracker = io.devices.tracker # print(io.getProcessAffinity()) # Start by running the eye tracker default setup procedure. # The details of the setup procedure (calibration, validation, etc) # are unique to each implementation of the Common Eye Tracker Interface. # All have the common end goal of calibrating the eye tracking system # prior to data collection. # # Please see the eye tracker interface implementation details for the # hardware being used at: # http://www.isolver-solutions.com/iohubdocs/iohub/api_and_manual/device_details/eyetracker.html#eye-tracking-hardware-implementations #
# Ensure that relative paths start from the same directory as this script _thisDir = os.path.dirname(os.path.abspath(__file__)) os.chdir(_thisDir) # ==================================================================================== # EyeLink et = 1 # eye-tracking on or off if et: from psychopy.iohub import EventConstants,ioHubConnection,load,Loader # Load the specified iohub configuration file converting it to a python dict. io_config = load(file('SRR_eyelink_std.yaml','r'), Loader=Loader) #eyeLink = ("100.1.1.1") session_info = io_config.get('data_store').get('session_info') session_info.update(code="S_%s"%(getDateStr())) io = ioHubConnection(io_config) else: from psychopy.iohub import launchHubServer io = launchHubServer() kb_device = io.devices.keyboard if et: el = io.devices.tracker el.runSetupProcedure() # Store info about the experiment session expName = 'mcbsf' # from the Builder filename that created this script expInfo = {u'session': u'1', u'participant': u'1'} #dlg = gui.DlgFromDict(dictionary=expInfo, title=expName) # dialogue box #if dlg.OK == False: core.quit() # user pressed cancel expInfo['time'] = getDateStr('%Y-%m-%d_%H%M')