예제 #1
0
 def hasEyeTrackerConnected(self):
     loop_count = 1
     eye_trackers = tobii.find_all_eyetrackers()
     while not eye_trackers and loop_count < 10:
         eye_trackers = tobii.find_all_eyetrackers()
         time.sleep(0.01)
         loop_count += 1
     return loop_count < 10
예제 #2
0
    def __init__(self, redo_calibration):
        super(TobiiCalibrator, self).__init__()

        self.timer = QBasicTimer()
        self.timer.start(50, self)
        self.step = 'not_started'
        self.initUI()

        self.redo_calibration = redo_calibration

        self.points = []
        for x in (0.1, 0.5, 0.9):
            for y in (0.1, 0.5, 0.9):
                self.points.append((x, y))

        shuffle(self.points)

        self.x = -1
        self.y = -1

        found_eyetrackers = tr.find_all_eyetrackers()
        self.eyetracker = found_eyetrackers[0]
        print("Address: " + self.eyetracker.address)
        print("Model: " + self.eyetracker.model)
        print("Name (It's OK if this is empty): " +
              self.eyetracker.device_name)
        print("Serial number: " + self.eyetracker.serial_number)

        # Coordinates of the display area in user coordinate system
        display_area = self.eyetracker.get_display_area()
        print(display_area.top_left)
        print(display_area.top_right)
        print(display_area.bottom_left)
        print(display_area.bottom_right)
예제 #3
0
    def __init__(self, serial_number=None, model=None):
        """
        """
        self._eyetracker = None
        retry_count = 10
        trackers = []
        while len(trackers) == 0 or retry_count > 0:
            trackers = tobii_research.find_all_eyetrackers()
            retry_count = retry_count - 1

        if len(trackers) == 0:
            raise RuntimeError('Could detect any Tobii devices.')

        if serial_number or model:
            for et in trackers:
                if serial_number == et.serial_number:
                    self._eyetracker = et
                    break
                if model == et.model:
                    self._eyetracker = et
                    break
        else:
            self._eyetracker = trackers[0]

        if self._eyetracker is None:
            raise RuntimeError('Could not connect to Tobii.')

        self._last_eye_data = None
        self._isRecording = False
예제 #4
0
    def CDPInitialisation(self):
        self.findtracker = tr.find_all_eyetrackers()
        if self.findtracker == ():
            print("Veuillez réassayer, aucun EyeTracker détecté")
            return ()
        self.filename = 0
        self.baseFilename = 0
        self.blackdisp = libscreen.Display(screennr=int(
            self.Config.getConfiguration('DISPLAY', 'screen_number')))

        self.disp = libscreen.Display(screennr=int(
            self.Config.getConfiguration('DISPLAY', 'screen_number')))
        self.blankscreen = libscreen.Screen()

        self.tracker = CDPProTracker(
            self.disp)  # création de l'objet eyeTracker
        self.kb = Keyboard(keylist=['space', 'escape', 'q'], timeout=1)
        self.Visu = CDPBaseVisualisation(self)
        self.RecSound = libsound.Sound(
            soundfile=self.Config.getSoundDirname('2.wav'))
        self.ErrSound = libsound.Sound(
            soundfile=self.Config.getSoundDirname('punition.wav'))
        self.nameInd = 0
        self.mydisp = [self.disp]

        print("Eyetracker connecté avec succès")
예제 #5
0
    def __init__(self, serial_number=None,  model=None):
        """
        """
        self._eyetracker = None
        retry_count = 10
        trackers = []
        while len(trackers)==0 or retry_count > 0:
            trackers = tobii_research.find_all_eyetrackers()
            retry_count = retry_count - 1

        if len(trackers)==0:
            raise RuntimeError('Could detect any Tobii devices.')
            
        if serial_number or model:
            for et in trackers:
                if serial_number == et.serial_number:
                    self._eyetracker = et
                    break
                if model == et.model:
                    self._eyetracker = et
                    break
        else:
            self._eyetracker = trackers[0]

        if self._eyetracker is None:
            raise RuntimeError('Could not connect to Tobii.')
        
        self._last_eye_data = None
        self._isRecording = False
예제 #6
0
    def __init__(self, win, id=0, filename="gaze_TOBII_output.tsv"):
        self.eyetracker_id = id
        self.win = win
        self.filename = filename
        self.numkey_dict = self._default_numkey_dict
        self.calibration_dot_size = self._default_calibration_dot_size[
            self.win.units]
        self.calibration_disc_size = self._default_calibration_disc_size[
            self.win.units]

        eyetrackers = tr.find_all_eyetrackers()

        if len(eyetrackers) == 0:
            raise RuntimeError("No Tobii eyetrackers")

        try:
            self.eyetracker = eyetrackers[self.eyetracker_id]
        except:
            raise ValueError(
                "Invalid eyetracker ID {}\n({} eyetrackers found)".format(
                    self.eyetracker_id, len(eyetrackers)))

        self.calibration = tr.ScreenBasedCalibration(self.eyetracker)
        self.update_calibration = self._update_calibration_auto
        self.gaze_data = []
예제 #7
0
    def activate(self):
        """Connects to specified eye tracker

        arguments
        eyetracker    --    key for the self.eyetracker dict under which the
                    eye tracker to which you want to connect is found

        keyword arguments
        None

        returns
        None        --    calls TobiiController.on_eyetracker_created, then
                    sets self.syncmanager
        """

        print("Connecting to: ", params.EYETRACKER_TYPE)
        if params.EYETRACKER_TYPE == "Tobii T120":
            while self.eyetracker is None:
                eyetrackers = tr.find_all_eyetrackers()
                for tracker in eyetrackers:
                    self.eyetrackers[tracker.model] = tracker
                self.eyetracker = self.eyetrackers.get(params.EYETRACKER_TYPE,
                                                       None)
        elif params.EYETRACKER_TYPE == "IS4_Large_Peripheral":
            print(os.path.join(sys.path[0]))
            subprocess.Popen(
                "application/backend/websocket_app/GazeServer.exe")
            self.websocket_client = EyetrackerWebsocketClient(self)
        else:
            print("Simulation")
            self.websocket_client = SimulationSocket(self)
        print("Connected to: ", params.EYETRACKER_TYPE)
예제 #8
0
    def __init__(self):
        super(Keyhole, self).__init__()
        self.qt_rects = []
        self._awaiting_choice = False
        self.win = wx.Frame(None, wx.ID_ANY, "Overlay", style=wx.BORDER_NONE|wx.STAY_ON_TOP|wx.TRANSPARENT_WINDOW)
        self.win.SetTransparent(100)
        self.overlay = wx.Panel(self.win, -1, style=wx.TRANSPARENT_WINDOW)
        #self.overlay.SetTransparent(100)
        self.overlay.SetBackgroundColour('red')

        # grab screen res
        self.width, self.height = wx.GetDisplaySize()

        # eye position
        self._eye_x = 0
        self._eye_y = 0

        # setup tracker
        self.t = tr.find_all_eyetrackers()[0]
        self.t.subscribe_to(tr.EYETRACKER_GAZE_DATA, self.gaze_data_callback)

        # listen for keyboard events
        self.listener = keyboard.Listener(
            on_press=self._on_press,
            on_release=self._on_release)
        self.listener.start()
        self.mouse = mouse.Controller()
예제 #9
0
    def __init__(self, win, id=0, filename='gaze_TOBII_output.tsv'):
        """Tobii controller for PsychoPy.

            tobii_research are required for this module.

        Args:
            win: psychopy.visual.Window object.
            id: the id of eyetracker.
            filename: the name of the data file.

        Attributes:
            shrink_speed: the shrinking speed of target in calibration.
                Defaults to 1.5.
            calibration_dot_size: the size of the central dot in the
                calibration target. Defaults to default_calibration_dot_size
                according to the units of self.win.
            calibration_dot_color: the color of the central dot in the
                calibration target. Defaults to grey.
            calibration_disc_size: the size of the disc in the
                calibration target. Defaults to default_calibration_disc_size
                according to the units of self.win.
            calibration_disc_color: the color of the disc in the
                calibration target. Defaults to deep blue.
            calibration_target_min: the minimum size of the calibration target.
                Defaults to 0.2.
            numkey_dict: keys used for calibration. Defaults to the number pad.
            update_calibration: the presentation of calibration target.
                Defaults to auto calibration.
        """
        self.eyetracker_id = id
        self.win = win
        self.filename = filename
        self._calibration_dot_size = default_calibration_dot_size[self.win.
                                                                  units]
        self._calibration_disc_size = default_calibration_disc_size[self.win.
                                                                    units]
        self.calibration_dot_size = self._calibration_dot_size
        self.calibration_disc_size = self._calibration_disc_size
        self.calibration_dot_color = self._calibration_dot_color
        self.calibration_disc_color = self._calibration_disc_color
        self.calibration_target_min = self._calibration_target_min

        eyetrackers = tr.find_all_eyetrackers()

        if len(eyetrackers) == 0:
            raise RuntimeError('No Tobii eyetrackers')

        try:
            self.eyetracker = eyetrackers[self.eyetracker_id]
        except:
            raise ValueError(
                'Invalid eyetracker ID {}\n({} eyetrackers found)'.format(
                    self.eyetracker_id, len(eyetrackers)))

        self.calibration = tr.ScreenBasedCalibration(self.eyetracker)
        self.update_calibration = self._update_calibration_auto
        self.gaze_data = []
예제 #10
0
 def __init__(self):
     res_x = 1920
     res_y = 1080
     # print(res_x, res_y)
     self.w = res_x
     self.h = res_y
     self.eye_tracker = tb.find_all_eyetrackers()[0]
     pygame.init()
     self.screen = pygame.display.set_mode((1920, 1080), FULLSCREEN)
예제 #11
0
def start_tracker():
    tracker = tr.find_all_eyetrackers()[0]
    if tracker:
        print("Successfully connected to eyetracker '{tracker_name}'".format(
            tracker_name=tracker.device_name))
    tracker.subscribe_to(tr.EYETRACKER_GAZE_DATA,
                         gaze_data_callback,
                         as_dictionary=True)
    input("PRESS ANY KEY TO EXIT SCRIPT.")
    tracker.unsubscribe_from(tr.EYETRACKER_GAZE_DATA, gaze_data_callback)
예제 #12
0
    def get_eye_tracker_controller():
        eye_trackers = find_all_eyetrackers()
        if len(eye_trackers) > 0:
            eye_tracker = eye_trackers[0]
            execute(eye_tracker)
            eye_tracker.set_display_area(DisplayArea(DISPLAY_AREA_CONFIG))
        else:
            eye_tracker = None

        return EyeTrackerController(eye_tracker=eye_tracker)
예제 #13
0
 def __init__(self, GameWindow, inputs):
     self.window = GameWindow
     self.window_size = Size(pyautogui.size().width,
                             pyautogui.size().height)
     self.inputs = inputs
     self.parser = Parser(inputs)
     self.tobii = tr.find_all_eyetrackers()[0]
     self.data = []
     self.plot_thread = PlotThread(self.window)
     self.plot_thread.signal.connect(self.on_plot)
     self.is_wandering = False
예제 #14
0
 def init_tracker(self):
     if 'eyetracker' not in props(self):
         found_eyetrackers = tr.find_all_eyetrackers()
         if found_eyetrackers:
             self.eyetracker = found_eyetrackers[0]
             self.eyetracker.subscribe_to(tr.EYETRACKER_GAZE_DATA, self.capture, as_dictionary=True)
         
             self.capture_up = True
             fps = 0.3
             # Clock.schedule_interval(self.capture, 1.0/fps)
         else:
             self.applog(self.get_local_str("_tobii_not_found"), WARNING)
def connect_to_tracker():
    global tracker
    trackers = tobii_research.find_all_eyetrackers()
    if trackers:
        tracker = trackers[0]
        license_file = QFileDialog.getOpenFileName(
            caption="Select Eye Tracker License")[0]
        print(license_file)
        with open(license_file, "rb") as f:
            license = f.read()
        tracker.apply_licenses(license)
        main.tracker_label.setText("Connected to eye tracker.")
예제 #16
0
    def init_eyetracker(self):
        """ Findes the eyetracker and returns it

        Returns:
            [type]: returns eyetracker
        """
        found_eyetrackers = tr.find_all_eyetrackers()
        self.eyetracker = found_eyetrackers[0]
        print(f"""Address: {self.eyetracker.address}
        Model: {self.eyetracker.model}
        Name: {self.eyetracker.device_name}
        S/N: {self.eyetracker.serial_number}""")
    def find_eyetracker(self):
        global EYE_TRACKER

        while (self.run_find_thread):
            found_eyetrackers = tr.find_all_eyetrackers()
            if len(found_eyetrackers) > 0:
                self.panel.update_eyetracker(found_eyetrackers)
                EYE_TRACKER = found_eyetrackers[0]

            time.sleep(1)

        return
예제 #18
0
    def run(self):
        et = tr.find_all_eyetrackers()
        if len(et) > 0:
            self.eyetracker = et[0]
        else:
            raise Exception("None of the eyetracker was found.")
        print("running...")
        self.passed = 0
        for _ in self.tracks:
            self.gaze_data.append(0)
        self.eyetracker.subscribe_to(tr.EYETRACKER_GAZE_DATA,
                                     self.gaze_data_callback,
                                     as_dictionary=True)
        while self.passed < len(self.tracks):
            time.sleep(1 / 60)
            if self.navi and self.passed < len(self.tracks):
                print("Checking {}.".format(self.tracks[self.passed]))
                self.navi = False

        self.eyetracker.unsubscribe_from(tr.EYETRACKER_GAZE_DATA,
                                         self.gaze_data_callback)
        print("finished.")
        print("epsilon = {}".format(self.epsilon))
        if len(self.f_sacc_buf) != 0:
            self.f_sacc_idxes.append(self.f_sacc_buf)
        if len(self.b_sacc_buf) != 0:
            self.b_sacc_idxes.append(self.b_sacc_buf)
        print("Forward saccades = {}".format([
            self.gaze_data[x] for list_x in self.f_sacc_idxes for x in list_x
        ]))
        for i in range(len(self.gaze_data)):
            if i > 0:
                self.lap_times.append(
                    (self.gaze_data[i][2] - self.gaze_data[i - 1][2]) *
                    MICROSEC)
        print(self.lap_times)
        sum = 0
        for t in self.lap_times:
            sum += t
        print("sum = {}".format(sum))
        sum = [0, 0]
        for e in self.errors:
            sum[0] += e[0]
            sum[1] += e[1]
        print(self.errors)
        print("sum = {}".format(sum))
        print("output all gaze data.")
        with open('./all_gaze_data', mode='w') as f:
            for i, g in enumerate(self.all_gaze):
                ave = self.gaze_to_ave(g)
                f.write("{} {} {} {}\n".format(i, ave[0], ave[1],
                                               self.all_err[i]))
예제 #19
0
def print_basic_eyetracker_information():
    try:
        nano_eyetracker = tr.find_all_eyetrackers()[0]
        assert nano_eyetracker
    except:
        print("No eye-tracker found")
        return
    print("Tobii Pro Eyetracker")
    print("Address: " + nano_eyetracker.address)
    print("Model: " + nano_eyetracker.model)
    print("Name (ok if empty): " + nano_eyetracker.device_name)
    print("Serial number: " + nano_eyetracker.serial_number)
    print("Firmwareversion: " + nano_eyetracker.firmware_version)
예제 #20
0
 def __init__(self, screen_size):
     """
     Tobiiのセットアップをします.
     eye_trackerオブジェクトに現在接続しているTobiiの情報が渡される
     """
     self.width = 1920
     self.height = 1080
     self.eye_tracker = tb.find_all_eyetrackers()[0]
     self.x = None
     self.y = None
     self.screen_size = screen_size
     self.screen_width = screen_size[0]
     self.screen_height = screen_size[1]
예제 #21
0
def thread1():

    found_eyetrackers = tr.find_all_eyetrackers()
    my_eyetracker = found_eyetrackers[0]
    print("Address: " + my_eyetracker.address)
    print("Model: " + my_eyetracker.model)
    print("Name (It's OK if this is empty): " + my_eyetracker.device_name)
    print("Serial number: " + my_eyetracker.serial_number)
    my_eyetracker.subscribe_to(tr.EYETRACKER_GAZE_DATA,
                               gaze_data_callback,
                               as_dictionary=True)
    time.sleep(50)
    my_eyetracker.unsubscribe_from(tr.EYETRACKER_GAZE_DATA, gaze_data_callback)
예제 #22
0
파일: __init__.py 프로젝트: savuzmir/psxeff
    def __init__(self, win, id=0):
        """
        Initialize tobii_controller object.
        
        :param win: PsychoPy Window object.
        :param int id: ID of Tobii unit to connect with.
            Default value is 0.
        """

        self.eyetracker_id = id
        self.win = win

        self.calibration_target_dot_size = default_calibration_target_dot_size[
            self.win.units]
        self.calibration_target_disc_size = default_calibration_target_disc_size[
            self.win.units]
        self.calibration_target_dot = psychopy.visual.Circle(
            self.win,
            radius=self.calibration_target_dot_size,
            fillColor='white',
            lineColor=None,
            lineWidth=1,
            autoLog=False)
        self.calibration_target_disc = psychopy.visual.Circle(
            self.win,
            radius=self.calibration_target_disc_size,
            fillColor='lime',
            lineColor='white',
            lineWidth=1,
            autoLog=False)
        self.update_calibration = self.update_calibration_default
        if self.win.units == 'norm':  # fix oval
            self.calibration_target_dot.setSize(
                [float(self.win.size[1]) / self.win.size[0], 1.0])
            self.calibration_target_disc.setSize(
                [float(self.win.size[1]) / self.win.size[0], 1.0])

        eyetrackers = tobii_research.find_all_eyetrackers()

        if len(eyetrackers) == 0:
            raise RuntimeError('No Tobii eyetrackers')

        try:
            self.eyetracker = eyetrackers[self.eyetracker_id]
        except:
            raise ValueError(
                'Invalid eyetracker ID {}\n({} eyetrackers found)'.format(
                    self.eyetracker_id, len(eyetrackers)))

        self.calibration = tobii_research.ScreenBasedCalibration(
            self.eyetracker)
예제 #23
0
    def __init__(self):
        self.start = False
        self.gaze = {"Left": [0, 0], "Right": [0, 0]}

        found_eyetrackers = tr.find_all_eyetrackers()

        if len(found_eyetrackers) > 0:
            print(found_eyetrackers)
            self.my_eyetracker = found_eyetrackers[0]
            self.my_eyetracker.subscribe_to(tr.EYETRACKER_GAZE_DATA, self.gaze_data_callback, as_dictionary=True)
            self.start = True
        else:
            print("ERROR: No device connected")
            self.start = False
def avaliableEyeTrackers():
    """
        Checks for the available eye trackers connected using tobii SDK
    """
# <BeginExample>
    eyetrackers = tr.find_all_eyetrackers()

    for eyetracker in eyetrackers:
        print("Address: " + eyetracker.address)
        print("Model: " + eyetracker.model)
        print("Name (It's OK if this is empty): " + eyetracker.device_name)
        print("Serial number: " + eyetracker.serial_number)
    # <EndExample>
    return eyetrackers
예제 #25
0
def execute():
    # <BeginExample>
    import tobii_research as tr

    eyetrackers = tr.find_all_eyetrackers()

    for eyetracker in eyetrackers:
        print("Address: " + eyetracker.address)
        print("Model: " + eyetracker.model)
        print("Name (It's OK if this is empty): " + eyetracker.device_name)
        print("Serial number: " + eyetracker.serial_number)
    # <EndExample>

    return eyetrackers
예제 #26
0
def find_eyetrackers_meta():
    found_eyetrackers = tr.find_all_eyetrackers()
    # available_eyetracker = found_eyetrackers[0]

    for available_eyetracker in found_eyetrackers:
        print("Address: " + available_eyetracker.address)
        print("Model: " + available_eyetracker.model)
        print("Name (It's OK if this is empty): " +
              available_eyetracker.device_name)
        print("Serial number: " + available_eyetracker.serial_number)

        if tr.CAPABILITY_CAN_SET_DISPLAY_AREA in available_eyetracker.device_capabilities:
            print("The display area can be set on the eye tracker.")
        else:
            print("The display area can not be set on the eye tracker.")
        if tr.CAPABILITY_HAS_EXTERNAL_SIGNAL in available_eyetracker.device_capabilities:
            print("The eye tracker can deliver an external signal stream.")
        else:
            print("The eye tracker can not deliver an external signal stream.")
        if tr.CAPABILITY_HAS_EYE_IMAGES in available_eyetracker.device_capabilities:
            print("The eye tracker can deliver an eye image stream.")
        else:
            print("The eye tracker can not deliver an eye image stream.")
        if tr.CAPABILITY_HAS_GAZE_DATA in available_eyetracker.device_capabilities:
            print("The eye tracker can deliver a gaze data stream.")
        else:
            print("The eye tracker can not deliver a gaze data stream.")
        if tr.CAPABILITY_HAS_HMD_GAZE_DATA in available_eyetracker.device_capabilities:
            print("The eye tracker can deliver a HMD gaze data stream.")
        else:
            print("The eye tracker can not deliver a HMD gaze data stream.")
        if tr.CAPABILITY_CAN_DO_SCREEN_BASED_CALIBRATION in available_eyetracker.device_capabilities:
            print("The eye tracker can do a screen based calibration.")
        else:
            print("The eye tracker can not do a screen based calibration.")
        if tr.CAPABILITY_CAN_DO_MONOCULAR_CALIBRATION in available_eyetracker.device_capabilities:
            print("The eye tracker can do a monocular calibration.")
        else:
            print("The eye tracker can not do a monocular calibration.")
        if tr.CAPABILITY_CAN_DO_HMD_BASED_CALIBRATION in available_eyetracker.device_capabilities:
            print("The eye tracker can do a HMD screen based calibration.")
        else:
            print("The eye tracker can not do a HMD screen based calibration.")
        if tr.CAPABILITY_HAS_HMD_LENS_CONFIG in available_eyetracker.device_capabilities:
            print("The eye tracker can get/set the HMD lens configuration.")
        else:
            print(
                "The eye tracker can not get/set the HMD lens configuration.")

        return available_eyetracker
def check_connection():

    eyetrackers = tr.find_all_eyetrackers()

    if eyetrackers:
        eyetracker = eyetrackers[0]
    else:
        print(
            "\nWARNING! libtobii.TobiiProTracker.__init__: no eye trackers found!\n"
        )
        sys.exit()

    print("\nEye tracker OK!\n")
    print("Address: " + eyetracker.address)
    print("Model: " + eyetracker.model)
    print("Serial number: " + eyetracker.serial_number)
예제 #28
0
    def __init__(self):

        self.keybinder = WinKeyBinder()
        self.keybinder.init()

        # grab screen res
        self.width, self.height = get_screen_size()

        # eye position
        self._eye_x = 0
        self._eye_y = 0

        # setup tracker
        self.t = tr.find_all_eyetrackers()[0]
        self.t.subscribe_to(tr.EYETRACKER_GAZE_DATA, self.gaze_data_callback)

        self.qt_rects = []
예제 #29
0
    def __init__(self):
        self.cal_points = 5
        self.ht, self.wd = 1024, 1280  # height and width of the display
        self.point_size = 10 // 2  # number of pixels in a display point
        self.r = list(
            randint(self.point_size, self.ht - self.point_size,
                    self.cal_points))
        self.c = list(
            randint(self.point_size, self.wd - self.point_size,
                    self.cal_points))
        self.res = 'calibration_status_failure'
        self.points = 0
        # find the eyetracker
        self.tracker = tr.find_all_eyetrackers()[0]

        while self.res != 'calibration_status_success' or self.points != self.cal_points:
            self.res, self.points = self.calibrate()
예제 #30
0
    def __init__(self):
        try:
            self.eyetracker = tr.find_all_eyetrackers()[0]
        except IndexError:
            messagebox.showinfo(
                "Error",
                "Tobii Eye Tracker not found. Please restart the Tobii Service\nfound in the \"Services\" application"
            )
            import sys
            sys.exit(1)

        self.gaze_data = []

        self.disp = libscreen.Display()
        self.screen = libscreen.Screen()
        self.kb = libinput.Keyboard(keylist=['space', 'escape', 'q'],
                                    timeout=1)
        self.screendist = constants.SCREENDIST

        # calibration and validation points
        lb = 0.1  # left bound
        xc = 0.5  # horizontal center
        rb = 0.9  # right bound
        ub = 0.1  # upper bound
        yc = 0.5  # vertical center
        bb = 0.9  # bottom bound
        self.points_to_calibrate = [
            self._norm_2_px(p)
            for p in [(lb, ub), (rb, ub), (xc, yc), (lb, bb), (rb, bb)]
        ]

        # maximal distance from fixation start (if gaze wanders beyond this, fixation has stopped)
        self.fixtresh = 1.5  # degrees
        # amount of time gaze has to linger within self.fixtresh to be marked as a fixation
        self.fixtimetresh = 100  # milliseconds
        # saccade velocity threshold
        self.spdtresh = 35  # degrees per second
        # saccade acceleration threshold
        self.accthresh = 9500  # degrees per second**2
        # blink detection threshold used in PyGaze method
        self.blinkthresh = 50  # milliseconds

        self.screensize = constants.SCREENSIZE  # display size in cm
        self.pixpercm = (
            self.disp.dispsize[0] / float(self.screensize[0]) +
            self.disp.dispsize[1] / float(self.screensize[1])) / 2.0
def register_eyetracker():
    stdin = raw_input("Start tobii eye tracking? [y/n]")

    while (stdin != "n"):
        found_eyetrackers = tr.find_all_eyetrackers()

        if len(found_eyetrackers) > 0:
            EYE_TRACKER = found_eyetrackers[0]
            break
        else:
            stdin = raw_input("Can't find eye trackers, try it again? [y/n]")

    if EYE_TRACKER != None:
        print_eyetracker(EYE_TRACKER)
        cali_eyetracker(EYE_TRACKER)
        EYE_TRACKER.subscribe_to(tr.EYETRACKER_GAZE_DATA,
                                 gaze_data_callback,
                                 as_dictionary=True)