Sunday, December 5, 2010

How to make edits to a PEBL Experiment

One of the most common questions I get is how you make some change to a test in PEBL. This is one of the real advantages of PEBL over many of the canned experiment batteries out there--you have complete control over the tests, and can adapt them to suit your needs if you so chose.
Let's start at the very very basics.

  1. PEBL experiments are saved in a text file that can be edited with a text editor, such as wordpad.  There are many useful 'programmers' editors out there too that can help with bracket matching, indenting, etc.  You shouldn't use a word processor like MSWord to edit files though.
  2. PEBL tests are saved with a .pbl extension, but they are just text files.  You can actually run .txt files, or text files with any extension, with PEBL, but the launcher is restricted to only show .pbl files.
  3. You can't open an experiment script for editing with the launcher.  (Maybe you should be able to, but it does not support that yet).  To edit a script, navigate to the location of the script with your file manager, and open up there by double-clicking or right-clicking and opening with save as.
  4. There are no technical or legal restrictions to making changes to PEBL scripts--it is as simple as editing a text file. If you try to make changes, consider saving a copy of it first with a new name, so you can trace back to the original when you have a problem.
  5. Most of the standard tasks place some control variables near the beginning of the script.  In PEBL, a variable holds some value for later use.  It is assigned with the two-character combination '<-'.  It might look like this:
    numtrials <- 100
    This can typically be changed to  a new value without much worry, but make sure you test to be sure things work out as planned.  The most common simple edits you probably want to make include numbers of trials, blocks, stimuli, and timing variables.
  6. Instructions and labels are usually encapsulated in quotes "".  If you want to translate a test or change the instructions and labels, look for the quoted text and replace it.
  7. If you want to get more adventurous, remember the Print() command.  Add a Print statement and whatever is inside the function will appear on the command line or in stdout.txt.  For example:
    Print("Value of numtrials: "+numtrials)
    This can be very helpful identifying what is going on where and when.
  8. More detailed instructions about PEBL's syntax are available in the PEBL manual.  It is really fairly easy to use and make simple experiments, so don't be afraid.
  9. When you have made an edit, save the file and try it out.
  10. If you made a mistake that violates the syntax (Syntax Error), the file stderr.txt will give you feedback about where in the file the error occurred.  Use a text editor that tells you line numbers to track it down. In windows, notepad will do this if you turn on the status bar.
These are just a few tips for editing a PEBL script.  If you get stuck, email the pebl-list for help.
Post a Comment