def addfibers(num=cell_number): ''' Creates neuronal pool and returns gids of pool Parameters ---------- num: int neurons number in pool Returns ------- gids: list the list of neurons gids ''' global fibers, rank, nhost, spike_times_vec, id_vec gids = [] for i in range(rank, num, nhost): # if i == 0: # nummodel = 5 # else: # nummodel = 8 cell = cfiber(500, random.uniform(0.2, 3), random.randint(100, 500), random.randint(100, 1000), False, nummodel) fibers.append(cell) pc.set_gid2node(i, rank) nc = cell.connect2target(None) pc.cell(i, nc) nclist.append(nc) gids.append(i) pc.spike_record(i, spike_times_vec, id_vec) return gids
def addfibers(num = cell_number): ''' Creates neuronal pool and returns gids of pool Parameters ---------- num: int neurons number in pool Returns ------- gids: list the list of neurons gids ''' global fibers, rank, nhost gids = [] for i in range(rank, num, nhost): cell = cfiber(250, 0.25, random.randint(20, 80), random.randint(10, 100), True) fibers.append(cell) pc.set_gid2node(i, rank) nc = cell.connect2target(None) pc.cell(i, nc) gids.append(i) return gids
# pyplot.plot(t_vec, v_veckca, label = 'K_Ca') # f = open('./res.txt', 'w') # for v in list(v_vec): # f.write(str(v)+"\n") pyplot.legend() pyplot.xlabel('time (ms)') pyplot.ylabel('mA/cm^2') if __name__ == '__main__': numofmodel = int(sys.argv[3]) if numofmodel < 1 or numofmodel > 14: print("ERROR! Please input model number in range 1...14") else: cell = cfiber(250, 0.25, 0, 15020, True, numofmodel) for sec in h.allsec(): h.psection(sec=sec) #show parameters of each section # branch_vec, t_vec = set_recording_vectors(cell.stimsec[9]) v_vec11, v_vec13, v_vec16, v_vec17, v_vec18, v_vecka, v_veckd, v_vec, v_veckca, t_vec = set_recording_vectors( cell.branch) vc = h.VClamp(0.5, sec=cell.stimsec[9]) vc.dur[0] = 10.0 vc.dur[1] = 100.0 vc.dur[2] = 0.0 vc.amp[0] = -55 vc.amp[1] = -40 vc.amp[2] = 0 # branch_vec1, t_vec1 = set_recording_vectors(cell.stimsec[1]) # branch_vec2, t_vec2 = set_recording_vectors(cell.stimsec[4])
h.fcurrent() h.frecord_init() h.tstop = tstop h.v_init = vinit h.run() def show_output(v_vec, t_vec): ''' show graphs Parameters ---------- v_vec: h.Vector() recorded voltage t_vec: h.Vector() recorded time ''' dend_plot = pyplot.plot(t_vec, v_vec) pyplot.xlabel('time (ms)') pyplot.ylabel('mV') if __name__ == '__main__': cell = cfiber(250, 0.25, 100, 0, False) for sec in h.allsec(): h.psection(sec=sec) #show parameters of each section branch_vec, t_vec = set_recording_vectors(cell.branch) dend_vec, t_vec = set_recording_vectors(cell.stimsec[59]) dend80_vec, t_vec = set_recording_vectors(cell.stimsec[20]) simulate(cell) show_output(branch_vec, t_vec) show_output(dend_vec, t_vec) show_output(dend80_vec, t_vec) pyplot.show()
# pyplot.savefig(f"./results/ad_q_cur2_{dt}.pdf", format="pdf") f = open('./res.txt', 'w') for v in list(v_vec): f.write(str(v)+"\n") if __name__ == '__main__': # numofmodel = int(sys.argv[3]) # if numofmodel < 1 or numofmodel > 14: # print("ERROR! Please input model number in range 1...14") # else: # for i in range(5): # diffs = [] a_delta = adelta2(10, True) c_fiber = cfiber(250, 0.25, 0, 15020, True, 8) # diff = h.GrC_Gludif3(a_delta.axon1.node[0](0.5)) # h.setpointer(a_delta.axon1.node[5](0.5)._ref_v, 'affv', diff) # diffs.append(diff) # # diff2 = h.GrC_Gludif3(c_fiber.branch(0.5)) # h.setpointer(c_fiber.branch(0.5)._ref_v, 'affv', diff2) # diffs.append(diff2) IN1 = interneuron() IN2 = interneuron() LCN = interneuron() WDR = WDR_model() HT = HT_model()
# cell.distance() # for item in cell.diffs: # item.tx1 = h.t + 1 # item.initial = item.atp # item.c0cleft = item.c0cleft # item.h = cell.distances.get(cell.diffusions.get(item)) # h.continuerun(h.t+dt) def show_output(v_vec, t_vec): ''' show graphs Parameters ---------- v_vec: h.Vector() recorded voltage t_vec: h.Vector() recorded time ''' dend_plot = pyplot.plot(t_vec, v_vec) pyplot.xlabel('time (ms)') pyplot.ylabel('mV') if __name__ == '__main__': numofmodel = 8 cell = cfiber(250, 1, 0, 15000, True, numofmodel) for sec in h.allsec(): h.psection(sec=sec) #show parameters of each section branch_vec, t_vec = set_recording_vectors(cell.branch) print(cell.numofmodel) simulate(cell) show_output(branch_vec, t_vec) pyplot.show()