def ap_test(template_class, tree, v_init): cell = cells.make_neurotree_cell(template_class, neurotree_dict=tree) h.dt = 0.025 prelength = 100.0 stimdur = 10.0 soma = list(cell.soma)[0] initial_amp = 0.05 h.tlog = h.Vector() h.tlog.record(h._ref_t) h.Vlog = h.Vector() h.Vlog.record(soma(0.5)._ref_v) thr = cells.find_spike_threshold_minimum(cell, loc=0.5, sec=soma, duration=stimdur, initial_amp=initial_amp) f = open("HIPPCell_ap_results.dat", 'w') f.write("## current amplitude: %g\n" % thr) f.close() f = open("HIPPCell_voltage_trace.dat", 'w') for i in range(0, int(h.tlog.size())): f.write('%g %g\n' % (h.tlog.x[i], h.Vlog.x[i])) f.close()
def measure_ap (gid, pop_name, v_init, env, 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 prelength = 100.0 stimdur = 10.0 soma = list(hoc_cell.soma)[0] initial_amp = 0.05 h.tlog = h.Vector() h.tlog.record (h._ref_t) h.Vlog = h.Vector() h.Vlog.record (soma(0.5)._ref_v) thr = cells.find_spike_threshold_minimum(hoc_cell,loc=0.5,sec=soma,duration=stimdur,initial_amp=initial_amp) results = { 'spike threshold current': np.asarray([thr], dtype=np.float32), 'spike threshold trace t': np.asarray(h.tlog.to_python(), dtype=np.float32), 'spike threshold trace v': np.asarray(h.Vlog.to_python(), 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