FAQ - Debugging Checks


Q: How do I control the debugging checks when Screen starts up?

A: When Screen executes OpenWindow, it by default runs various debugging checks and prints out some results. The degree to which this occurs may be controlled. The examples below show some things you can do. Note that although supressing warnings and reducing the level of checking does reduce the amount of output that gets dumped, it also prevents you from being warned about problems with your software/hardware configuration.

The program ScreenTest will, when it is completed, thoroughly exercise your hardware/software configuration.



% Setting this preference to 1 suppresses the printout of warnings.
oldEnableFlag = Screen('Preference', 'SuppressAllWarnings', [enableFlag]);

% At the end of your code, it is a good idea to restore the old level.
Screen('Preference','SuppressAllWarnings',oldEnableFlag);


% Alternatively, you can control the output of messages in a more fine-grained way via:
oldLevel = Screen('Preference', 'Verbosity', [newLevel]);

newLevel can be any of:
~0) Disable all output - Same as using the 'SuppressAllWarnings' flag.
~1) Only output critical errors.
~2) Output warnings as well.
~3) Output startup information and a bit of additional information. This is the default.
~4) Be pretty verbose about information and hints to optimize your code and system.
~5) Levels 5 and higher enable very verbose debugging output, mostly useful for debugging PTB itself, not generally useful for end-users.

% At the end of your code, it is a good idea to restore the old level.
Screen('Preference', 'Verbosity', oldLevel);


% You can control the level of visual debugging, with levels 4 through 1.  Level 4 is most thorough, level 1 is errors only.
oldLevel = Screen('Preference', 'VisualDebugLevel', level);

% Restore when done.
Screen('Preference', 'VisualDebugLevel', oldLevel );


% You can shorten the internal calibrations and display tests, restricting them to a maximum of about 5 seconds,
and tell PTB-3 to carry on, even if important tests & calibrations failed, by issuing the command:

Screen('Preference', 'SkipSyncTests', 1 );

You can completely skip all tests and calibrations (PTB will assume everything is fine, use some hard-coded default
values instead of measurements and disable a couple of internal mechanisms that are important for stimulus timing) via:

Screen('Preference', 'SkipSyncTests', 2 );

**This is only recommended if you use PTB as a graphics toolkit. Don't do this for your studies unless you want
to qualify for the "Dumbest scientiest on earth" contest.**


Good programming practice is always to set these to the level you want at the start of your program, and restore at the end. Don't count on the default values, as they may change in future versions.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki