Showing posts with label PEBL experiment debugging. Show all posts
Showing posts with label PEBL experiment debugging. Show all posts

Sunday, December 4, 2011

PEBL Programming Tutorial IV: Redefining Functions

This is Part IV of a series of Tutorials on PEBL
First  |   Previous   | Next



The Print() and Print_() functions can be extremely useful in PEBL  for debugging.  You can print out the state of particular variables at different points during execution of a program, and help track down errors.  But when using PEBL on windows, or from the launcher, this well get saved to a file you can examine.  This can be useful, but sometimes it is useful to print out and see values of variables real-time.

For example, consider the following program, which attempts to create a list of numbers between 1 and 100:


define Start(p)
{
   win <- MakeWindow()
   i <- 1
  list <- []
   while (i <= 100)
    {
       list <- Append(list, i)
       Print(i)
    }
}

Tuesday, March 15, 2011

Inelegant Hacks

PEBL often has some limits that people run into, and these can sometimes be overcome with other programs.  The SystemCall() function gives some powerful means to extend PEBL functionality.  All of these examples work for windows, although they could mostly be adapted to OSX or Linux fairly easily.  Some of these will make it into the new version of PEBL, either as shown or with a compiled implementation.  One word of caution--on windows, this function brings up a black terminal window when it runs the function, so it is best to not use this while you are collecting trial data; but for setup or later analysis it works fine. 



Sunday, October 10, 2010

Interpreting error output

When you run a PEBL script, the compiler records a bunch of logging messages (mostly at initialization) that can help you understand different initialization problems when they occur.  Also, when an error occurs during execution, messages will usually be displayed that can help you figure out the problems.



In windows or OSX, these display messages will appear in the terminal screen.  On windows, they get saved to two text files: stdout.txt and stderr.txt.  First, we'll start with stderr.txt.  I'm showing one created on linux, but it should be basically the same on other platforms