def current(loci, ail): cell = nm.NeuronModel(dl=1000, dd=2, sl=40, sd=20,\ hl=10, hd=2, ail=ail, aid=1.2, axl=1000, axd=1.2,\ dna=100, sna=100, hna=300, aina=4000, axna=300, dk=20,\ sk=20, hk=150, aik=1000, axk=150,\ na_type=7, aina12=1000, aina16=1000) stim = nm.attach_current_clamp(cell, amp=1, dur=1) vec = nm.set_recording_vectors(cell) v = h.Vector() v.record(cell.ais(loci)._ref_v) icap = h.Vector() # (mA/cm2) icap.record(cell.ais(loci)._ref_i_cap) ileak = h.Vector() # (mA/cm2) ileak.record(cell.ais(loci)._ref_i_pas) ina = h.Vector() # (mA/cm2) ina.record(cell.ais(loci)._ref_ina) ik = h.Vector() # (mA/cm2) ik.record(cell.ais(loci)._ref_ik) nm.simulate() print(nm.cal_velocity(vec, ["ais"])) iax = -np.array(icap.to_python()) - np.array(ileak.to_python()) - np.array( ina.to_python()) - np.array(ik.to_python()) cell.dend1 = None cell.soma = None cell.hill = None cell.ais = None cell.axon = None for sec in h.allsec(): print(sec) return v, icap, ileak, ina, ik, iax
na16_map_i = 4 aina12_i = 5000 aina16_i = 12000 na_type_i = 6 aik_i = 3000 hna_i = 300 hk_i = 200 hl_i = 15 ail_i = 40 hd_i = 4 for j, l in enumerate(len_x): with open(data_path + 'dist_' + str(hl_i) + '_len_' + str(l) + '_v_vec.p', 'rb') as file: vec = pickle.load(file) bpv_len_sum[0, j], fwv_len_sum[0, j], ___ = nm.cal_velocity(vec, ['ais']) for j, d in enumerate(dist_x): with open(data_path + 'dist_' + str(d) + '_len_' + str(ail_i) + '_v_vec.p', 'rb') as file: vec = pickle.load(file) bpv_dist_sum[0, j], fwv_dist_sum[0, j], ___ = nm.cal_velocity(vec, ['ais']) # best param title = 'na12_map = ' + str(na12_map_i) + ' na16_map = ' + str( na16_map_i) + '\n\ aina12 = ' + str(aina12_i) + ' aina16 = ' + str(aina16_i) + '\n\ na_type = ' + str(na_type_i) + ' aik = ' + str(aik_i) + '\n\ hna = ' + str(hna_i) + ' hk = ' + str(hk_i) + '\n\ hl = ' + str(hl_i) + ' ail = ' + str(ail_i) nm.show_data_fit(bpv_len_sum, fwv_len_sum, bpv_dist_sum, fwv_dist_sum, title)
+'_aik_'+str(aik_x[p])\ +'_dist_'+str(d)+'_len_'+str(l)+'_v_vec.p' print(na_type, p, d, l) cell = nm.NeuronModel(hl=int(d),\ ail=int(l),\ na_type=na_type,\ aina12=aina12_x[p],\ aina16=aina16_x[p],\ aik=aik_x[p]) stim = nm.attach_current_clamp(cell, amp=.7) vec = nm.set_recording_vectors(cell) nm.simulate() nm.save_vec(vec, save_data_path + file_name) nm.show_output(vec, save_figure_path + file_name) bpv_sum[i, j], fwv_sum[i, j], ___ = nm.cal_velocity(vec, ['ais']) cell.dend1 = None cell.dend2 = None cell.soma = None cell.hill = None cell.ais = None cell.axon = None for sec in h.allsec(): print(sec) with open(save_data_path+'type'+str(na_type)\ +'_aina12_'+str(aina12_x[p])\ +'_aina16_'+str(aina16_x[p])\ +'_aik_'+str(aik_x[p])\ +'_bpv.p', 'wb') as file: pickle.dump(bpv_sum, file) with open(save_data_path+'type'+str(na_type)\
stim = nm.attach_current_clamp(cell, amp=.7) vec = nm.set_recording_vectors(cell) nm.simulate() nm.save_vec(vec, save_data_path\ +'type2_map1'\ +'_aina12_'+str(aina12_x[p])\ +'_aina16_'+str(aina16_x[p])\ +'_aik_'+str(aik_x[p])\ +'_dist_'+str(d)+'_len_'+str(l)+'_') nm.show_output(vec, save_figure_path\ +'type2_map1'\ +'_aina12_'+str(aina12_x[p])\ +'_aina16_'+str(aina16_x[p])\ +'_aik_'+str(aik_x[p])\ +'_dist_'+str(d)+'_len_'+str(l)+'_') bpv_sum[i, j], fwv_sum[i, j], ___ = nm.cal_velocity(vec, ['ais']) cell.dend1 = None cell.dend2 = None cell.soma = None cell.hill = None cell.ais = None cell.axon = None for sec in h.allsec(): print(sec) with open(save_data_path+'type2_map1'\ +'_aina12_'+str(aina12_x[p])\ +'_aina16_'+str(aina16_x[p])\ +'_aik_'+str(aik_x[p])\ +'_bpv.p', 'wb') as file: pickle.dump(bpv_sum, file) with open(save_data_path+'type2_map1'\
import os import pickle plt.close('all') seg = ['ais'] cell = nm.NeuronModel(dl=1000, dd=2, sl=40, sd=20, \ hl=10, hd=2, ail=40, aid=1.2, axl=1000, axd=1.2,\ dna=100, sna=100, hna=300, aina=4000, axna=300, dk=20, \ sk=20, hk=150, aik=1000, axk=150,\ na_type=6, aina12=6000, aina16=6000) stim = nm.attach_current_clamp(cell, amp=1.0) vec = nm.set_recording_vectors(cell) nm.simulate() nm.show_output(vec, None) bpv, fwv, __ = nm.cal_velocity(vec, seg) print('normal:', bpv, fwv) cell.dend1 = None cell.soma = None cell.hill = None cell.ais = None cell.axon = None for sec in h.allsec(): print(sec) cell = nm.NeuronModel(dl=1000, dd=2, sl=40, sd=20,\ hl=10, hd=2, ail=60, aid=1.2, axl=1000, axd=1.2,\ dna=100, sna=100, hna=300, aina=4000, axna=300, dk=20,\ sk=20, hk=150, aik=500, axk=150,\ na_type=8, aina12=1800, aina16=1800)