<gh_stars>1-10
#!/usr/bin/python

import os,sys
ncs_lib_path = ('../../../../python/')
sys.path.append(ncs_lib_path)
import ncs

def Run(argv):
  sim = ncs.Simulation()
  excitatory_parameters = sim.addNeuron("label_excitatory",
                                                 "izhikevich",
                                                 { 
                                                  "a": 0.2,
                                                  "b": 0.2,
                                                  "c": -65.0,
                                                  "d": ncs.Uniform(7.0, 9.0),
                                                  "u": ncs.Uniform(-15.0, -11.0), 
                                                  "v": ncs.Normal(-60.0, 5.0),
                                                  "threshold": 30,
                                                 }
                                                )
  group_1 = sim.addNeuronGroup("group_1", 1, "label_excitatory", None) # last param is geometry
  group_2 = sim.addNeuronGroup("group_2", 1, excitatory_parameters)
  flat_parameters = sim.addNeuron("synapse", 
                                           "ncs", 
                                           { "utilization": ncs.Normal(0.5, 0.05),
                                             "redistribution": 1.0,
                                             "last_prefire_time": 0.0,
                                             "last_postfire_time": 0.0,
                                             "tau_facilitation": 0.001,
                                             "tau_depression": 0.001,
                                             "tau_ltp": 0.015,
                                             "tau_ltd": 0.03,
                                             "A_ltp_minimum": 0.003,
                                             "A_ltd_minimum": 0.003,
                                             "max_conductance": 0.004,
                                             "reversal_potential": 0.0,
                                             "tau_postsynaptic_conductance": 0.025,
                                             "psg_waveform_duration": 0.05,
                                             "delay": ncs.Uniform(1,5),
                                           })
  synapse = sim.addSynapseGroup("1_to_2", group_1, "group_2", 1, flat_parameters)
  if not sim.init(argv):
    print "Failed to initialize simulation."
    return

  sim.addStimulus("rectangular_current", { "amplitude": 18.0 }, group_1, 1.0, 0.0, 1.0)

#current_report = sim.addReport(group_2, "neuron", "synaptic_current", 1.0)
  current_report = sim.addReport(group_2, "neuron", "synaptic_current", 1.0,0.0,0.05)
  current_report.toStdOut()

  
  sim.run(duration = 0.05)
  return

if __name__ == "__main__":
  Run(sys.argv)

