Start by fixing the hoc code, which contains at least one latent bug that waits to bite you, and also applies an inefficient method for implementing synaptic activations at user-specified times.
The bug is here
Code: Select all
soma {
. . .
syn[0] = new Exp2Syn(.5)
nc[0] = new NetCon(&v(0.5), syn[0])
which sets up an autapse with soma as the pre- and postsynaptic element. Unless you really want that, please re-read the Programmer's Reference documentation about the NetCon class, with particular attention to the different kinds of sources that may be used.
The inefficiency is here
Code: Select all
objref fih
fih = new FInitializeHandler("loadqueue()")
proc loadqueue() { local ii
for ii=0,syntimes.size()-1 nc[0].event(syntimes.x[ii])
}
which loads all user-specified event times into the event queue at initialization. This doesn't scale well, because the compuational overhead involved in managing the event queue depends on the number of events that have not yet been delivered. By stuffing all events into the queue at the start of a simulation, you're adding a bit of extra runtime. Yes, I did post an example of this on the Forum some time ago, but it isn't good practice. I have learned better since then, and now must make amends. A far better way to proceed is to use an instance of the VecStim class. A VecStim is a kind of artificial spiking cell, but it's not a variant of "leaky integrate and fire." Instead, its spike times are defined by the contents of a Vector. Look in
nrn-x.x/share/examples/nrniv/netcon (UNIX/Linux/OS X)
or
nrnxx/share/examples/nrniv/netcon (MSWin)
for vecevent.hoc .mod, and .ses. vecevent.mod defines the VecStim class; the .ses and .hoc files are a program that demonstrates its operation. Notice that there is no need to use an FInitiailzeHandler to load anything into the event queue. Just
Code: Select all
objref vs
vs = new VecStim()
// now use a NetCon to attach vs to the target synaptic mechanism
. . . you already know how . . .
. . . don't forget to specify the NetCon's delay and weight . . .
// next comes code to set up your vector of event times
objref syntimes
syntimes = new Vector()
. . . fill syntimes with desired event times . . .
vs.pp.play(syntimes)
and every time you run a simulation the synaptic mechanism will be "pinged" at the desired times.
Once all of this is working in hoc, you can try implementing it in Python.