def initdend (self): self.dend = h.Section() self.dend.nseg = 1 self.dend.diam = 2 self.dend.L = 500 self.dend.Ra = 1 self.dend.insert('pas') self.ampa = h.AMPA(0.5,sec=self.dend) self.nmda = h.NMDA(0.5,sec=self.dend) self.gabaa0 = h.GABAa(0.5,sec=self.dend)
from neuron import h import neuron.gui soma = h.Section(name='soma') soma.insert('hh') ampa = h.AMPA(0.5, sec=soma) ampa.gbar = 1 # Just increasing, for testing purpose #expSyn = h.ExpSyn(0.5, soma) #expSyn.e = 10 #expSyn.i = 3 #expSyn.tau = 3 netStim = h.NetStim() netStim.start = 1 netStim.interval = 1 netStim.number = 3 netCon = h.NetCon(netStim, ampa) #netCon = h.NetCon(netStim, expSyn) netCon.weight[0] = 1
def __init__(self, TTX = False, Pool1_num = 9, Pool2_num = 9, Beta = 0.067, Cdur = 1, Syn_w1 = 0.01, Syn_w2 = 0.01, Loc = [0.2, 0.6]): """ Model the Glumate Stimulation. Model the Receptors in 2 pools: Pool 1: AMPA + NMDA (same synaptic weight, represent spine conductance) Pool 2: NMDA only (represent the extrasyanptic NMDARs) Parameters: ----------- TTX: True or False. True: setting all the sodium channel conductance to 0 to mimic TTX application in experiments False: default Pool1_num: syanptic AMPA/NMDA numbers Pool2_num: extrasyanptic NMDA numbers Beta: parameter for NMDA Receptors Cdur: parameter for NMDA Receptors Syn_w1: the syanptic weight of AMPA/NMDA receptors in pool1 Syn_w2: the syanptic weight of AMPA/NMDA receptors in pool2 Loc: the stimulation location ----------- Outputs: Figures: recording from soma and 3 different locations from basal dendrites json: soma and dendritc voltage recording and parameters info """ Cell = de.CA229(HVA_ratio = 0.0, LVA_ratio = 0.0) self.Cell = Cell # Can adjust channel conductance ratio here: # eg. Cell = CA229(KA_ratio = 0.5) ########################################### timestr = time.strftime("%H%M") data = time.strftime("%m_%d") # directory = 'Data_' + data +'/' directory_root = 'Fig3/' directory = directory_root + 'DMS/Plot/' # directory = directory_root + 'DMS/Analysis/' if (TTX == True): Cell.TTX() title = "TTX_Pool1_"+ str(Pool1_num) + "_Pool2_" + str(Pool2_num) + "_NMDA_Beta_" + \ str(Beta) + "_NMDA_Cdur_"+str(Cdur)+ "_Pool1_W_" + str(Syn_w1) + \ "_Pool2_W_" + str(Syn_w2) + "_"+ timestr else: title = "Pool1_"+ str(Pool1_num) + "_Pool2_" + str(Pool2_num) + "_NMDA_Beta_" + \ str(Beta) + "_NMDA_Cdur_"+str(Cdur)+ "_Pool1_W_" + str(Syn_w1) + \ "_Pool2_W_" + str(Syn_w2) + "_"+ timestr ########################################### # Adding Pool 1 ########################################### ##### AMPA SynAMPA = [] nc_AMPA = [] SynNMDA = [] nc_NMDA = [] self.SynAMPA = SynAMPA self.nc_AMPA = nc_AMPA self.SynNMDA = SynNMDA self.nc_NMDA = nc_NMDA ########################################### loc1 = list(np.linspace(Loc[0], Loc[1], Pool1_num)) ########################################### # Loc and time delay set up delay1 = random_2(10, 50 + int(Syn_w1*50), Pool1_num) # delay1 = random_beta(10, 50 + int(Syn_w1*50), Pool1_num) ns = h.NetStim() self.ns = ns ns.interval = 20 ns.number = 1 ns.start = 190 ns.noise = 0 ########################################### for i in range(Pool1_num): ########################### # Adding AMPA SynAMPA.append(h.AMPA(Cell.basal[34](loc1[i]))) SynAMPA[-1].gmax = 0.05 nc_AMPA.append(h.NetCon(ns, SynAMPA[i])) nc_AMPA[-1].delay = delay1[i] nc_AMPA[-1].weight[0] = Syn_w1 ########################### #Adding NMDA SynNMDA.append(h.NMDA(Cell.basal[34](loc1[i]))) SynNMDA[-1].gmax = 0.005 SynNMDA[-1].Beta = Beta SynNMDA[-1].Cdur = Cdur nc_NMDA.append(h.NetCon(ns, SynNMDA[i])) nc_NMDA[-1].delay = delay1[i] nc_NMDA[-1].weight[0] = Syn_w1 ########################################### # Adding Pool 2 ########################################### ExNMDA = [] nc_ExNMDA = [] self.ExNMDA = ExNMDA self.nc_ExNMDA = nc_ExNMDA loc2 = list(np.linspace(Loc[0], Loc[1], Pool2_num)) # delay2 = list(np.linspace(5, 10, Pool2_num)) delay2 = random_2(15, 55 + int(Syn_w2*60), Pool2_num) # delay2 = random_beta(15, 55 + int(Syn_w2*60), Pool2_num) for i in range(Pool2_num): ########################### # Adding extrasyanptic NMDA ExNMDA.append(h.NMDA(Cell.basal[34](loc2[i]))) ExNMDA[-1].gmax = 0.005 ExNMDA[-1].Beta = Beta ExNMDA[-1].Cdur = Cdur nc_ExNMDA.append(h.NetCon(ns, ExNMDA[i])) nc_ExNMDA[-1].delay = delay2[i] nc_ExNMDA[-1].weight[0] = Syn_w2 ########################################### ### Recording ########################################### t_vec = h.Vector() t_vec.record(h._ref_t) v_vec_soma = h.Vector() v_vec_dend1 = h.Vector() v_vec_dend2 = h.Vector() v_vec_dend3 = h.Vector() cai_soma = h.Vector() cai_dend = h.Vector() v_vec_soma.record(Cell.soma[2](0.5)._ref_v) v_vec_dend1.record(Cell.basal[34](0.8)._ref_v) v_vec_dend2.record(Cell.basal[34](0.5)._ref_v) v_vec_dend3.record(Cell.basal[34](0.3)._ref_v) cai_soma.record(Cell.soma[2](0.5)._ref_cai) cai_dend.record(Cell.basal[34](0.3)._ref_cai) ########################################### ### Run & Plot ########################################### h.celsius = 32 h.v_init = -73.6927850677 h.init() h.tstop = 1000 h.run() # pdb.set_trace() #Debugging # print v_vec_soma[-1] # plt.clf() # plt.close() # plt.figure(figsize = (16, 6), dpi = 100) # plt.plot(t_vec, v_vec_soma, label = 'soma(0.5)', color = 'black') # plt.plot(t_vec, v_vec_dend1, label = 'bdend[34](0.8)', color = 'red') # plt.plot(t_vec, v_vec_dend2, label = 'Basal[34](0.5)', color = 'blue') # plt.plot(t_vec, v_vec_dend3, label = 'Basal[34](0.3)', color = 'green') # plt.ylim([-90, 40]) # plt.xlim([0, 800]) # plt.legend(loc = 'best') # plt.ylabel('mV') # plt.xlabel('Time (ms)') # plt.title ("Glumate Receptor Activated Plateau Potential") # # save(title, directory, ext="png", close=True, verbose=True) ####################### # Plot the intracelluar calcium concentration # plt.clf() # plt.close() # plt.figure(figsize = (16, 6), dpi = 100) # plt.plot(t_vec, cai_soma, label = 'soma(0.5)', color = 'black') # #plt.plot(t_vec, cai_dend, label = 'bdend[34](0.3)', color = 'red') # # # plt.ylim([-90, 60]) # plt.xlim([0, 800]) # plt.legend(loc = 'best') # plt.ylabel('mM') # plt.xlabel('Time (ms)') # plt.title ("Calcium concentration") # title1 = "Calcium_" + title # ut.save(title1, directory, ext="png", close=True, verbose=True) data = ut.Vividict() data['SynAMPA']['num'] = Pool1_num data['SynAMPA']['locs'] = loc1 data['SynAMPA']['weight'] = Syn_w1 data['SynNMDA']['num'] = Pool1_num data['SynNMDA']['locs'] = loc1 data['SynNMDA']['weight'] = Syn_w1 data['SynNMDA']['Beta'] = Beta data['SynNMDA']['Cdur'] = Cdur data['ExNMDA']['num'] = Pool2_num data['ExNMDA']['locs'] = loc2 data['ExNMDA']['weight'] = Syn_w2 data['ExNMDA']['Beta'] = Beta data['ExNMDA']['Cdur'] = Cdur data['recording']['time'] = list(t_vec) data['recording']['soma']['voltage'] = list(v_vec_soma) data['recording']['basal_34']['voltage_0.8'] = list(v_vec_dend1) data['recording']['basal_34']['voltage_0.5'] = list(v_vec_dend2) data['recording']['basal_34']['voltage_0.3'] = list(v_vec_dend3) data['recording']['soma']['ica'] = list(cai_soma) data['recording']['basal_34']['ica_0.3'] = list(cai_dend) ut.savejson(data, title, directory, ext = "json", verbose = False)
def prepCell(gList, loc, pos, n, v0, alphaR=True): f = open('pylog', 'a') #print ' location, strength, pos' #print >>f, ' location, strength, pos' #for i in xrange(n): # print '#{:2d} {:3d} {: 1.1e} {:0.1f}'.format(i,loc[i],gList[i],pos[i]) # print >>f, '#{:2d} {:3d} {: 1.1e} {:0.1f}'.format(i,loc[i],gList[i],pos[i]) print >> f, 'gList = np.array([', print 'gList = np.array([', for i in xrange(n): if i == n - 1: print >> f, gList[i], print gList[i], else: print >> f, gList[i], ', ', print gList[i], ', ', print >> f, '])' print '])' print >> f, 'loc = np.array([', print 'loc = np.array([', for i in xrange(n): if i == n - 1: print >> f, loc[i], print loc[i], else: print >> f, loc[i], ', ', print loc[i], ', ', print >> f, '])' print '])' print >> f, 'pos = np.array([', print 'pos = np.array([', for i in xrange(n): if i == n - 1: print >> f, pos[i], print pos[i], else: print >> f, pos[i], ', ', print pos[i], ', ', print >> f, '])' print '])' h.cvode.active(0) cell = RealisticNeuron(v0) cell.soma.push() h.distance() h.pop_section() vecStimList = [h.VecStim() for i in xrange(n)] synList = [] dist = np.zeros((n)) print >> f, 'distance = np.array([', print 'distance = np.array([', for i in xrange(n): cell.dend[loc[i]].push() if gList[i] < 0: if alphaR: synList.append(h.ALPHAI()) else: synList.append(h.GABAa()) else: if alphaR: synList.append(h.ALPHAE()) else: synList.append(h.AMPA()) synList[i].loc(pos[i]) h.setpointer(vecStimList[i]._ref_y, 'pre', synList[i]) h.pop_section() if gList[i] < 0: if alphaR: synList[i].f = -gList[i] else: synList[i].gmax = -gList[i] else: if alphaR: synList[i].f = gList[i] else: synList[i].gmax = gList[i] dist[i] = h.distance(cell.dend[loc[i]](pos[i])) if i == n - 1: print >> f, dist[i], print dist[i], else: print >> f, dist[i], ', ', print dist[i], ', ', print >> f, '])' print '])' f.close() return cell, vecStimList, synList, dist
def Glu_Stim(Bnum=34, TTX=False, Pool1_num=9, Pool2_num=9, Syn_w1=0.01, Syn_w2=0.01, Loc=[0.2, 0.6], DenLoc=0.5): """ Model the Glumate Stimulation. Model the Receptors in 2 pools: Pool 1: AMPA + NMDA (same synaptic weight, represent spine conductance) Pool 2: NMDA only (represent the extrasyanptic NMDARs) Parameters: ----------- Bnum: the number of basal branch to explore TTX: True or False. True: setting all the sodium channel conductance to 0. False: default Pool1_num: syanptic AMPA/NMDA numbers Pool2_num: extrasyanptic NMDA numbers Syn_w1: the syanptic weight of AMPA/NMDA receptors in pool1 Syn_w2: the syanptic weight of AMPA/NMDA receptors in pool2 Loc: the stimulation location DenLoc: the targeted recording location on dendrite ----------- Outputs: Figures: recording from soma and 3 different locations from basal dendrites json: soma and dendritc voltage recording and parameters info """ Cell = de.CA229() timestr = time.strftime("%Y%m%d-%H%M") data = time.strftime("%m_%d") directory_root = "Fig5/Major/" L1 = "{:.2f}".format(Loc[0]) L2 = "{:.2f}".format(Loc[1]) if (TTX == True): Cell.TTX() directory = directory_root + "B" + str( Bnum) + "/Loc" + L1 + "_" + L2 + "/TTX/" title = "TTX_Pool1_"+ \ str(Pool1_num) + "_Pool2_" + str(Pool2_num) + \ "_Pool1_W_" + str(Syn_w1) + \ "_Pool2_W_" + str(Syn_w2) + "_"+ timestr else: directory = directory_root + "B" + str( Bnum) + "/Loc" + L1 + "_" + L2 + "/N/" title = "Pool1_"+ \ str(Pool1_num) + "_Pool2_" + str(Pool2_num) + \ "_Pool1_W_" + str(Syn_w1) + \ "_Pool2_W_" + str(Syn_w2) + "_"+ timestr ########################################### # Adding Pool 1 ########################################### ##### AMPA SynAMPA = [] nc_AMPA = [] SynNMDA = [] nc_NMDA = [] loc1 = list(np.linspace(Loc[0], Loc[1], Pool1_num)) ########################################### delay1 = random_2(10, 20 + int(Syn_w1 * 50), Pool1_num) ns = h.NetStim() ns.interval = 20 ns.number = 1 ns.start = 190 ns.noise = 0 for i in range(Pool1_num): ########################### # Adding AMPA SynAMPA.append(h.AMPA(Cell.basal[Bnum](loc1[i]))) SynAMPA[-1].gmax = 0.05 nc_AMPA.append(h.NetCon(ns, SynAMPA[i])) nc_AMPA[-1].delay = delay1[i] nc_AMPA[-1].weight[0] = Syn_w1 ########################### for i in range(Pool1_num): tempNMDA = h.nmda(Cell.basal[Bnum](loc1[i])) tempNMDA.gmax = 0.005 * Syn_w1 tempNMDA.onset = delay1[i] + ns.start SynNMDA.append(tempNMDA) ########################################### # Adding Pool 2 ########################################### ExNMDA = [] nc_ExNMDA = [] loc2 = list(np.linspace(Loc[0], Loc[1], Pool2_num)) delay2 = random_2(15, 25 + int(Syn_w2 * 60), Pool2_num) for i in range(Pool2_num): ########################### # Adding extrasyanptic NMDA tempNMDA2 = h.nmda(Cell.basal[Bnum](loc2[i])) tempNMDA2.gmax = 0.005 * Syn_w2 tempNMDA2.onset = delay2[i] + ns.start ExNMDA.append(tempNMDA2) ########################################### ### Recording ########################################### t_vec = h.Vector() t_vec.record(h._ref_t) v_vec_soma = h.Vector() v_vec_dend1 = h.Vector() v_vec_dend2 = h.Vector() v_vec_dend3 = h.Vector() v_vec_dend = h.Vector() v_vec_soma.record(Cell.soma[2](0.5)._ref_v) v_vec_dend1.record(Cell.basal[Bnum](0.8)._ref_v) v_vec_dend2.record(Cell.basal[Bnum](0.5)._ref_v) v_vec_dend3.record(Cell.basal[Bnum](0.3)._ref_v) v_vec_dend.record(Cell.basal[Bnum](DenLoc)._ref_v) ########################################### ### Run & Plot ########################################### h.celsius = 32 h.v_init = -73.6927850677 h.init() h.tstop = 1000 h.run() # pdb.set_trace() #Debugging # plt.figure(figsize = (16, 6), dpi = 100) # plt.plot(t_vec, v_vec_soma, label = 'soma(0.5)', color = 'black') # plt.plot(t_vec, v_vec_dend1, label = 'Basal['+str(Bnum)+'](0.8)', color = 'red') # plt.plot(t_vec, v_vec_dend2, label = 'Basal['+str(Bnum)+'](0.5)', color = 'blue') # plt.plot(t_vec, v_vec_dend3, label = 'Basal['+str(Bnum)+'](0.3)', color = 'green') # plt.ylim([-90, 40]) # plt.xlim([0, 700]) # plt.legend(loc = 'best') # plt.ylabel('mV') # plt.xlabel('Time (ms)') # plt.title ("Glumate Receptor Activated Plateau Potential") # save(title, directory, ext="png", close=True, verbose=True) data = ut.Vividict() data['TTX'] = TTX data['SynAMPA']['num'] = Pool1_num data['SynAMPA']['locs'] = Loc data['SynAMPA']['weight'] = Syn_w1 data['SynNMDA']['num'] = Pool1_num data['SynNMDA']['locs'] = Loc data['SynNMDA']['weight'] = Syn_w1 data['ExNMDA']['num'] = Pool2_num data['ExNMDA']['locs'] = Loc data['ExNMDA']['weight'] = Syn_w2 data['recording']['time'] = list(t_vec) data['recording']['soma']['voltage'] = list(v_vec_soma) data['recording']['basal']['voltage_0.8'] = list(v_vec_dend1) data['recording']['basal']['voltage_0.5'] = list(v_vec_dend2) data['recording']['basal']['voltage_0.3'] = list(v_vec_dend3) data['recording']['basal']['voltage_input'] = list(v_vec_dend) ut.savejson(data, title, directory, ext="json", verbose=False)
print 'distal_re dendrites: ', seldist_re, '\n', seldistname_re print '------------------------------------------------------' #print seldistname_re[1] ######################################################################## ###### randomly selecting n secs from the list of secs send = [] receive = [] syn = [] nc = [] vec = {} for counter in range(0, 3): # (0, how many secs to take) nprox = randint(0, len(selprox_re) - 1) send.append(selprox_re[nprox]) ndist = randint(0, len(seldist_re) - 1) receive.append(seldist_re[ndist]) syni = h.AMPA(0.5, sec=receive[counter]) syn.append(syni) nci = h.NetCon(send[counter](0.5)._ref_v, syni, sec=send[counter]) nci.weight[0] = 0.2 nc.append(nci) #print selprox_re[nprox] print "sender[counter] = ", send[counter].name() print "receiver[counter] = ", receive[counter].name() #selprox_re.remove(selprox_re[nprox]) #seldist_re.remove(seldist_re[ndist]) # h.run() ######################################################################## '''
def Glu_Stim(TTX = False, Pool1_num = 9, Pool2_num = 9, Beta = 0.067, Cdur = 1, Syn_w1 = 0.01, Syn_w2 = 0.01, Loc = [0.2, 0.6]): """ Model the Glumate Stimulation. Model the Receptors in 2 pools: Pool 1: AMPA + NMDA (same synaptic weight, represent spine conductance) Pool 2: NMDA only (represent the extrasyanptic NMDARs) Parameters: ----------- TTX: True or False. True: setting all the calcium channel conductance to 0. False: default Pool1_num: syanptic AMPA/NMDA numbers Pool2_num: extrasyanptic NMDA numbers Beta: NMDA Receptors Cdur: NMDA Receptors Syn_w1: the syanptic weight of AMPA/NMDA receptors in pool1 Syn_w2: the syanptic weight of AMPA/NMDA receptors in pool2 Loc: the stimulation location ----------- Outputs: Figures: recording from soma and 3 different locations from basal dendrites json: soma and dendritc voltage recording and parameters info """ ########################################### Cell = CA229() timestr = time.strftime("%Y%m%d-%H%M") data = time.strftime("%m_%d") directory = 'Data_' + data +'/' if (TTX == True): Cell.TTX() title = "TTX_Pool1_"+ str(Pool1_num) + "_Pool2_" + str(Pool2_num) + "_NMDA_Beta_" + \ str(Beta) + "_NMDA_Cdur_"+str(Cdur)+ "_Pool1_W_" + str(Syn_w1) + \ "_Pool2_W_" + str(Syn_w2) + "_"+ timestr + "_joe" else: title = "Pool1_"+ str(Pool1_num) + "_Pool2_" + str(Pool2_num) + "_NMDA_Beta_" + \ str(Beta) + "_NMDA_Cdur_"+str(Cdur)+ "_Pool1_W_" + str(Syn_w1) + \ "_Pool2_W_" + str(Syn_w2) + "_"+ timestr + "_joe" ########## glutAmp = Syn_w1 glutAmpExSynScale = Syn_w2 / Syn_w1 glutAmpDecay = 0.0 #5.0 # percent/um synLocMiddle = (loc[0] + loc[1])/2 synLocRadius = synLocMiddle - loc[0] initDelay = 10.0 synDelay = 0.5 # ms/um exSynDelay = 1.0 # ms/um branch_length = 166.25942491682142 # CA229.basal[34].L numSyns = Pool1_num numExSyns = Pool2_num glutAmp = Syn_w1 syn_locs = np.linspace(synLocMiddle-synLocRadius, synLocMiddle+synLocRadius, numSyns) syn_dists = branch_length * np.abs(syn_locs - synLocMiddle) syn_weights = glutAmp * (1 - syn_dists * glutAmpDecay/100) syn_weights = [weight if weight > 0.0 else 0.0 for weight in syn_weights] syn_delays = initDelay + (synDelay * syn_dists) exsyn_locs = np.linspace(synLocMiddle-synLocRadius, synLocMiddle+synLocRadius, numExSyns) exsyn_dists = branch_length * np.abs(exsyn_locs - synLocMiddle) exsyn_weights = glutAmpExSynScale * glutAmp * (1 - exsyn_dists * glutAmpDecay/100) exsyn_weights = [weight if weight > 0.0 else 0.0 for weight in exsyn_weights] exsyn_delays = initDelay + (exSynDelay * exsyn_dists) ########################################### # Adding Pool 1 ########################################### ##### AMPA SynAMPA = [] nc_AMPA = [] SynNMDA = [] nc_NMDA = [] loc1 = list(np.linspace(Loc[0], Loc[1], Pool1_num)) #delay1 = random_2(10, 50 + int(Syn_w1*50), Pool1_num) delay1 = syn_delays ns = h.NetStim() ns.interval = 20 ns.number = 1 ns.start = 190 ns.noise = 0 print print("delay1") print(delay1) print print("mean: %f" % (np.mean(delay1))) print("std : %f" % (np.std(delay1))) for i in range(Pool1_num): ########################### # Adding AMPA SynAMPA.append(h.AMPA(Cell.basal[34](loc1[i]))) SynAMPA[-1].gmax = 0.04 #SynAMPA1[-1].Beta = 0.28 nc_AMPA.append(h.NetCon(ns, SynAMPA[i])) nc_AMPA[-1].delay = delay1[i] # delay1[i] #uniform(1,20) nc_AMPA[-1].weight[0] = syn_weights[i] # Syn_w1 #nc_AMPA[-1].threshold = -20 ########################### #Adding NMDA # SynNMDA.append(h.NMDA(Cell.basal[34](loc1[i]))) # Using NMDAeee.mod file SynNMDA.append(h.NMDAeee(Cell.basal[34](loc1[i]))) SynNMDA[-1].gmax = 0.01 SynNMDA[-1].Beta = Beta SynNMDA[-1].Cdur = Cdur nc_NMDA.append(h.NetCon(ns, SynNMDA[i])) nc_NMDA[-1].delay = delay1[i] #uniform(1,20) nc_NMDA[-1].weight[0] = syn_weights[i] # Syn_w1 ########################################### # Adding Pool 2 ########################################### ExNMDA = [] nc_ExNMDA = [] loc2 = list(np.linspace(Loc[0], Loc[1], Pool2_num)) #delay2 = random_2(15, 55 + int(Syn_w2*60), Pool2_num) delay2 = exsyn_delays print print("delay2") print(delay2) print print("mean: %f" % (np.mean(delay2))) print("std : %f" % (np.std(delay2))) for i in range(Pool2_num): ########################### # Adding extrasyanptic NMDA # ExNMDA.append(h.NMDA(Cell.basal[34](loc2[i]))) # Using NMDAeee.mod file ExNMDA.append(h.NMDAeee(Cell.basal[34](loc2[i]))) ExNMDA[-1].gmax = 0.01 ExNMDA[-1].Beta = Beta ExNMDA[-1].Cdur = Cdur nc_ExNMDA.append(h.NetCon(ns, ExNMDA[i])) nc_ExNMDA[-1].delay = delay2[i] #uniform(1,20) nc_ExNMDA[-1].weight[0] = exsyn_weights[i] # Syn_w2 #(i/5.0)*Syn_w2 ########################################### ### Recording ########################################### t_vec = h.Vector() t_vec.record(h._ref_t) v_vec_soma = h.Vector() v_vec_dend1 = h.Vector() v_vec_dend2 = h.Vector() v_vec_dend3 = h.Vector() cai_soma = h.Vector() cai_dend = h.Vector() v_vec_soma.record(Cell.soma[2](0.5)._ref_v) v_vec_dend1.record(Cell.basal[34](0.8)._ref_v) v_vec_dend2.record(Cell.basal[34](0.5)._ref_v) v_vec_dend3.record(Cell.basal[34](0.3)._ref_v) cai_soma.record(Cell.soma[2](0.5)._ref_cai) cai_dend.record(Cell.basal[34](0.3)._ref_cai) ########################################### ### Run & Plot ### Be careful, vmax does not have value before run ########################################### h.celsius = 32 # 32 h.v_init = -79.1863191308 #-81.0866900034 #-78.1162028163 #-67.3 h.init() h.tstop = 1000 h.run() plt.clf() plt.close() plt.figure(figsize = (16, 6), dpi = 100) plt.plot(t_vec, v_vec_soma, label = 'soma(0.5)', color = 'black') plt.plot(t_vec, v_vec_dend1, label = 'bdend[34](0.8)', color = 'red') plt.plot(t_vec, v_vec_dend2, label = 'Basal[34](0.5)', color = 'blue') plt.plot(t_vec, v_vec_dend3, label = 'Basal[34](0.3)', color = 'green') plt.ylim([-90, 40]) plt.xlim([0, 800]) plt.legend(loc = 'best') plt.ylabel('mV') plt.xlabel('Time (ms)') plt.title ("Glumate Receptor Activated Plateau Potential") save(title, directory, ext="png", close=True, verbose=True) ####################### # Plot the intracelluar calcium concentration # plt.clf() # plt.close() # plt.figure(figsize = (16, 6), dpi = 100) # plt.plot(t_vec, cai_soma, label = 'soma(0.5)', color = 'black') # #plt.plot(t_vec, cai_dend, label = 'bdend[34](0.3)', color = 'red') # # # plt.ylim([-90, 60]) # plt.xlim([0, 800]) # plt.legend(loc = 'best') # plt.ylabel('mM') # plt.xlabel('Time (ms)') # plt.title ("Calcium concentration") # title1 = "Calcium_" + title # save(title1, directory, ext="png", close=True, verbose=True) data = Vividict() data['SynAMPA']['num'] = Pool1_num data['SynAMPA']['locs'] = loc1 data['SynAMPA']['weight'] = Syn_w1 data['SynNMDA']['num'] = Pool1_num data['SynNMDA']['locs'] = loc1 data['SynNMDA']['weight'] = Syn_w1 data['SynNMDA']['Beta'] = Beta data['SynNMDA']['Cdur'] = Cdur data['ExNMDA']['num'] = Pool2_num data['ExNMDA']['locs'] = loc2 data['ExNMDA']['weight'] = Syn_w2 data['ExNMDA']['Beta'] = Beta data['ExNMDA']['Cdur'] = Cdur data['recording']['time'] = list(t_vec) data['recording']['soma']['voltage'] = list(v_vec_soma) data['recording']['basal_34']['voltage_0.8'] = list(v_vec_dend1) data['recording']['basal_34']['voltage_0.5'] = list(v_vec_dend2) data['recording']['basal_34']['voltage_0.3'] = list(v_vec_dend3) data['recording']['soma']['ica'] = list(cai_soma) data['recording']['basal_34']['ica_0.3'] = list(cai_dend) savejson(data, title, directory, ext = "json", verbose = False)
def syn_stim(): spi6 = initcell("SPI6") num_syns = 1 factor = 3.0 nclist = [] synlist = [] stim = h.NetStim() stim.number = 1 stim.interval = 0.0 stim.start = 200 h.tstop = 800 time = h.Vector() time.record(h._ref_t) v_soma = h.Vector() v_soma.record(spi6.soma(0.5)._ref_v) v_bdend = h.Vector() v_bdend.record(spi6.Bdend1(0.5)._ref_v) # Currents in Bdend: ih, nax, kdr, kap, cal, can, kBk i_ih = h.Vector() i_ih.record(spi6.Bdend1(0.5).ih._ref_i) i_na = h.Vector() i_na.record(spi6.Bdend1(0.5)._ref_ina) i_k = h.Vector() i_k.record(spi6.Bdend1(0.5)._ref_ik) i_ca = h.Vector() i_ca.record(spi6.Bdend1(0.5)._ref_ica) for ind in range(num_syns): nmda_syn = h.NMDA(spi6.Bdend1(0.5)) nc_nmda = h.NetCon(stim, nmda_syn) nc_nmda.weight[0] = 0.055 * factor nc_nmda.delay = 10 synlist.append(nmda_syn) nclist.append(nc_nmda) ampa_syn = h.AMPA(spi6.Bdend1(0.5)) nc_ampa = h.NetCon(stim, ampa_syn) nc_ampa.weight[0] = 0.0055 * factor nc_ampa.delay = 10 synlist.append(ampa_syn) nclist.append(nc_ampa) i_nmda = h.Vector() i_nmda.record(synlist[0]._ref_i) i_ampa = h.Vector() i_ampa.record(synlist[1]._ref_i) h.run() plt.figure() ax1 = plt.subplot(311) plt.plot(time, v_soma, label="Soma") plt.plot(time, v_bdend, label="Bdend") plt.ylabel("Membrane Potential (mV)") plt.legend() ax2 = plt.subplot(312, sharex=ax1) plt.plot(time, i_nmda, label="NMDA (" + str(nc_nmda.weight[0]) + ")") plt.plot(time, i_ampa, label="AMPA (" + str(nc_ampa.weight[0]) + ")") plt.ylabel("Synaptic Currents (nA)") plt.legend() ax3 = plt.subplot(313, sharex=ax1) plt.plot(time, i_ih, label="H") plt.plot(time, i_na, label="Na") plt.plot(time, i_k, label="K") plt.plot(time, i_ca, label="Ca") plt.ylabel("Membrane Currents (nA)") plt.xlabel("Time (ms)") plt.xlim([200, 800]) plt.legend() plt.show()