I would like to create a SpikeGeneratorGroup with multiple “neurons” in it each running at a different frequency. I can specify the spike times for each neuron given their frequency but given the length of simulation and number of frequencies it on the order of 0.5 billion time points which is not ideal.
Alternatively I’ve tried creating a number of SpikeGeneratorGroup objects each with one neuron and connecting them independently and after about ~20 or so synapses it takes longer and longer to create the synapses (bordering on not feasible for larger numbers).
Is there a better/good way to do this?
Code to generate spike times
N = 20 neurons = NeuronGroup(N, model='model code here') T = [10, 20, 30, 40, 50] # period in ms times = [np.arange(0, 1000, per) for per in T] ixs = [[ix] * len(s) for ix, s in enumerate(times)] times = np.concatenate(times) * ms ixs = np.concatenate(ixs) input = SpikeGeneratorGroup(N, ixs, times) # periodic input @ 400Hz synapses = Synapses(input, neurons, on_pre='update code here') # connect input to neurons synapses.connect('i==j') # one synapse goes to one neuron
Code to generate multiple objects
N = 20 neurons = NeuronGroup(N, model='model code here') input =  synapses =  for ix in range(N): input.append(SpikeGeneratorGroup(1, ,  * ms, period= N * ms)) synapses.append(Synapses(input[-1], neurons, on_pre="update code here")) synapses[-1].connect(i=0, j=ix)