Introduction:
-------------
This is the source code for the model which was used in the paper "Synaptic
Scaling Balances Learning in a Spiking Model of Neocortex" by Mark Rowan and
Samuel Neymotin.

To generate data for the figures in the paper, follow the instructions under
'compiling' (below) then run the relevant commands from the following list. Be
aware that some of the experiments will take a couple of days to run and will
produce large amounts of data (> 2GB) due to the very long amounts of time being
simulated (~44 hours).


Figures:
--------
Figure 2 (long run):
./runsim data/onlydeletion "{stdpsim=0 scaling=0 deletionstep=3}"
./runsim data/scalingwithdeletion "{stdpsim=0 scaling=1 deletionstep=3}"

Figure 3 (long run):
./runsim data/onlyscaling "{stdpsim=1 scaling=1 PreDur=160000 PostDur=0 LearnDur=0}"

Figures 4/6/7a/7c (couple of hours):
./runsim data/onlytraining "{stdpsim=1 scaling=0}"

Figures 5/6/7b/7d (couple of hours):
./runsim data/trainingandscaling "{stdpsim=1 scaling=1}"


Creating plots:
---------------
Plots can be created using 'python plot.py <datadir> <plot1>: <plot2>'
(requires various Python packages including matplotlib, numpy, and mtspec).

e.g. to create Figure 3:
  python plot.py data/onlyscaling activity noinhib: scaling noinhib
  
or to create Figure 7:
  python plot.py data/trainingandscaling power




Compiling:
----------
Change to the 'mod' directory and run the command 'mkmod' to build the necessary
.mod files.


Running the sim:
----------------
Execute the simulation directly using ./runsim.sh [savepath] [optional args]

  where [optional args] is a list such as   "{variable=value other_variable=value}"
  e.g. "{strdef simfilename simfilename="stdp_scaling.hoc"}" (which runs STDP sim)


Batch runs:
-----------
To run multiple experiments in a batch on a cluster (e.g. to get results over
various different values of activitytau), create a basic script in batchscripts
and fill in the variable name, values, and optional arguments. (See the scripts
already inside batchscripts for examples). This is currently set up to use a
GridEngine cluster, but you can edit clusterrun.sh to change cluster settings.

To execute:

  batchscripts/<script>

To run all scripts in a directory:

  run-parts batchscripts/<directory>/


Code hierarchy:
---------------
batchscripts/<script>
 |_ batchcommon
   |_ clusterrun.sh
     |_ runsim.sh
       |_ sim.hoc
         |  sim setup files
         |  stdp_scaling.hoc OR alz.hoc  (chosen by setting stdpsim=1/0)

20160921 Updates from the Lytton lab that allow the model to run on
mac OS X.