psychopy.org | Reference | Downloads | Github

Psychopy and Pupil labs eye tracker

timing
eyetracking

#1

Hello All,

Has anyone tried to integrate pupil labs eye tracker into Psychopy?
I am new to research and programming. I have developed my experiment mainly through the builder interface of psychopy, I am now trying to synchronize timing between the 2 and I am struggling!!! The code for the stroop task is for the tobi eye tracker. I have also tried to implement the LSL protocol through one of the plugin available but no success as I am not sure how to receive the data.

I would appreciate any hints or help (baby language please :).

Thank you so much!

E


#2

Hi elodie_rigal:
I’m running an experiment in psychopy wich involves pupil lab eye-tracker. Do you already know how to integrate them and synchronize timing ?
It would be very helpfull for me if you reply with a soluton, if you found one.
thanks you so much in advance!


#3

Hello Pablo,

It’s been now a few months since I did this experiment. I used the code that you can find on Pupil Lab website https://docs.pupil-labs.com/#developer-docs but I ran the code on a separate python program (not directly from Psychopy) and was receiving the data on a separate port.
Here what I used to record the ‘gaze’.

Hope this helps.
E

import zmq
from msgpack import loads

context = zmq.Context()
# open a req port to talk to pupil
addr = '127.0.0.1'  # remote ip or localhost
req_port = "50020"  # same as in the pupil remote gui
req = context.socket(zmq.REQ)
req.connect("tcp://{}:{}".format(addr, req_port))
# ask for the sub port
req.send_string('SUB_PORT')
sub_port = req.recv_string()

# open a sub port to listen to pupil
sub = context.socket(zmq.SUB)
sub.connect("tcp://{}:{}".format(addr, sub_port))

# set subscriptions to topics
# recv just pupil/gaze/notifications
sub.setsockopt(zmq.SUBSCRIBE, 'pupil.')
# sub.setsockopt_string(zmq.SUBSCRIBE, 'gaze')
# sub.setsockopt_string(zmq.SUBSCRIBE, 'notify.')
# sub.setsockopt_string(zmq.SUBSCRIBE, 'logging.')
# or everything:
# sub.setsockopt_string(zmq.SUBSCRIBE, '')


print("pupil")
    except KeyboardInterrupt:
        break

#4

Hi @Elodie_Rigal1
I’m trying to do the same thing. I have an experimentation that I created on psychopy and my participants will have eye tracking device. If you have time, can you explain to me more in details how to link psychopy and pupils. Is it on the same computer that you have both the experimentation and the eye tracking, or you work on two computers?
Thanks a lot for your help


#5

Hello Elodie,

Do you have a paper or working paper related with this research?
I planning to run my economic experiments using Pupil Labs eye-trackers. So, I really need some guidance on how to conduct my research.

Thank you,
Sara