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.

Cheers,
Jochen!


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,
Daphne 


=== 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 -- users@nest-simulator.org
To unsubscribe send an email to users-leave@nest-simulator.org

-- 
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
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------