import pyNN.nest as pynn

import numpy
import pylab

pynn.setup(timestep=0.1)

numCellsExc = 2
numCellsInh = 2 

w_exc = 0.0002 # uS
w_inh = 0.0008 # uS

expDuration = 1000 # msec 

if_cond_exp_params = {  
    'tau_m'         : 20.0,	
    'i_offset'      :  0.1,
    'tau_refrac'    :  3.0,
    'v_thresh'      :-63.0,
    'tau_syn_E'     : 30.0,
    'tau_syn_I'     : 30.0,
    'v_reset'       :-69.0,
    'e_rev_E'       :  0.,
    'e_rev_I'       :-70.,
    'v_init'        :-70.0
}

cells_exc = pynn.create(pynn.IF_cond_exp, if_cond_exp_params, n=numCellsExc)
cells_inh = pynn.create(pynn.IF_cond_exp, if_cond_exp_params, n=numCellsInh)

pynn.connect(source=cells_inh, target=cells_exc, weight=w_inh, synapse_type='inhibitory')
pynn.connect(source=cells_inh, target=cells_inh, weight=w_inh, synapse_type='inhibitory')

pynn.record(cells_exc, 'spikes_nest.dat')    

pynn.run(expDuration)
pynn.end() 




