After the helpful instruction to use a NetCon to deliver the VecStim spikes, I could not find a manual for VecStim. Using trial and error, I finally got it right. It turns out that in my previous post where I asked help for the following code snippet:
Code: Select all
objref vs
vs = new VecStim()
objref presynterminal
postsynneuron presynterminal = new NetCon(&vs.play(presynspiketimes), receptor, 0.5, 50, 1.0)
the solution was simply to add a missing line and make a small correction
Code: Select all
objref vs
vs = new VecStim()
vs.play(presynspiketimes) // missing
objref presynterminal
presynterminal = new NetCon(vs, receptor, 0.5, 50, 1.0) // correction
Instead of giving me the correction, it was suggested that I (1) start by setting up a model in which a NetStim sends events to an IntFire1, (2) once you have that working, replace the IntFire1 with an ExpSyn attached to a single compartment soma and (3) after you have that working, substitute a VecStim for the NetStim. I reached up to part 2 but part 3 didn't work because I did not find instructions on the use of VecStim.
I believe the strategy used to answer my question was to help me learn more about NEURON programming but I don't think the lack of manuals for VecStim support this teaching approach. The steps I learned to use NetStim and IntFire1 did not lead me to the solution. They may be useful to me in the future if I have use for NetStim and IntFire1. Under these conditions, providing the simple correction to my code would have been a worthy method of teaching. In fact, the manuals for NEURON have many examples to teach users. It's a judgement call as to which is the better teaching method. There's probably not one method for all cases. Obviously, I think that in this case where there are no manuals on how to use VecStim, providing the simple correction would of been better.
To help others like me who do poorly without manuals and learn well with examples, I provide below 2 fully working examples of "Driving a synapse with recorded or precomputed spike events". The first uses FInitializeHandler and the second uses VecStim.
1. Driving a synapse with recorded or precomputed spike events using FInitializeHandler
Code: Select all
// postsynaptic neuron
create postsynneuron
forall {
nseg = 1 // segments
diam = 18.8 // diameter
L = 18.8 // length
Ra = 123.0 // axial resistance
insert hh // insert Hodgkin-Huxley currents for resting and action potential
gnabar_hh=0.25 // maximum sodium conductance
gl_hh = .001666 // leak conductance
el_hh = -60.0 // leak equilibrium potential (ie. resting potential)
}
access postsynneuron
// add receptor to postsynaptic neuron
objref receptor
postsynneuron receptor = new ExpSyn(0.3)
// vector with presynaptic spike times in ms
objref presynspiketimes
presynspiketimes = new Vector()
presynspiketimes.append(50,100,150)
// play presynspiketimes on receptor
objref presynterminal,nil
postsynneuron presynterminal = new NetCon(nil, receptor, 0.5, 50, 1.0)
objref fih
fih = new FInitializeHandler("loadqueue()")
proc loadqueue() { local ii
for ii=0,presynspiketimes.size()-1 presynterminal.event(presynspiketimes.x[ii])
// author states that only a few dozen spikes can be loaded but I easily loaded 20000
}
// setup run
v_init = -62.6
tstop=200
// draw postsynaptic voltage
objref fig
fig = new Graph(0)
fig.view(0, -80, tstop, 120, 435, 72, 485.76, 200.32)
fig.addexpr("postsynneuron.v(.5)", 1, 1, 0.8, 0.9, 2)
graphList.append(fig)
// run
run()
2. Driving a synapse with recorded or precomputed spike events using VecStim
Code: Select all
// create postsynaptic neuron
create postsynneuron
forall {
nseg = 1 // segments
diam = 18.8 // diameter
L = 18.8 // length
Ra = 123.0 // axial resistance
insert hh // insert Hodgkin-Huxley currents for resting and action potential
gnabar_hh=0.25 // maximum sodium conductance
gl_hh = .001666 // leak conductance
el_hh = -60.0 // leak equilibrium potential (ie. resting potential)
}
access postsynneuron
// add receptor to postsynaptic neuron
objref receptor
postsynneuron receptor = new ExpSyn(0.3)
//[1'] VecStim as source of spikes
objref presynspiketimes
presynspiketimes = new Vector()
presynspiketimes.append(50,100,150)
objref vs
vs = new VecStim()
vs.play(presynspiketimes)
//[2'] play presynaptic spike times on receptor
objref presynterminal
presynterminal = new NetCon(vs,receptor,0.5,5,1.0)
// setup run
v_init = -62.6
tstop=200
// draw postsynaptic voltage
objref fig
fig = new Graph(0)
fig.view(0, -80, tstop, 120, 435, 72, 485.76, 200.32)
fig.addexpr("postsynneuron.v(.5)", 1, 1, 0.8, 0.9, 2)
graphList.append(fig)
// run
run()
I sincerely hope this helps others looking for methods on "Driving a synapse with recorded or precomputed spike events".