| 1 | """ |
|---|
| 2 | Simple network with a Poisson spike source projecting to a pair of IF_curr_alpha neurons |
|---|
| 3 | |
|---|
| 4 | Andrew Davison, UNIC, CNRS |
|---|
| 5 | August 2006 |
|---|
| 6 | |
|---|
| 7 | $Id: simpleNetwork.py 933 2011-02-14 18:41:49Z apdavison $ |
|---|
| 8 | """ |
|---|
| 9 | |
|---|
| 10 | import numpy |
|---|
| 11 | from pyNN import music |
|---|
| 12 | from pyNN.utility import get_script_args |
|---|
| 13 | |
|---|
| 14 | sim1,sim2 = music.setup(music.Config("nest", 1), music.Config("nest", 1)) |
|---|
| 15 | |
|---|
| 16 | tstop = 1000.0 |
|---|
| 17 | rate = 100.0 |
|---|
| 18 | |
|---|
| 19 | test=music.multisim.ProxySimulator() |
|---|
| 20 | test.setup(timestep=0.1) |
|---|
| 21 | sim1.setup(timestep=0.1, min_delay=0.2, max_delay=1.0) |
|---|
| 22 | sim2.setup(timestep=0.1, min_delay=0.2, max_delay=1.0) |
|---|
| 23 | |
|---|
| 24 | cell_params = {'tau_refrac':2.0,'v_thresh':-50.0,'tau_syn_E':2.0, 'tau_syn_I':2.0} |
|---|
| 25 | output_population = sim1.Population(2, sim1.IF_curr_alpha, cell_params, label="output") |
|---|
| 26 | |
|---|
| 27 | number = int(2*tstop*rate/1000.0) |
|---|
| 28 | numpy.random.seed(26278342) |
|---|
| 29 | spike_times = numpy.add.accumulate(numpy.random.exponential(1000.0/rate, size=number)) |
|---|
| 30 | |
|---|
| 31 | input_population = sim1.Population(1, sim1.SpikeSourceArray, {'spike_times': spike_times}, label="input") |
|---|
| 32 | |
|---|
| 33 | projection = sim1.Projection(input_population, output_population, sim1.AllToAllConnector()) |
|---|
| 34 | projection.set('weight', 1.0) |
|---|
| 35 | |
|---|
| 36 | input_population.record() |
|---|
| 37 | output_population.record() |
|---|
| 38 | output_population.record_v() |
|---|
| 39 | |
|---|
| 40 | music.run(tstop) |
|---|
| 41 | |
|---|
| 42 | output_population.printSpikes("Results/simpleNetwork_output_%s.ras" % 'nest') |
|---|
| 43 | input_population.printSpikes("Results/simpleNetwork_input_%s.ras" % 'nest') |
|---|
| 44 | output_population.print_v("Results/simpleNetwork_%s.v" % 'nest') |
|---|
| 45 | |
|---|
| 46 | music.end() |
|---|