PsychoPy PLR¶
If you decide that a standard computer monitor is sufficient for presenting a light stimulus, you could use PyPlr with PsychoPy. This minimal example presentes a 1-second white flash on a monitor and saves a recording with an annotation marking the onset of the flash. Just make sure the participant’s head is stabelised and that the Pupil Core world camera can see the screen.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
from time import sleep
from psychopy import core, visual
from pyplr.pupil import PupilCore
def main(subject='test', display_size=(1024,768)):
# Set up Pupil Core
p = PupilCore()
# Setup windows and stimulus
win = visual.Window(size=display_size, screen=1, color='black')
white = visual.Rect(win, units='pix', size=display_size)
white.color='white'
black = visual.Rect(win, units='pix', size=display_size)
black.color='black'
# Set up pupil trigger
annotation = p.new_annotation('LIGHT_ON')
# Start recording
p.command('R {}'.format(subject))
sleep(2.)
# Start light_stamper
lst_future = p.light_stamper(annotation, threshold=15, timeout=6.)
# Baseline
sleep(2.)
# Present stimulus
white.draw()
win.flip()
core.wait(1.0)
black.draw()
win.flip()
core.wait(6.0)
# Close the window
win.close()
# Close PsychoPy
core.quit()
if __name__ == '__main__':
try:
main()
except KeyboardInterrupt:
print('Killed by user')
sys.exit(0)
Check out the PLR STLAB example for ideas on how to make an automated pupillometer with PyPlr and PsychoPy. Also, try comparing pupil responses to the red and blue channels of your monitor. You might just see a PIPR…