Hi,
In my model I am using NetCon for connecting neurons. I have some doubts related to it. Could you please clarify it.
1) In NetCon can we pass array elements (time of spike) as a source variable
2) What kind of output is generated by NetStim? Is the NetStim output is stored in any global variable so we can look into the generated output.
Thank You.
NetStim and NetCon
Moderator: hines
-
- Site Admin
- Posts: 6386
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: NetStim and NetCon
No, but you would have discovered this fact by reading the Programmer's Reference documentation of the NetCon class. Presumably you have some precalculated spike times that you would like to use. Download and expand the gzipped tar file of NEURON's source code, then look at the files nrn/share/nrn/examples/nrniv/netcon/vecevent*In NetCon can we pass array elements (time of spike) as a source variable
Events.What kind of output is generated by NetStim?
Read the documentation of the NetCon class's record() method.Is the NetStim output is stored in any global variable so we can look into the generated output.
-
- Posts: 11
- Joined: Tue Feb 26, 2019 10:13 am
Re: NetStim and NetCon
Thanks Ted.
Is there any way to give a set of spike times as input to the model?
Is there any way to give a set of spike times as input to the model?
-
- Posts: 270
- Joined: Fri Nov 28, 2008 3:38 pm
- Location: Yale School of Public Health
Re: NetStim and NetCon
Yes.
If you're specifying each cell's inputs separately, as Ted pointed out, you can use VecStim (defined in vecevent.mod, which you'd have to include in your model and compile like any other mod file).
Here's an example, showing three inputs, two of which are able to cause a spike, one of which occurs during the refractory period:

The built-in way is to use PatternStim (there's an example at the link). It's a little more complicated to use for simple models, but it can specify inputs to all cells in one line.
If you're specifying each cell's inputs separately, as Ted pointed out, you can use VecStim (defined in vecevent.mod, which you'd have to include in your model and compile like any other mod file).
Here's an example, showing three inputs, two of which are able to cause a spike, one of which occurs during the refractory period:
Code: Select all
# libraries
import matplotlib.pyplot as plt
from neuron import h
from neuron.units import ms, mV
h.load_file('stdrun.hoc')
# specify the model
soma = h.Section(name='soma')
soma.L = soma.diam = 10
soma.insert('hh')
syn = h.ExpSyn(soma(0.5))
# specify the input times
spt = h.Vector([3 * ms, 10 * ms, 25 * ms])
try:
vs = h.VecStim()
except AttributeError:
# note: the current version of vecevent.mod is always available from:
# https://raw.githubusercontent.com/neuronsimulator/nrn/master/share/examples/nrniv/netcon/vecevent.mod
raise Exception(
"h.VecStim is not defined; did you forget to include and compile vecevent.mod?"
)
vs.play(spt)
# attach the VecStim to the synapse
nc = h.NetCon(vs, syn)
nc.weight[0] = 0.004
# setup reccordiing of the soma
v = h.Vector().record(soma(0.5)._ref_v)
t = h.Vector().record(h._ref_t)
# run the simulation
h.finitialize(-65 * mV)
h.continuerun(50 * ms)
# plot it
plt.plot(t, v)
plt.show()

The built-in way is to use PatternStim (there's an example at the link). It's a little more complicated to use for simple models, but it can specify inputs to all cells in one line.