def measure_passive (gid, pop_name, v_init, env, prelength=1000.0, mainlength=2000.0, stimdur=500.0, cell_dict={}): biophys_cell = init_biophys_cell(env, pop_name, gid, register_cell=False, cell_dict=cell_dict) hoc_cell = biophys_cell.hoc_cell h.dt = env.dt tstop = prelength+mainlength soma = list(hoc_cell.soma)[0] stim1 = h.IClamp(soma(0.5)) stim1.delay = prelength stim1.dur = stimdur stim1.amp = -0.1 h('objref tlog, Vlog') h.tlog = h.Vector() h.tlog.record (h._ref_t) h.Vlog = h.Vector() h.Vlog.record (soma(0.5)._ref_v) h.tstop = tstop Rin = h.rn(hoc_cell) neuron_utils.simulate(v_init, prelength, mainlength) ## compute membrane time constant vrest = h.Vlog.x[int(h.tlog.indwhere(">=",prelength-1))] vmin = h.Vlog.min() vmax = vrest ## the time it takes the system's step response to reach 1-1/e (or ## 63.2%) of the peak value amp23 = 0.632 * abs (vmax - vmin) vtau0 = vrest - amp23 tau0 = h.tlog.x[int(h.Vlog.indwhere ("<=", vtau0))] - prelength results = {'Rin': np.asarray([Rin], dtype=np.float32), 'vmin': np.asarray([vmin], dtype=np.float32), 'vmax': np.asarray([vmax], dtype=np.float32), 'vtau0': np.asarray([vtau0], dtype=np.float32), 'tau0': np.asarray([tau0], dtype=np.float32) } env.synapse_attributes.del_syn_id_attr_dict(gid) if gid in env.biophys_cells[pop_name]: del env.biophys_cells[pop_name][gid] return results
def passive_test(template_class, tree, v_init): cell = cells.make_neurotree_cell(template_class, neurotree_dict=tree) h.topology() h.dt = 0.025 prelength = 1000 mainlength = 2000 tstop = prelength + mainlength stimdur = 500.0 soma = list(cell.soma)[0] stim1 = h.IClamp(soma(0.5)) stim1.delay = prelength stim1.dur = stimdur stim1.amp = -0.1 h.tlog = h.Vector() h.tlog.record(h._ref_t) h.Vlog = h.Vector() h.Vlog.record(soma(0.5)._ref_v) h.tstop = tstop neuron_utils.simulate(v_init, prelength, mainlength) ## compute membrane time constant vrest = h.Vlog.x[int(h.tlog.indwhere(">=", prelength - 1))] vmin = h.Vlog.min() vmax = vrest ## the time it takes the system's step response to reach 1-1/e (or ## 63.2%) of the peak value amp23 = 0.632 * abs(vmax - vmin) vtau0 = vrest - amp23 tau0 = h.tlog.x[int(h.Vlog.indwhere("<=", vtau0))] - prelength f = open("HIPPCell_passive_results.dat", 'w') f.write("DC input resistance: %g MOhm\n" % h.rn(cell)) f.write("vmin: %g mV\n" % vmin) f.write("vtau0: %g mV\n" % vtau0) f.write("tau0: %g ms\n" % tau0) f.close()