Exemplo n.º 1
0
    def _get_eyelink_clock_async(self):
        """
		Retrieve time differenece between tracker timestamps and 
		current clock time upheld in the pygaze environment.
		
		Note that this is not guaranteed to be a static time difference, the 
		clocks might run at different speeds. Therefore you should consider 
		running this function every time you utilize on this time difference.

		Returns:
		The tracker time minus the clock time
		"""
        return pylink.getEYELINK().trackerTime() - clock.time()
Exemplo n.º 2
0
    def _get_eyelink_clock_async(self):
        """
		Retrieve time differenece between tracker timestamps and 
		current clock time upheld in the pygaze environment.
		
		Note that this is not guaranteed to be a static time difference, the 
		clocks might run at different speeds. Therefore you should consider 
		running this function every time you utilize on this time difference.

		Returns:
		The tracker time minus the clock time
		"""
        return pylink.getEYELINK().trackerTime() - clock.time()
Exemplo n.º 3
0
	def wait_for_event(self, event):

		"""See pygaze._eyetracker.baseeyetracker.BaseEyeTracker"""

		if not self.recording:
			raise Exception(
				"Error in libeyelink.libeyelink.wait_for_event(): Recording "
				"was not started before collecting eyelink data!")

		if self.eye_used == None:
			self.set_eye_used()
		if self.eventdetection == 'native':
			# since the link buffer was not have been polled, old data has
			# accumulated in the buffer -- so ignore events that are old:
			t0 = clock.time() # time of call
			while True:
				d = pylink.getEYELINK().getNextData()
				if d == event:
					float_data  = pylink.getEYELINK().getFloatData()
					# corresponding clock_time
					tc = float_data.getTime() - self._get_eyelink_clock_async()
					if tc > t0:
						return tc, float_data

		if event == 5:
			outcome = self.wait_for_saccade_start()
		elif event == 6:
			outcome = self.wait_for_saccade_end()
		elif event == 7:
			outcome = self.wait_for_fixation_start()
		elif event == 8:
			outcome = self.wait_for_fixation_end()
		elif event == 3:
			outcome = self.wait_for_blink_start()
		elif event == 4:
			outcome = self.wait_for_blink_end()
		else:
			raise Exception(
				("Error in libeyelink.libeyelink.wait_for_event: eventcode %s "
				"is not supported") % event)
		return outcome
Exemplo n.º 4
0
    def wait_for_event(self, event):
        """See pygaze._eyetracker.baseeyetracker.BaseEyeTracker"""

        if not self.recording:
            raise Exception(
                "Error in libeyelink.libeyelink.wait_for_event(): Recording "
                "was not started before collecting eyelink data!")

        if self.eye_used == None:
            self.set_eye_used()
        if self.eventdetection == 'native':
            # since the link buffer was not have been polled, old data has
            # accumulated in the buffer -- so ignore events that are old:
            t0 = clock.time()  # time of call
            while True:
                d = pylink.getEYELINK().getNextData()
                if d == event:
                    float_data = pylink.getEYELINK().getFloatData()
                    # corresponding clock_time
                    tc = float_data.getTime() - self._get_eyelink_clock_async()
                    if tc > t0:
                        return tc, float_data

        if event == 5:
            outcome = self.wait_for_saccade_start()
        elif event == 6:
            outcome = self.wait_for_saccade_end()
        elif event == 7:
            outcome = self.wait_for_fixation_start()
        elif event == 8:
            outcome = self.wait_for_fixation_end()
        elif event == 3:
            outcome = self.wait_for_blink_start()
        elif event == 4:
            outcome = self.wait_for_blink_end()
        else:
            raise Exception(
                ("Error in libeyelink.libeyelink.wait_for_event: eventcode %s "
                 "is not supported") % event)
        return outcome