Pupillometry with Pupil Core

Hi,

Apologies if this has been answered elsewhere, but I’m trying to work out how to record pupillometry with a Pupil Labs - Pupil Core system. Totally new to this, so please go easy on me!

So far I’ve learned that I need to have the Pupil Service application running in the background, and the pupil labs eyetracker selected in Experiment Settings. I also finally worked out that I needed to select “save HDF5 file” to actually record anything…

What I’d like to to is relate the timing of presentation of different visual stimuli to the estimate of pupil diameter, but I’m not sure how to get markers into the HDF5 file?

Lastly, what are the recommended methods for opening and analysing the HDF5 data…?

Any help would be greatly appreciated.

Cheers, Jon

So after doing a bit more digging it seems like I needed to add start and stop eyetracker processes with the Builder component, but I still don’t know how to get event markers inserted into the HDF5 file that’s created.

One potential complication is that I’m only interested in recording pupil size. Using the code from here (Communicating with an Eyetracker — PsychoPy v2023.1.2) I’m able to look at the contents of the HDF5 file that’s generated, but it doesn’t appear to contain any information about the relation between pupil measures and the events as they occur in the experiment.

Anyone got any tips for how to achieve this?

Best wishes,
Jon

After doing some more digging I was trying to write the event information using the suggestion here, which recommends using ioServer.sendMessageEvent(text=“something”).

Tried using a code block to do this at the start of each fixation block prior to image presentation, but there doesn’t seem to be anything written to the hdf5 file… however, I wonder whether the python code included here will extract this message? Any help would be much appreciated…

Best wishes,
Jon

It would help if you shared your experiment, or at least the code for writing the messages.

Okay it’s working, finally worked out where to find the info using hdfview.

Don’t know if anyone has sample python code for merging the events with the pupil data from the hdf5 file?

Haven’t found anything obvious on digging around.

Best,
Jon

Not for python, but there’s example R code here: EyeTracking_Tobii_PsychoPy_IOHUB/tobii.extractor.R at master · aleksandernitka/EyeTracking_Tobii_PsychoPy_IOHUB · GitHub

You can probably adapt it pretty easily to a python hdf5 reader.

Hello Joseph,

Thanks for your suggestion - I’ll look into that.

In the meantime, I have a new problem. For some reason when I open my hdf5 file with hdfview it appears to be running at about 1Hz - which is not great when I’ve specified 60 samples per second in pupil service. Don’t suppose you have any idea why that might be?

Best wishes,
Jon