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 中文 日本語 한국어 Русский
problem solving


Problem solving and some tips for preventing problems

When you start working with psycc, some problems during compilation may occur. These problems may just be simple errors in your script. Here, I aim to list some examples of such problems.

PsyToolkit is designed to give detailed feedback of how to fix errors. PsyToolkit will tell you which line of your script file the problem occurs in.

Least tested parts

Ninety-nine percent of the features have been tested. That said, use of video playing and polar mode are little tested (and few people need these features, as far as we know).

Double naming of variables

If you give both a task and table the same name, the compiler might be confused. You will get a detailed error about this. Always use different names for tasks, tables, and blocks, and variables.

Table name or task name not found

Error messages occur if you use a table that does not exist. Make sure that your table statement in a task description refers to an existing table.

Forgetting $ or & sign

When you use a set call, make sure the variable starts with a $ or & sign.

Negative coordinates for a stimuli when not using centerzero.

In the centerzero coordinate system, coordinates can be negative. For example, a negative x position just shows a stimulus left of screen center. If you use negative coordinates without having set the option "centerzero", you will not be able to see such stimuli. Solution: Use option centerzero.

Bitmap and other external file locations

PsyToolkit checks whether bitmaps you define and use exist. It is easy to put them in the wrong location. Make sure they are in the same folder as the PsyToolkit script, or use the option "bitmapdir". The same is true for other stimuli and fonts!

Multi-line commands

Some statements use commands on multiple lines. For example, if you use "draw off", make sure you have "draw on" somewhere as well! And if you start a "tasklist", make sure it is followed at some point by "end".

Spaces in file names

Spaces in bitmap (or other) filenames are not acceptable in PsyToolkit. Thus, if you have a bitmap called "funny face.png", you need to rename it in, for example, "funny_face.png".

Empty lines between sections are compulsory

You must have an empty line between your sections. Thus, make sure that each line starting with "table", "task", "bitmaps", "block", etc, is at least preceded by an empty line.



Handy tips

There are some features of PsyToolkit that are just really handy, but that can be easily overlooked when reading the manual. Below, you find a list of tips, organized by topic.

Programming Experiments with PsyToolkit

Options.

The options section gives you practical functions for running the experiment.

The escape option lets you escape out the experiment any time (although you need to hold the button until the end of a trial).

The centerzero option makes positioning much easier. Screen position 0,0 means the middle of the screen. Negative coordinates are left and above the screen center. Thus, in a 800x600 screen, and with center zero, position 0,0 is the same as position 400,300 in a non-center-zero layout. The advantage of centerzero is that this is a more resolution independent way of coding (you can use the option "coordinates polar" to be fully resolution independent).

Running Experiments

Resolution.

The resolution of the screen determines the size of bitmap and video stimuli. Per default, PsyToolkit uses 800x600 pixels, but this can easily be changed with the resolution option. If you want to run in full screen, make sure your screen supports the chosen resolution. Not all monitors support the default 800x600 resolution (although that seems rare, I have only noticed it with one type of monitor). If it happens that the screen turns black and stays so, you can reboot by pressing "atl+sysrq+b". The sysrq button is often somewhere on the top right of your keyboard. The latter reboot on alt-sysrq+b is a Linux specific issue, but it not present on all Linux systems (it is an option for distributions to add it or not, in fact, it is a kernel option that you can set yourself).

If you want to find out what the native resolution of your screen is, play around with the buttons on your monitor. Usually, it will show a message on screen with the current resolution. You can then use that resolution, and you will be sure that PsyToolkit does not hang because of a non-existent resolution.

Test before running

Before you run an experiment, you should test it carefully. Compile the script with the -t -v options. The -t stands for "testing" and the -v for "verbose". The compilation processing will give you detailed information about the compilation process, and the experiment will run only in a window, not in full screen mode.

Run as root

If you do not run as "root" and if you use the regular keyboard, you might only sample response times in long intervals. Make sure you run as root for real experiments.

If you do not run as "root" and if you use Cedrus, your Cedrus keyboard might not work, as only "root" might have access to the device.

Hanging

Linux rarely hangs. If it does, you can try to press alt+sysrq+b. This is a very powerful key combination that will reboot the computer (depending on your version of Linux).



Information about your experiment

Once a script has been compiled into an executable, the program will run independently of PsyToolkit, it is just a compiled program like most other software. But you can still easily find out when they were compiled, and with which version of psycc! Just type the experiment's name on the command line, but with the -i (stands for information) option.


Example:

$ ./myexperiment -i



Note: In the command above, the ./ might not necessary, depending on whether the local directory is in your path.