Psychophysics toolbox
Thorsten Hansen
Abteilung Allgemeine Psychologie I
Psychtoolbox
• Psychtoolbox is a collection of Matlab functions for presenting visual
stimuli easier
• with the Psychtoolbox you can run your experiments from Matlab
• use the full flexibility of Matlab (general purpose, high-level,
interpreted language) to generate your stimuli
• display them with millisecond timing using the Psychtoolbox (well-
defined interface to graphics hardware)
• Run code with little interruption >> help rush
http://psychtoolbox.org
David Brainard Denis Pelli
… don’t thank them, cite them!
"We wrote our experiments in MATLAB, using
the Psychophysics Toolbox extensions
(Brainard, 1997; Pelli, 1997)."
Brainard, D. H. (1997). The Psychophysics Toolbox, Spatial
Vision , 10, 443-446.
Pelli, D. G. (1997). The VideoToolbox software for visual
psychophysics: Transforming numbers into movies, Spatial
Vision, 10, 437-442.
Psychtoolbox is free, but
• the syntax of commands is special; almost everything is
done with the Screen command; to get help, >> help
Screen does NOT show much; instead, type >>Screen
• developed primarily for Apple Macintosh; support for other
OS (Linux, Windows) is ok, but not perfect
• development is cumbersome: any error freezes the screen,
and you have to do
Alt-tab; >> Clear Screen; >> close all (Windows)
(sometimes even to close and restart Matlab)
• documentation partly outdated (e.g., Tutorial for the recent
version PTB3)
You should also bear in mind that you are
entering the murky world of non-
professional code. This code is written by
people like you, in the middle of trying to
do real science. This means that
commands may not work as stated, help
files may be out of date, commands may
not even exist. This is especially true in
the case of Psychtoolbox, which is
essentially a collaborative effort between
lots of people and has been through lots of
reincarnations.
Ione Fine
http://faculty.washington.edu/ionefine/Matlab%20Cla
ss%20Chapter%206.pdf
Controlling the hardware
• The nice thing about Matlab is that it is
more or less completely independent of
the hardware
• This is no longer the case using the
Psychtoolbox; all sorts of things can go
wrong (e.g., help SyncTrouble)
What is…
• OpenGL is the premier environment/API for developing
portable, interactive 2D and 3D graphics applications (GL:
graphics library)
• API application programm interface
• double buffering is a practice to use a front and back
image frame buffer to achieve smooth animation. The back
buffer is not displayed, but swapped (flipped) with the front
buffer.
• Synching to VBL will wait for the display to enter its
vertical blanking (VBL) interval between frames before
swapping its internal buffers to update the display
• VBL (vertical blank) is the small gap in time that occurs
when the display has updated its last scanline and before it
starts redrawing its display surface starting at the first
scanline again.
• Vertical retrace signal Synonym for vertical blank