Page 1 of 1

Insert a spike train into a cell

Posted: Tue Nov 09, 2010 5:46 am
by bkaplan
I want to insert a spike train into a cell via a synapse, e.g. ExpSyn.
How do I do that in Python?
I could not manage to translate my hoc code which does exactly that, so I wondered if there is maybe another way.
The hoc code which works makes use of the FInitializeHandler which then calls a function to insert the spike times into the cell's netconlist:

Code: Select all

    fih = new FInitializeHandler("initspikes()")

proc initspikes(){
...for (int i=0; i<stvec.size(); i+=1) {
   cell.netconlist.o(0).event(stvec.x[i]) //stvec contains the spiketimes
// the cell template includes something like:
        soma syn = new ExpSyn(0.5)
        synlist.append(syn) //synlist[0]
        nc = new NetCon(nullobject, syn, threshold, delay, weight)
        netconlist.append(nc) //netconlist[0]
I tried translating that to Python, but the error message was that the initspikes function was not found:

Code: Select all

NEURON: initspikes undefined function
Even though I would prefer to have an implementation where I have control of the input spike train, I also tried to use a NetStim object, but this simply did not deliver any events.
Would be great if someone could post some python code, which does the job.
Many thanks in advance!