times = 0
load_file("nrngui.hoc")
load_file("../../template/load_templates.hoc")
objref econ
show_errs=1
debug_lev=1
econ=new ExperimentControl(show_errs,debug_lev)
econ.self_define(econ)
econ.morphology_dir = "../../morphology/n123"
econ.add_lib_dir("Terrence","../../lib")
econ.generic_dir = "../../experiment/"
econ.data_dir = "data"
sprint(econ.syscmd, "mkdir -p %s", econ.data_dir)
system(econ.syscmd)
actual_resolution=75
desired_resolution=1
econ.xopen_geometry_dependent("cell")
econ.xopen_geometry_dependent("cell-analysis")
cell_analysis(econ)
printf("Opening cell setup\n")
econ.xopen_generic("cell-setup")
printf("Opened. Setting up cell\n")
maximum_segment_length=actual_resolution
cell_setup(econ)
econ.defvar("Simulation Control", "tstop", "250", "Defines when the simulation stops.")
econ.defvar("Simulation Control", "dt", "0.1", "Timestep")
econ.defvar("Simulation Control", "steps_per_ms", "10", "How many points are plotted per ms")
setdt()
econ.xopen_geometry_dependent("nmda-ampa-ratio")
strdef tunings_file, select, temp, accstr
objref tune_epsp_list
tune_epsp_list=new List()
sprint(tunings_file, "%s", "tunings")
xopen("../tune-synapses/tunings.dat")
econ.xopen_library("Terrence","choose-secs")
econ.xopen_library("Terrence","salloc")
econ.xopen_library("Terrence","deduce-ratio")
econ.xopen_library("Terrence","basic-graphics")
econ.xopen_library("Terrence","spikecount")
temporal_offset=10
all_synapses = 100
objref ampa[all_synapses], nmda[all_synapses], splot
objref somavrec, vf, vtip[2], somarecf, dendrecf
objref tip_list, vsoma, rpid, sl, Branch_ref[all_synapses]
double synapses[2], maxdendrec[2], meandendrec[2]
synapses[0] = 0
synapses[1] = 0
max_cases = 41
double all_syn[2*max_cases]
max_syn = 14
all_syn[0] = 2
all_syn[1] = 2
all_syn[2] = 2
all_syn[3] = 4
all_syn[4] = 4
all_syn[5] = 2
all_syn[6] = 2
all_syn[7] = 6
all_syn[8] = 6
all_syn[9] = 2
all_syn[10] = 2
all_syn[11] = 8
all_syn[12] = 8
all_syn[13] = 2
all_syn[14] = 2
all_syn[15] = 10
all_syn[16] = 10
all_syn[17] = 2
all_syn[18] = 2
all_syn[19] = 14
all_syn[20] = 14
all_syn[21] = 2
all_syn[22] = 4
all_syn[23] = 6
all_syn[24] = 6
all_syn[25] = 4
all_syn[26] = 4
all_syn[27] = 8
all_syn[28] = 8
all_syn[29] = 4
all_syn[30] = 4
all_syn[31] = 10
all_syn[32] = 10
all_syn[33] = 4
all_syn[34] = 4
all_syn[35] = 12
all_syn[36] = 12
all_syn[37] = 4
all_syn[38] = 4
all_syn[39] = 14
all_syn[40] = 14
all_syn[41] = 4
all_syn[42] = 6
all_syn[43] = 8
all_syn[44] = 8
all_syn[45] = 6
all_syn[46] = 6
all_syn[47] = 10
all_syn[48] = 10
all_syn[49] = 6
all_syn[50] = 6
all_syn[51] = 12
all_syn[52] = 12
all_syn[53] = 6
all_syn[54] = 6
all_syn[55] = 14
all_syn[56] = 14
all_syn[57] = 6
all_syn[58] = 8
all_syn[59] = 10
all_syn[60] = 10
all_syn[61] = 8
all_syn[62] = 8
all_syn[63] = 12
all_syn[64] = 12
all_syn[65] = 8
all_syn[66] = 8
all_syn[67] = 14
all_syn[68] = 14
all_syn[69] = 8
all_syn[70] = 10
all_syn[71] = 12
all_syn[72] = 12
all_syn[73] = 10
all_syn[74] = 10
all_syn[75] = 14
all_syn[76] = 14
all_syn[77] = 10
all_syn[78] = 12
all_syn[79] = 14
all_syn[80] = 14
all_syn[81] = 12
tip_list=new SectionList()
forsec apical_tip_list {
tip_list.append()
}
forsec apical_tip_list_addendum {
tip_list.append()
}
m=0
forsec tip_list {
Branch_ref[m] = new SectionRef()
m = m + 1
}
Deadtime_GLU=dt
Deadtime_NMDA=dt
hertz=2
synch=1
perio=0
dendritic_spike_threshold=-25
somatic_spike_threshold=0
proc Ca_block(){
forall if(ismembrane("cat")) {
for (x) { gcatbar_cat(x) = 0 }
}
forall if(ismembrane("calH")) {
for (x) { gcalbar_calH(x) = 0 }
}
forall if(ismembrane("cal")) {
for (x) { gcalbar_cal(x) = 0 }
}
forall if(ismembrane("car")) {
for (x) { gcabar_car(x) = 0 }
}
forall if(ismembrane("somacar")) {
for (x) { gcabar_somacar(x) = 0 }
}
}
proc Na_block(){
forall if(ismembrane("hha2")) {
for (x) { gnabar_hha2(x) = 0 }
}
forall if(ismembrane("hha_old")) {
for (x) { gnabar_hha_old(x) = 0 }
}
}
proc NMDA_block(){
for i=0, synapses[0] + synapses[1] -1 {
nmda[i].gmax = 0
}
}
proc A_block() {
f = 0
forall if(ismembrane("kad")) {
for(x) { gkabar_kad(x)= gkabar_kad(x)*f }
} else if(ismembrane("kap")) {
for(x) { gkabar_kap(x)= gkabar_kap(x)*f }
}
}
proc A_NMDA_block(){
NMDA_block()
A_block()
}
if (times == 0 || times == 2) {
temporal_offset = 10
}else {
temporal_offset = 120
}
tstop = tstop + temporal_offset
addgraph_2("soma.v(0.5)",0,tstop, -72,-10)
r = 3
for try = 1, 30 {
r = r + 1
sl = new SectionList()
rpid = new Random(r)
PID = rpid.discunif(0,m)
access Branch_ref[PID].sec
sl.append()
rpid = new Random(2*r+1)
PID = rpid.discunif(0,m)
access Branch_ref[PID].sec
sl.append()
for c = 0, max_cases-1 {
k=-1
splot=new Shape()
all_synapses = 0
strdef dir_str
sprint(dir_str, "data/%s/Apical_Tips/Shock/Both_Tips/",tunings_file)
forsec sl {
k = k+1
synapses[k]= all_syn[2*c+k]
print secname(), "is where we assess potency."
COLOR=k+2
t = 0
if ( k > 0) { t = k*synapses[k-1] }
nseg = synapses[k]
for si=1,synapses[k] {
posn = (2*si -1)/(2*synapses[k])
ampa[t+si-1] = new GLU(posn)
nmda[t+si-1] = new NMDA(posn)
salloc(ampa[t+si-1],nmda[t+si-1],posn)
splot.point_mark(ampa[t+si-1],COLOR)
}
splot.flush()
splot.show(1)
sprint(dir_str, "%s%s", dir_str, secname())
all_synapses = all_synapses + synapses[k]
strdef recordsec
sprint(recordsec, "%s.v(0.5)",secname())
if (c==0) {
addgraph_2(recordsec,0,tstop,-72,-10)
}
}
GABA_flag = 0
econ.xopen_library("Terrence","shiftsyn-initA")
shiftsyn_init(all_synapses,tstop,dt,hertz,synch,perio,PID,temporal_offset,GABA_flag,"ampa","nmda")
if (times == 0) {
sprint(select, "%s", "control")}
if (times == 1) {
A_block()
sprint(select, "%s", "block_A")}
if (times == 2) {
NMDA_block()
sprint(select, "%s", "block_NMDA")}
if (times == 3) {
A_NMDA_block()
sprint(select, "%s", "block_A_NMDA")}
if (times == 4) {
Na_block()
sprint(select, "%s", "block_Na")}
if (times == 5) {
Ca_block()
sprint(select, "%s", "block_Ca")}
print "secname = ", secname(), " synapses[1] = ", synapses[0], " synapses[2] = ", synapses[1], "case = ", select
somavrec=new Vector(tstop/dt)
somavrec.record(&soma.v(0.5))
ind=0
forsec sl {
vtip[ind]=new Vector(tstop/dt)
sprint(temp, "vtip[%d].record(&%s.v(0.5))", ind, secname())
execute1(temp)
ind=ind+1
}
finitialize(v_init)
fcurrent()
run()
meanvrec = somavrec.mean(temporal_offset/dt,tstop/dt -1)
maxvrec = somavrec.max(temporal_offset/dt,tstop/dt -1)
ind = 0
forsec sl {
meandendrec[ind] = vtip[ind].mean(temporal_offset/dt,tstop/dt -1)
maxdendrec[ind] = vtip[ind].max(temporal_offset/dt,tstop/dt -1)
ind = ind + 1
}
soma_spikes = spikecount(somavrec,somatic_spike_threshold)
sprint(econ.syscmd, "mkdir -p %s", dir_str)
system(econ.syscmd)
vf=new File()
sprint(econ.tmp_str2, "%s/%s_shock", dir_str, select)
vf.aopen(econ.tmp_str2)
vf.printf("%d %g %g %g %g %g %g %g %g\n", synapses[0], synapses[1], meanvrec, maxvrec, meandendrec[0], maxdendrec[0], meandendrec[1], maxdendrec[1], soma_spikes)
vf.close()
sprint(econ.tmp_str, "%s", dir_str)
somarecf=new File()
sprint(temp, "%s/Vsoma_%d_%d", dir_str, synapses[0], synapses[1])
somarecf.wopen(temp)
somavrec.printf(somarecf, "%g\n")
somarecf.close()
econ.xopen_library("Terrence","verbose-system")
for i=0,windex {
sprint(econ.tmp_str, "%s", dir_str)
sprint(econ.tmp_str2, "%s/graph-syns=%d_%d-%d.eps",econ.tmp_str, synapses[0], synapses[1], i)
win[i].printfile(econ.tmp_str2)
}
}
}