I am trying to plot the network of a model uploaded in ModelDB. Although I can see the space plot while the code is running, when it comes to end of code it disappears suddenly. What might be the reason for this problem? Since there are lots of template and hoc files, I could only write the main part of the code to the below.
Thanks for your kindly interest and help.
Code: Select all
func onerun() {local id, num, ipspg, pyrthr, basketthr, pyr_spike_tau, bask_spike_tau, bask_perc, temp_time, temp_tau,ii localobj pc, fo, fo1, forast
id= hoc_ac_
pc = new ParallelContext()
s=new Shape()
{pr = new TGbignet2()} ////main program to build the network and generate stimuli and noise
s.show(0)
if(doextra) {
print "Doing EXTRACELLULAR stuff..... ....."
setpointers()
setelec(-50, 0, 0)
}
print "id_world number ", pc.id_world, " id_bbs ", pc.id_bbs, " id ", id, " pc.id ", pc.id
{pr.recordVoltages()}
{pr.pnm.set_maxstep(0.01)}
{pr.pnm.want_all_spikes()}
runningTime = startsw()
stdinit()
bask_perc=$3 //percentage of inhibitory connections that are allowed to exist
ipspg=$4
g_ind=$5
prinit(bask_perc,ipspg,g_ind) //added this extra function to allow for non-pr functions. The input is passed to connectNetwork as the connthr
normmean=0 //can set this to $5 if useful in the future
pyr_spike_tau=$1
print pyr_spike_tau
print "pyr_spike_tau"
pyr_nospike_tau=1e9
bask_spike_tau=$2
bask_nospike_tau=1e9
{ pr.activatePyrSynapses(pyr_spike_tau,pyr_nospike_tau) }
{ pr.activateAntSynapses(pyr_spike_tau,pyr_nospike_tau) }
{ pr.activateBaskSynapses(bask_spike_tau,bask_nospike_tau) }
{ pr.addAntennaDC(antennaDC) }
pc.post(id, pyrthr, ipspg, basketthr)
forast = new File()
sprint(cmd, "data/spikes_b%4.2f_p%4.2f_g%4.2f_f%d.dat", bask_spike_tau, pyr_spike_tau, ipspg,bask_perc)
{ forast.wopen(cmd) }
t_curr = 0
while (t_curr < Tstop-dt){ //include the '-dt' to account for rounding error; otherwise, may get error in writeVoltages
print "Time = ",t_curr
if(t_curr + t_seg < Tstop) {
{ pr.pnm.pcontinue(t_curr+t_seg)}
} else {
{pr.pnm.pcontinue(Tstop)}
}
for i=0, pr.pnm.spikevec.size-1 {
forast.printf("%-10.6lf, %d\n", pr.pnm.spikevec.x[i], pr.pnm.idvec.x[i])
}
pr.pnm.spikevec.resize(0)
pr.pnm.idvec.resize(0)
pr.writeVoltages(bask_spike_tau, pyr_spike_tau, ipspg, bask_perc,t_curr)
t_curr = t_curr + t_seg
}
{forast.close()}
runningTime = startsw() - runningTime
iteration=iteration+1
print "Running Time: ", runningTime, "iteration: ",iteration
if (realrunFlag){
{fo=new File()}
{sprint(cmd, "spikes_b%4.2f_p%5.3f_g%4.2f_f%d.dat", bask_spike_tau, pyr_spike_tau,ipspg,bask_perc)}
{fo.aopen("data/spikelog.dat")}
{fo.printf("%s\n",cmd)}
{fo.close()}
{fo=new File()}
{sprint(cmd, "sum_b%4.2f_p%5.3f_g%4.2f_f%d.dat", bask_spike_tau, pyr_spike_tau,ipspg,bask_perc)}
{fo.aopen("data/sumlog.dat")}
{fo.printf("%s\n",cmd)}
{fo.close()}
pr.writeParameters(bask_spike_tau, pyr_spike_tau, gapstyle, ipspg, bask_nospike_tau, pyr_nospike_tau, antennaDC, Tstop, t_seg) //write parameters to file
}
{pc.gid_clear()}
{pr.pnm.pc.gid_clear()}
pr=nil
return id
}