Model code from the paper: Dorman D.B., Blackwell K.T., "Synaptic plasticity is predicted by spatiotemporal firing rate patterns and robust to in vivo-like variability" Biomlecules, In Press.

The code in this directory implements the model simulations in the paper. This directory includes a pre-compiled version of moose in the moose subdirectory, so a separate installation of moose is not required, and the simulations will use the same moose version as used for the manuscript.

To run simulations that are used in Figures 3-6 and A1, run files in the moose_nerp directory:
  python str_net/multisim.py

To run simulations that are used in Figures A2 & A3,
uncomment this last line in multisim.py:
#results = multi_main_moved_spikes()
comment out the previous line, and then run
  python str_net/multisim.py

Simulations were run on the neuroscience gateway portal using the scripts:
  main_ran0_220_uni.py (used in Figures 7-9,11 and A4A)
  main_ran1_220_uni.py (used in Figure A4B)
  main_ran1_260_uni.py (used in Figure 10 and A4C)

These script by default runs parallel simulations using MPI on the neuroscience gateway,
and code for all simulation parameter combinations are included.

However, in addition to running many parallel simulations on the NSG portal, an example single simulation can be run on a single using workstation using:

  python main_ran0_220_uni.py  --single`

The actual model parameters and model code are in the directory `moose_nerp`, and the parameters for the neurons in this specific publication are in /moose_nerp/D1PatchSample5/

Code for analysis and to gengerate figures are in the moose_nerp/anal directory;
the main file is
  plas-sim-analysis.py
edit the following:
     figure_path (where should figures be svaed)
     ddir (where are the data files generated by running simulations)
     csvdir (directory with 'spine_to_spine_dist_D1PatchSample5.csv')
     inputdir (where the FullTrial*Variability*.npz files are)
     change many of the binary variables (lines 52-62) from False to True (but keep regression_all=False)
then, specify which set of output files to analyze, e.g.
      python plas-sim-analysis.py trunc_normal (for figures 3-6 and A1)
      python plas-sim-analysis.py moved (for figures A2 & A3)
plas_sim_anal.bat shows how to analyze the files from the NSG.

To create Figures9 and and 10C-E, use
   RF_anal.py
   after plas_sim_anal.bat
   But first, edit pattern to point to the directory with the output of plas-sim-analysis.py
   
      



