Dear Jochen,

Thank you, that was very helpful!

Does this mean this I only have to create one spike detector (multimeter) and connect them to both the neuron populations?

Like this:

# create spikedetector and multimeter
spikedet = nest.Create('spike_detector')
multimet = nest.Create('multimeter', params={'record_from': ['V_m']})

# connect devices to both populations
nest.Connect(neurons_sub, spikedet)
nest.Connect(neurons_supra, spikedet)
nest.Connect(multimet, neurons_sub)
nest.Connect(multimet, neurons_supra)


On Fri, Feb 21, 2020 at 6:56 PM Jochen Martin Eppler <> wrote:

Dear Daphne,

there seems to be a misunderstanding about how the dc_generator works. Each stimulation device in NEST only has one set of parameters for all neurons it creates input for. In your situation, this means that you should rather create two independent dc_generators instead of just one. One would have its amplitude set to Asub, the other would have it set to Asupra:

dc_sub = nest.Create('dc_generator', params={'amplitude': Asub})
dc_supra = nest.Create('dc_generator', params={'amplitude': Asupra})

The way to have them stimulate only a subset of the neurons is by only connecting the generator to the neurons you want stimulated, i.e. the ones whose indices you draw. As indexing a neuron population by a list of indices is still under development and not quite ready yet, this becomes easier if you first draw the number of neurons for each population, create the corresponding number of neurons and connect the corresponding generator to all of them:

N_sub = np.random.randint(1, N_total)
neurons_sub = nest.Create('iaf_cond_alpha', N_sub)
neurons_supra = nest.Create('iaf_cond_alpha', N_total - N_sub)
nest.Connect(dc_sub, neurons_sub)
nest.Connect(dc_supra, neurons_supra)

I hope this helps.


On 21.02.20 18:15, Daphne Cornelisse wrote:

Dear nest community,

I have a network of 'iaf_cond_alpha' neurons and want to use the 'dc_generator' to apply two different current amplitudes to the network. (see code below)
  • A subset of the neurons should receive a sub-threshold amplitude so that they won't spike.
  • A subset of the neurons should receive a suprathreshold amplitude, making them spike.
I created a random number of indices of neurons that should receive a suprathreshold current, the rest of the neurons should receive the subthreshold current.

However, there doesn't seem any way to set the current amplitude to a subset of neurons. I have looked at all the examples using the dc_generator but couldn't find anything about it. 

How can this be done? Is it possible? If it's not possible could you point me to the source code so I could potentially write a something for it?

Thank you.

Kind regards,

=== code ===

np.random.seed(0) # for reproducibility

# amplitudes
Asub = 300.6
Asupra = 367.4

# list of all neurons
neuron_idx_lst = np.arange(0,N_total) 

# create random array, these are the neurons that should be stimulated with supra Amplitude
supra_indices = np.random.randint(1, N_total, size=int(N_total/neuron_groups-1))

# the rest should receive sub threshold current
sub_indices = np.setdiff1d(neuron_idx_lst,supra_indices)

# here is where it goes wrong
nest.SetStatus(dc_gen[supra_indices], params={'amplitude':Asupra, 'start':stim_start, 'stop':stim_end})

nest.SetStatus(dc_gen[sub_indices], params={'amplitude':Asub, 'start':stim_start, 'stop':stim_end})

>>> TypeError: tuple indices must be integers or slices, not tuple

NEST Users mailing list --
To unsubscribe send an email to

Dr. Jochen Martin Eppler
Phone: +49(2461)61-96653
Simulation Laboratory Neuroscience
Jülich Supercomputing Centre
Institute for Advanced Simulation 

Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDir Volker Rieke
Geschaeftsfuehrung: Prof. Dr.-Ing. Wolfgang Marquardt (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt

NEST Users mailing list --
To unsubscribe send an email to