Good work. Here's a further revision that runs faster yet produces the same results.
Code: Select all
objref sti
sti = new NetStim()
sti.interval = 100
sti.start = 10
sti.number = 1e9 // no need to limit this
sti.noise = 1
objref con, nil, vec
con = new NetCon(sti,nil)
vec = new Vector()
con.record(vec)
tstop = 35000
cvode_active(1)
run()
objref isivec, hist
proc analyze() {
isivec = new Vector()
isivec.deriv(vec,1,1) // Euler deriv with dx == 1 yields vector of ISIs
print "mean ISI ", isivec.mean(), "based on ", isivec.size(), "samples"
print "ISI stdev ", isivec.stdev()
print "stdev/mean ", isivec.stdev()/isivec.mean()
print " "
hist = vec.histogram(0,tstop,20)
print "estimate from spike counts over 20 ms intervals: ", hist.var()/hist.mean()
}
analyze()
Comments:
1. The biophysical model cell requires numerical integration but adds nothing to the statistical evaluation. Just use the NetStim as an artificial spiking cell.
2. After the biophysical model cell has been eliminated, adaptive integration will execute extremely fast because the simulation is now an event-driven simulation (no numerical integration involved).
3. There's no need to limit the maximum number of spikes generated by the NetStim. Specifying a large number allows you to explore a much wider range of simulation times and total spike counts.
4. Vector class's deriv method using Euler method and "dx" parameter == 1 transforms recorded spike times to interspike intervals at machine language speeds.
You might try a run with tstop 1e6 ms and NetStim interval 1 ms, just to see how fast event-driven simulation can be.
Just execute
tstop = 1e6
sti.interval = 1
run()
analyze()
in that sequence at the interpreter's oc> prompt.