def make_NMDA(): if moose.exists('NMDA'): return NMDA = moose.SynChan('NMDA') NMDA.Ek = 0.0 NMDA.tau1 = 20.0e-3 NMDA.tau2 = 20.0e-3 NMDA.Gbar = 5 * SOMA_A block = moose.MgBlock('/library/NMDA/block') block.CMg = 1.2 # [Mg] in mM block.Zk = 2 block.KMg_A = 1.0 / 0.28 block.KMg_B = 1.0 / 62 moose.connect(NMDA, 'channelOut', block, 'origChannel', 'OneToOne') addmsg1 = moose.Mstring('/library/NMDA/addmsg1') addmsg1.value = '.. channel ./block channel' #Here we want to also tell the cell reader to _remove_ the original #Gk, Ek term going from the channel to the compartment, as this is # now handled by the MgBlock. #addmsg2 = moose.Mstring( 'NMDA/addmsg2' #addmsg2.value = 'DropMsg .. channel' addmsg3 = moose.Mstring('/library/NMDA/addmsg3') addmsg3.value = '.. VmOut . Vm'
def make_NMDA(): if moose.exists('NMDA'): return NMDA = moose.SynChan('NMDA') NMDA.Ek = 0.0 NMDA.tau1 = 20.0e-3 NMDA.tau2 = 20.0e-3 NMDA.Gbar = 5 * SOMA_A block = moose.MgBlock('/library/NMDA/block') block.CMg = 1.2 # [Mg] in mM block.Zk = 2 block.KMg_A = 1.0 / 0.28 block.KMg_B = 1.0 / 62 moose.connect(NMDA, 'channelOut', block, 'origChannel', 'OneToOne') addmsg1 = moose.Mstring('/library/NMDA/addmsg1') addmsg1.value = '.. channel ./block channel' #Here we want to also tell the cell reader to _remove_ the original #Gk, Ek term going from the channel to the compartment, as this is # now handled by the MgBlock. #addmsg2 = moose.Mstring( 'NMDA/addmsg2' #addmsg2.value = 'DropMsg .. channel' addmsg1 = moose.Mstring('/library/NMDA/addmsg1') addmsg1.value = '.. VmOut ./block Vm' addmsg2 = moose.Mstring('/library/NMDA/addmsg2') addmsg2.value = './block IkOut ../Ca_conc current' addmsg3 = moose.Mstring('/library/NMDA/addmsg3') addmsg3.value = '.. VmOut . Vm' sh = moose.SimpleSynHandler('NMDA/sh') moose.connect(sh, 'activationOut', NMDA, 'activation') sh.numSynapses = 1 sh.synapse[0].weight = 1
def make_NMDA(comp): """This function is modified from proto18.py by Upi, which is again based on Dave Beeman's implementation. This implementation of NMDA uses the formulation by Zador, Koch and Brown (1990) where Gk = Gbar * (exp(- t / tau1) - exp(-t / tau2)) / (1 + eta * [Mg2+] * exp(- gmma * Vm)) The MgBlock object sits between the SynChan and teh Compartment and scales the Gk of regular SynChan Gk by [Mg2+] such that the resulting conductance is as above formula, where the fields are : CMg = [Mg2+] KMg_A = 1 / eta KMg_B = 1 / gamma """ nmda = moose.SynChan('%s/nmda' % (comp.path)) nmda.synapse.num = 1 nmda.Ek = 0.0 nmda.tau1 = 20e-3 nmda.tau2 = 20e-3 nmda.Gbar = 0.2 * 8e-9 # channel open probability is 0.2 nmda.bufferTime = 0.0001 mgblock = moose.MgBlock('%s/mgblock' % (nmda.path)) mgblock.CMg = 1.2 # [Mg] in mM mgblock.Zk = 2 mgblock.KMg_A = 1.0/0.28 mgblock.KMg_B = 1.0/62 moose.connect( nmda, 'channelOut', mgblock, 'origChannel', 'OneToOne' ) moose.connect(mgblock, 'channel', comp, 'channel') return nmda, mgblock
def make_Ca_NMDA(): if moose.exists('Ca_NMDA'): return Ca_NMDA = moose.SynChan('Ca_NMDA') Ca_NMDA.Ek = ECA Ca_NMDA.tau1 = 20.0e-3 Ca_NMDA.tau2 = 20.0e-3 Ca_NMDA.Gbar = 5 * SOMA_A block = moose.MgBlock('/library/Ca_NMDA/block') block.CMg = 1.2 # [Mg] in mM block.Zk = 2 block.KMg_A = 1.0 / 0.28 block.KMg_B = 1.0 / 62 moose.connect(Ca_NMDA, 'channelOut', block, 'origChannel', 'OneToOne') addmsg1 = moose.Mstring('/library/Ca_NMDA/addmsg1') addmsg1.value = '.. VmOut ./block Vm' addmsg2 = moose.Mstring('/library/Ca_NMDA/addmsg2') addmsg2.value = './block IkOut ../NMDA_Ca_conc current'
def test_mgblock(): """ Demonstrates the use of MgBlock. Creates an NMDA channel with MgBlock and another without. Connects them up to the compartment on one hand, and to a SynHandler on the other, so as to receive synaptic input. Delivers two pulses to each receptor, with a small delay in between. Plots out the conductance change at each receptor and the reslting membrane potential rise at the compartment. Note that these NMDA channels do NOT separate out the contributions due to calcium and other ions. To do this correctly one should use the GHK object. """ model = moose.Neutral('/model') data = moose.Neutral('/data') soma = moose.Compartment('/model/soma') soma.Em = -60e-3 soma.Rm = 1e7 soma.Cm = 1e-9 ################################################### # This is where we create the synapse with MgBlock #-------------------------------------------------- nmda = moose.SynChan('/model/soma/nmda') nmda.Gbar = 1e-9 mgblock = moose.MgBlock('/model/soma/mgblock') mgblock.CMg = 2.0 mgblock.KMg_A = 1/0.33 mgblock.KMg_B = 1/60.0 # The synHandler manages the synapses and their learning rules if any. synHandler = moose.SimpleSynHandler( '/model/soma/nmda/handler' ) synHandler.synapse.num = 1 moose.connect( synHandler, 'activationOut', nmda, 'activation' ) # MgBlock sits between original channel nmda and the # compartment. The origChannel receives the channel message from # the nmda SynChan. moose.connect(soma, 'VmOut', nmda, 'Vm' ) moose.connect(nmda, 'channelOut', mgblock, 'origChannel') moose.connect(mgblock, 'channel', soma, 'channel') # This is for comparing with MgBlock nmda_noMg = moose.copy(nmda, soma, 'nmda_noMg') moose.connect( nmda_noMg, 'channel', soma, 'channel') moose.le( nmda_noMg ) ######################################### # The rest is for experiment setup spikegen = moose.SpikeGen('/model/spike') pulse = moose.PulseGen('/model/input') pulse.delay[0] = 10e-3 pulse.level[0] = 1.0 pulse.width[0] = 50e-3 moose.connect(pulse, 'output', spikegen, 'Vm') moose.le( synHandler ) #syn = moose.element(synHandler.path + '/synapse' ) syn = synHandler.synapse[0] syn.delay = simdt * 2 syn.weight = 10 moose.connect(spikegen, 'spikeOut', synHandler.synapse[0], 'addSpike') moose.le( nmda_noMg ) noMgSyn = moose.element(nmda_noMg.path + '/handler/synapse' ) noMgSyn.delay = 0.01 noMgSyn.weight = 1 moose.connect(spikegen, 'spikeOut', noMgSyn, 'addSpike') moose.showfields( syn ) moose.showfields( noMgSyn ) Gnmda = moose.Table('/data/Gnmda') moose.connect(Gnmda, 'requestOut', mgblock, 'getGk') Gnmda_noMg = moose.Table('/data/Gnmda_noMg') moose.connect(Gnmda_noMg, 'requestOut', nmda_noMg, 'getGk') Vm = moose.Table('/data/Vm') moose.connect(Vm, 'requestOut', soma, 'getVm') for i in range( 10 ): moose.setClock( i, simdt ) moose.setClock( Gnmda.tick, plotdt ) print spikegen.dt, Gnmda.dt moose.reinit() moose.start( simtime ) t = pylab.linspace(0, simtime*1e3, len(Vm.vector)) pylab.plot(t, (Vm.vector + 0.06) * 1000, label='Vm (mV)') pylab.plot(t, Gnmda.vector * 1e9, label='Gnmda (nS)') pylab.plot(t, Gnmda_noMg.vector * 1e9, label='Gnmda no Mg (nS)') pylab.legend() #data = pylab.vstack((t, Gnmda.vector, Gnmda_noMg.vector)).transpose() #pylab.savetxt('mgblock.dat', data) pylab.show()
def test_mgblock(): model = moose.Neutral('/model') data = moose.Neutral('/data') soma = moose.Compartment('/model/soma') soma.Em = -60e-3 soma.Rm = 1e7 soma.Cm = 1e-9 ################################################### # This is where we create the synapse with MgBlock #-------------------------------------------------- nmda = moose.SynChan('/model/soma/nmda') nmda.Gbar = 1e-9 mgblock = moose.MgBlock('/model/soma/mgblock') mgblock.CMg = 2.0 mgblock.KMg_A = 1 / 0.33 mgblock.KMg_B = 1 / 60.0 # The synHandler manages the synapses and their learning rules if any. synHandler = moose.SimpleSynHandler('/model/soma/nmda/handler') synHandler.synapse.num = 1 moose.connect(synHandler, 'activationOut', nmda, 'activation') # MgBlock sits between original channel nmda and the # compartment. The origChannel receives the channel message from # the nmda SynChan. moose.connect(soma, 'VmOut', nmda, 'Vm') moose.connect(nmda, 'channelOut', mgblock, 'origChannel') moose.connect(mgblock, 'channel', soma, 'channel') # This is for comparing with MgBlock nmda_noMg = moose.copy(nmda, soma, 'nmda_noMg') moose.connect(nmda_noMg, 'channel', soma, 'channel') moose.le(nmda_noMg) ######################################### # The rest is for experiment setup spikegen = moose.SpikeGen('/model/spike') pulse = moose.PulseGen('/model/input') pulse.delay[0] = 10e-3 pulse.level[0] = 1.0 pulse.width[0] = 50e-3 moose.connect(pulse, 'output', spikegen, 'Vm') moose.le(synHandler) #syn = moose.element(synHandler.path + '/synapse' ) syn = synHandler.synapse[0] syn.delay = simdt * 2 syn.weight = 10 moose.connect(spikegen, 'spikeOut', synHandler.synapse[0], 'addSpike') moose.le(nmda_noMg) noMgSyn = moose.element(nmda_noMg.path + '/handler/synapse') noMgSyn.delay = 0.01 noMgSyn.weight = 1 moose.connect(spikegen, 'spikeOut', noMgSyn, 'addSpike') moose.showfields(syn) moose.showfields(noMgSyn) Gnmda = moose.Table('/data/Gnmda') moose.connect(Gnmda, 'requestOut', mgblock, 'getGk') Gnmda_noMg = moose.Table('/data/Gnmda_noMg') moose.connect(Gnmda_noMg, 'requestOut', nmda_noMg, 'getGk') Vm = moose.Table('/data/Vm') moose.connect(Vm, 'requestOut', soma, 'getVm') for i in range(10): moose.setClock(i, simdt) moose.setClock(Gnmda.tick, plotdt) print((spikegen.dt, Gnmda.dt)) moose.reinit() moose.start(simtime) t = pylab.linspace(0, simtime * 1e3, len(Vm.vector)) pylab.plot(t, (Vm.vector + 0.06) * 1000, label='Vm (mV)') pylab.plot(t, Gnmda.vector * 1e9, label='Gnmda (nS)') pylab.plot(t, Gnmda_noMg.vector * 1e9, label='Gnmda no Mg (nS)') pylab.legend() #data = pylab.vstack((t, Gnmda.vector, Gnmda_noMg.vector)).transpose() #pylab.savetxt('mgblock.dat', data) pylab.show()