In addition to all visual features I want, I also want the framework/simulator to be easily configurable and scriptable, and what language provides better parsing and scripting capabilities than Perl? (or Python, or Ruby, but my experience with those is very limited...)

It's (non)surprisingly easy to call perl from C as the following code shows:

#ifdef __cplusplus
  extern "C" {
#   include <EXTERN.h>
#   include <perl.h>
    static PerlInterpreter *my_perl;
  }
#endif

int main(int argc, char **argv, char **env) {

  my_perl = perl_alloc();
  perl_construct(my_perl);

  perl_parse(my_perl, NULL, argc, argv, env);
  perl_run(my_perl);

  perl_destruct(my_perl);
  perl_free(my_perl);

  return 0;
}

This code can be compiled with something like this:

g++ -c interp.c -o interp.o `perl -MExtUtils::Embed -e ccopts`
g++ interp.o -o interp `perl -MExtUtils::Embed -e ldopts`

and then interp -v should give you the same output as perl -v.

While it may be easy to compile and run this simple program, it's still a challenge to pass complex data structures between C and Perl as you need to know all those *_sv, *_pv, *_av and stack manipulation calls. Fortunately for me I own a copy of Extending and Embedding Perl. There are even libraries like PerlStream that will hide all that complexity from you.

Another problem is that it means having additional libraries and module files (if you happen to use Perl modules) in your distribution. On Windows this can be solved by using Thinstall, PEBundle, or one of many other exe packers that compress executable and dll files into a single file.

Out of several options I looked at for visualizing results of a simulation OpenGL/GLUT combination looks the most promising. In additional to being able to see the simulation in real-time, I'd also like to have the following:

  • Network activity; firings per second; separate for inh and exc neurons? separate for different types of neurons?
  • Neuron connections and delays; would show incoming/outgoing connections and their delays; spike propagation
  • Neuron activity; would include the input current (I), the recovery current (u), and the membrane potential (v); would generate something similar to this digram only in real-time
  • Synaptic weights; would show current and previous value of all synaptic connections (incoming, outgoing, or both?) of a neuron
  • Neuron properties; to view/edit properties of individual neurons
  • Neural complexes; to research polychronous groups

Neural Viewer already provides most of what I need (it also has help, comments, console, and network selection screens), but, unfortunately, the source code for it is not available.

To implement this in OpenGL/GLUT in addition to some basic functions I would need to at least know the following: