vector.play massively slowing down simulation
Posted: Wed Oct 23, 2013 9:53 am
So I have a multicompartment model, that usually only takes a few milliseconds to run a 3000 ms simulations. I'm trying to play in arbitrary currents. However, as soon as I include the vector.play() function, the simulation slows down by about a factor of 1,000,000. The analysis code is listed below. The code runs in usual rapid fashion if I comment out the line summedEPSC.play(&dendstim.amp, fixeddt). I'm running version 7.2. It doesn't seem to matter if I run in fixed time step, or variable time step. I also tried using summedEPSC.play(&dendstim.amp, fixeddt, 1), however, that causes neuron to crash with no errors reported.
Why does play() cause the simulation to run so slowly (and why does the continuous = 1 arguement cause it to crash?)
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
}