I start off by setting up a template for a unitary EPSP. Then I have a master function that prepares the simulation, and outputs the data, and a little one at the end that places the synapses.
Code: Select all
begintemplate uEPSP //first argument is position. Second argument is delay
external dend
public syn
objref syn
proc init() {
objref syn
dend[38] syn = new AlphaSynapse($1)
syn.e = 0
syn.tau = 3
syn.gmax = 0.0003
syn.onset = $2
}
endtemplate uEPSP
objref esyn_list
esyn_list = new List()
proc TestDistrib() { local oldpos, start, end, oldtstop
somastim.amp = 0
dendstim.amp = 0
oldtstop = tstop
tstop = 3000
f3 = new File()
f3.aopen("distrib.txt")
oldpos = 1.1
for(p=20; p>=5; p-=1) {
dendV.record(&dend[38].v(p/20))
somaV.record(&soma.v(0.5))
tvec.record(&t)
dend[38] { dendstim.loc(p/20) } //dummy to keep track of where we ACTUALLY are
while(dendstim.get_loc()==oldpos) { //skip down till we get to a new section
p-=0.5
dend[38] { dendstim.loc(p/20) }
}
for(n=1; n<=16; n+=1) {
DistributeInputs(n, p/20)
init()
run()
start = tvec.indwhere(">=", 1999)
end = tvec.indwhere(">=", 2500)
f3.printf("%g\t", dendstim.get_loc()*dend[38].L + dend[37].L + dend[33].L) //distance of site
f3.printf("%g\t", n)
f3.printf("%g\t",somaV.max(start, end)-somaV.x[start])
f3.printf("%g\t", dendV.max(start, end)-dendV.x[start])
f3.printf("\n")
esyn_list.remove_all()
}
}
f3.close()
tstop=oldtstop
}
proc DistributeInputs() { localobj esyn //first argument is number of inputs. Second argument is location
for (i=1; i<=$1; i+=1) {
esyn = new uEPSP($2, 2000+((i-1)*0.6))
esyn_list.append(esyn.syn)
}
}