Why does play() cause the simulation to run so slowly (and why does the continuous = 1 arguement cause it to crash?)

Code: Select all

```
fixeddt = 0.05
objref summedEPSC
summedEPSC = new Vector()
obfunc createEPSC() {local factor, n, t localobj oneEPSC //$1=rise, $2=decay, $3=amplitude
oneEPSC = new Vector(10001)
factor = (($2/$1)^($2/($1-$2)))*(($2-$1)/$1)
for (n=0; n<10001; n+=1) {
t = n*fixeddt // n = sample number, t = time in ms
oneEPSC.x(n) = ($3)/factor*(exp(-t/$2)-exp(-t/$1))
}
return oneEPSC
}
proc preparePlayVector() {local n, EPSCdel localobj offsetEPSC //$1=number of EPSCs, $2=interevent interval, $3=decay
EPSCdel = 2000
offsetEPSC = new Vector(tstop/fixeddt)
summedEPSC.fill(0)
for (n = 0; n<$1; n+=1) {
offsetEPSC.fill(0)
offsetEPSC.copy(createEPSC(.5, $3, 0.02), (EPSCdel + n*$2)/fixeddt)
offsetEPSC.resize(tstop/fixeddt)
summedEPSC.add(offsetEPSC)
}
summedEPSC.play(&dendstim.amp, fixeddt) //THIS LINE HERE
}
proc dendEPSP() {local p, tau localobj f6
dendstim.del = 0
dendstim.amp = 0
dendstim.dur = 3000
somastim.del = 1e9
somastim.amp = 0
oldtstop = tstop
tstop = 3000
summedEPSC.resize(tstop/fixeddt)
f6 = new File()
f6.aopen("single.txt")
dend[38] for (p) {
dendV.record(&dend[38].v(p))
somaV.record(&soma.v(0.5))
tvec.record(&t)
for(tau=1; tau<=10; tau+=1) {
preparePlayVector(1, 30, tau)
init()
run()
start = tvec.indwhere(">=", 1999)
end = tvec.indwhere(">=", 3000)
f6.printf("%g\t", p*dend[38].L + dend[37].L + dend[33].L) //distance of site
f6.printf("%g\t", tau) // tau
f6.printf("%g\t", somaV.max(start, end)-somaV.x[start])
f6.printf("%g\t", dendV.max(start, end)-dendV.x[start])
f6.printf("\n")
}
}
f6.close()
tstop=oldtstop
}
```