This directory contains the scripts for computer simulation 1 from 

	Legenstein R, Pecevski D, Maass W 2008 A Learning Theory 
    for Reward-Modulated Spike-Timing-Dependent Plasticity with 
    Application to Biofeedback. PLoS Computational Biology 4(10): e1000180, Oct, 2008 
    
The produced results are figures 4 and 5, and supplementary figures 1 and 2.

To create these figures you need to:

1. The computer simulation is setup to run as an MPI application
   on 19 computing nodes on a cluster, with 2 processes per computing node.
   To set the list of the names of machines you want to use edit the file start_simulation.py.
   
2. Start mpdboot on the cluster machines. See the mpich2 documentation on how to do this. 
   
3. Execute:

    start_simulation.py
    
    This is an executable file, you don't need to run 'python start_simulation.py'.
    
    Wait until the simulation finishes. You can monitor how the simulation progresses 
    in the sim.out file. The script will produce one hdf5 file in the current directory.

4. Then, to create figure 4 run:
   
      ipython -pylab  figure_draft_journal.py
      
5. The next script uses IPython parallel computing capabilities to parallelize execution 
   of some calculations. To setup on which machines the ipython cluster should run, 
   edit the clusterconf.py file.      
      
6. Then, to create figure 5 and supplementary figures 1 and 2 run:

      ipython -pylab figure_journal_ai_analysis.py