objref inp numodors=6 double odors[numodors][5] inp=new File() inp.ropen("odors.txt") for od=0, numodors-1 { for tf=0, 4 { odors[od][tf]=inp.scanvar() print " odor ",od, " mitral ",tf, odors[od][tf] } } inp.close() begintemplate OBStim public nc, mgid, exists, ww,si,sw, endod, start, odors external cvode objref nc, rinterval, rweight, fih, this proc init(){localobj cell, pc, nil pc = new ParallelContext() exists = 0 // $1 is mitral_gid mgid = $1 si=1 sw=1 ww=0 endod=10000 start = 2 if (pc.gid_exists(mgid)) { exists = 1 seed_interval = si*10000 + 1 seed_weight = sw*10000 + 5000 // seed_interval = mgid*10000 + 1 // seed_weight = mgid*10000 + 5000 cell = pc.gid2cell(mgid) nc = new NetCon(nil, cell.synodor) nc.delay = 0.5 fih = new FInitializeHandler(0, "init_ev()", this) } } proc init_ev() { printf("%s t=%g %g\n", this, t, start) rinterval = new Random() rinterval.MCellRan4(seed_interval) rinterval.uniform(100, 250) rweight = new Random() rweight.MCellRan4(seed_interval) rweight.uniform(0.4, 0.5) cvode.event(t + start, "ev()")//, this) nc.event(t + start + nc.delay) nc.weight = 0 } proc ev() {local next if (1) { nc.weight = ww*rweight.repick()*1e-3 } next = rinterval.repick() // next = 220 printf("%s t=%g %g w=%g\n", this, t, next, nc.weight) next += t if (next