PsyToolkit
Menu PsyToolkit main menu Welcome Introduction How it works Scripting basics Stimulus presentation Timing precision Examples Script syntax Script references Java Psylib references PsyQuest Problem solving Special devices FAQ Download / Installation Resources Contact Acknowledgments Complete PDF manual
Translations Deutsch Français Español 中文 日本語 한국어 Русский
stimuluspresentation


Some words about stimulus presentation

Every visual stimulus has a position, and how that position is described depends on the coordinate system you use. Details are explained in this section.

Coordinate systems

A coordinate system is the way of how a system describes the location of objects.

PsyToolkit offers three different coordinate systems. The first two are the ones you will most likely use, whereas the third one is a polar one. If you want to use a coordinate system other than the default coordinate system, you can set the one you want to use in the "options" section.

The default coordinate system uses exactly the same coordinate system as the computer graphics library (SDL) does, with position 0,0 at the top left corner.

coordinates1


The "centerzero" coordinate system uses 0,0 as the center.

coordinates2


Finally, there is a polar coordinate system (in which you present stimuli as an angle and distance from screen center). This is one of the less tested features, and currently, this can only be used for bitmaps (but not for moving stimuli/sprites).

Bitmaps (static stimuli)

Bitmaps are stimuli that can be positioned. You can clear them from the screen, and you can show the same bitmap many times. Bitmaps can also be loaded into sprites (see below).

In PsyToolkit, bitmaps are defined in the "bitmaps" section. This section tells you which bitmap files you want to use, and optionally, you can give bitmaps a specific label. Bitmap files can be of practically any format (e.g., jpeg, png, bmp, tiff, gif).

In PsyToolkit, you refer to bitmaps by their label. Because a bitmap can be shown multiple times, you refer to the sequence number of presentation to clear them (see examples).


Example: Show a two bitmaps, one at screen center and then clear them

options
  centerzero                  # this makes 0,0 the center of the screen

bitmaps
  smiley                      # make sure smiley.png exists

task showtest
  show bitmap smiley 0 0      # show smiley at center
  show bitmap smiley 100 100  # show the same bitmap elsewhere as well
  delay 1000                  # show both instances of the bitmap for 1s
  clear 2                     # now clear the one that was presented 2nd
  delay 1000                  # now only one is left, the one at center
  clear 1                     # clear that one as well

block myblock
  tasklist
    showtest 1
  end



Sprites (dynamic stimuli)

Sprites are stimuli that can move, jump, disappear and return. One of the main differences between bitmap and sprite stimuli is that stimuli keep moving around until explicitly stopped. Thus, a sprite can move around during delays, whilst you are waiting for a key response, and even across trials.

Using sprites affects the timing precision of reading the regular keyboard a bit. That is because the computer spends more time on drawing stimuli and less time on checking whether a button has been pressed. This problem can be dealt with by using an external keyboard that has its own timer (Cedrus or IOLab) when working with sprites.

Videos

PsyToolkit can present videos using the video directives.