Version 1 (modified by mstimberg, 12 months ago)

--

SpikeGeneratorGroup? with an array of indices/times

Description: None

Setup code


from brian import *
set_global_preferences(useweave=False, usecodegen=False, usecodegenweave=False)
log_level_error() # do not show warnings    

N = 200
rate = 250
dt = defaultclock.dt
defaultclock.reinit()

#The spike times are shifted by half a dt to center the spikes in the bins
times = arange(0, 1., 1. / rate)             

stim_type = 'array' #will be replaced from outside 

if stim_type == 'pairs':            
    spiketimes = [(idx, t*second +dt/2) for idx in xrange(N) for t in times]            
elif stim_type == 'array':
    spiketimes = vstack([array([n, t]) for t in times for n in xrange(N)])                      

Benchmarked code


G = SpikeGeneratorGroup(N, spiketimes)
net = Network(G)
net.prepare()
net.run(1 * second)

Benchmark results

Attachments