def make_NMDA( name ): if moose.exists( '/library/' + name ): return NMDA = moose.NMDAChan( '/library/' + name ) NMDA.Ek = 0.0 NMDA.tau1 = 20.0e-3 NMDA.tau2 = 20.0e-3 NMDA.Gbar = 5 * SOMA_A NMDA.CMg = 1.2 # [Mg]ext in mM NMDA.KMg_A = 1.0/0.28 NMDA.KMg_B = 1.0/62 NMDA.temperature = 300 # Temperature in Kelvin. NMDA.extCa = 1.5 # [Ca]ext in mM NMDA.intCa = 0.00008 # [Ca]int in mM NMDA.intCaScale = 1 # Scale factor from elec Ca units to mM NMDA.intCaOffset = 0.00008 # Basal [Ca]int in mM NMDA.condFraction = 0.02 # Fraction of conductance due to Ca addmsg1 = moose.Mstring( NMDA.path + '/addmsg1' ) addmsg1.value = '. ICaOut ../Ca_conc current' addmsg2 = moose.Mstring( NMDA.path + '/addmsg2' ) addmsg2.value = '../Ca_conc concOut . assignIntCa' sh = moose.SimpleSynHandler( NMDA.path + '/sh' ) moose.connect( sh, 'activationOut', NMDA, 'activation' ) sh.numSynapses = 1 sh.synapse[0].weight = 1 return NMDA
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_Ca( name ): if moose.exists( '/library/' + name): return Ca = moose.HHChannel( '/library/' + name ) Ca.Ek = ECA Ca.Gbar = 40 * SOMA_A Ca.Gk = 0 Ca.Xpower = 2 Ca.Ypower = 1 Ca.Zpower = 0 xgate = moose.element( Ca.path + '/gateX' ) xA = np.array( [ 1.6e3, 0, 1.0, -1.0 * (0.065 + EREST_ACT), -0.01389, -20e3 * (0.0511 + EREST_ACT), 20e3, -1.0, -1.0 * (0.0511 + EREST_ACT), 5.0e-3, 3000, -0.1, 0.05 ] ) # xgate.min = -0.1 # xgate.max = 0.05 # xgate.divs = 3000 #// Converting Traub's expressions for the gCa/s alpha and beta functions #// to SI units and entering the A, B, C, D and F parameters, we get: # xgate.alpha( 1.6e3, 0, 1.0, -1.0 * (0.065 + EREST_ACT), -0.01389 ) # xgate.beta( -20e3 * (0.0511 + EREST_ACT), 20e3, -1.0, -1.0 * (0.0511 + EREST_ACT), 5.0e-3 ) #xgate.setupAlpha( xA ) xgate.alphaParms = xA # The Y gate (gCa/r) is not quite of this form. For V > EREST_ACT, alpha = # 5*{exp({-50*(V - EREST_ACT)})}. Otherwise, alpha = 5. Over the entire # range, alpha + beta = 5. To create the Y_A and Y_B tables, we use some # of the pieces of the setupalpha function. ygate = moose.element( Ca.path + '/gateY' ) ygate.min = -0.1 ygate.max = 0.05 ygate.divs = 3000 yA = np.zeros( (ygate.divs + 1), dtype=float) yB = np.zeros( (ygate.divs + 1), dtype=float) #Fill the Y_A table with alpha values and the Y_B table with (alpha+beta) dx = (ygate.max - ygate.min)/ygate.divs x = ygate.min for i in range( ygate.divs + 1 ): if ( x > EREST_ACT): yA[i] = 5.0 * math.exp( -50 * (x - EREST_ACT) ) else: yA[i] = 0.0 #yB[i] = 6.0 - yA[i] yB[i] = 5.0 x += dx ygate.tableA = yA ygate.tableB = yB # Tell the cell reader that the current from this channel must be fed into # the Ca_conc pool of calcium. addmsg1 = moose.Mstring( Ca.path + '/addmsg1' ) addmsg1.value = '. IkOut ../Ca_conc current' # in some compartments, whe have an NMDA_Ca_conc object to put the current # into. addmsg2 = moose.Mstring( Ca.path + '/addmsg2' ) addmsg2.value = '. IkOut ../NMDA_Ca_conc current' # Here we put in an addmsg command for nernst objects, if any. addmsg3 = moose.Mstring( Ca.path + '/addmsg3' ) addmsg3.value = '../Ca_conc/nernst Eout . setEk'
def CaN_SChan(name): CaN_S = moose.HHChannel('/library/' + name) CaN_S.Ek = ECa CaN_S.Gbar = 300.0 * SOMA_A CaN_S.Gk = 0.0 CaN_S.Xpower = 2.0 CaN_S.Ypower = 1.0 CaN_S.Zpower = 1.0 CaN_S.useConcentration = 1 CaN_S.instant = 4 celsius = 34 ki = .001 cai = 50e-6 cao = 10 mtfactor = 1.495491 htfactor = 1.760253 vhalfm = 23.916356 vhalfh = 39.676957 alph = 1.6e-4 * np.exp(-v * 1e3 / 48.4) beth = 1 / (np.exp((-v * 1e3 + vhalfh) / 10.) + 1.) alpm = 0.1967 * (-1.0 * v * 1e3 + vhalfm) / (np.exp( (-1.0 * v * 1e3 + vhalfm) / 10.0) - 1.0) betm = 0.046 * np.exp(-v * 1e3 / 20.73) a = alpm taum = mtfactor * 1 / (a + betm) * 1e-3 minf = a * mtfactor * 1 / (a + betm) a = alph tauh = htfactor * 1 / (a + beth) * 1e-3 hinf = a * htfactor * 1 / (a + beth) xgate = moose.element(CaN_S.path + '/gateX') xgate.min = Vmin xgate.max = Vmax xgate.divs = Vdivs xgate.tableA = minf / taum xgate.tableB = 1.0 / taum ygate = moose.element(CaN_S.path + '/gateY') ygate.min = Vmin ygate.max = Vmax ygate.divs = Vdivs ygate.tableA = hinf / tauh ygate.tableB = 1.0 / tauh zgate = moose.element(CaN_S.path + '/gateZ') zgate.min = Camin zgate.max = Camax zgate.divs = Cadivs zgate.tableA = ki / (ki + ca) zgate.tableB = ki / (ki + ca) addmsg2 = moose.Mstring(CaN_S.path + '/addmsg2') addmsg2.value = '. IkOut ../Ca_conc current' addmsg4 = moose.Mstring(CaN_S.path + '/addmsg4') addmsg4.value = '../Ca_conc concOut . concen' return CaN_S
def __new__(cls, name, bases, cdict): global prototypes # classes that set absract=True will be # abstract classes. Others will have the prototype insatntiated. if 'abstract' in cdict and cdict['abstract'] == True: return type.__new__(cls, name, bases, cdict) proto = moose.HHChannel('%s/%s' % (config.library.path, name)) xpower = get_class_field(name, cdict, bases, 'Xpower', default=0.0) if xpower > 0: proto.Xpower = xpower gate = moose.HHGate('%s/gateX' % (proto.path)) setup_gate_tables(gate, cdict, bases) cdict['xGate'] = gate ypower = get_class_field(name, cdict, bases, 'Ypower', default=0.0) if ypower > 0: proto.Ypower = ypower gate = moose.HHGate('%s/gateY' % (proto.path)) setup_gate_tables(gate, cdict, bases) cdict['yGate'] = gate zpower = get_class_field(name, cdict, bases, 'Zpower', default=0.0) if zpower > 0: proto.Zpower = zpower gate = moose.HHGate('%s/gateZ' % (proto.path)) setup_gate_tables(gate, cdict, bases) cdict['zGate'] = gate ca_msg_field = moose.Mstring('%s/addmsg1' % (proto.path)) ca_msg_field.value = '../CaPool concOut . concen' proto.instant = get_class_field(name, cdict, bases, 'instant', default=0) proto.useConcentration = True proto.Ek = get_class_field(name, cdict, bases, 'Ek', default=0.0) X = get_class_field(name, cdict, bases, 'X') if X is not None: proto.X = X Y = get_class_field(name, cdict, bases, 'Y') if Y is not None: proto.Y = Y Z = get_class_field(name, cdict, bases, 'Z') if Z is not None: proto.Z = Z mstring_field = get_class_field(name, cdict, bases, 'mstring') if mstring_field is not None: # print 'mstring_field:', mstring_field mstring = moose.Mstring('%s/%s' % (proto.path, mstring_field[0])) mstring.value = mstring_field[1] if 'annotation' in cdict: info = moose.Annotator('%s/info' % (proto.path)) info.notes = '\n'.join('%s: %s' % kv for kv in list(cdict['annotation'].items())) # print proto.path, info.notes cdict['prototype'] = proto prototypes[name] = proto config.logger.info('Created prototype: %s of class %s' % (proto.path, name)) return type.__new__(cls, name, bases, cdict)
def Ca_N_Chan(name): Ca_N = moose.HHChannel('/library/' + name) Ca_N.Ek = ECa Ca_N.Gbar = 300.0 * SOMA_A Ca_N.Gk = 0.0 Ca_N.Xpower = 2.0 Ca_N.Ypower = 1.0 Ca_N.Zpower = 1.0 Ca_N.useConcentration = 1 Ca_N.instant = 4 ki = .001 cai = 50e-6 cao = 10 mtfactor = 1 htfactor = 1 vhalfm = 19.88 vhalfh = 39.0 alph = 1.6e-4 * np.exp(-v * 1e3 / 48.4) beth = 1 / (np.exp((-v * 1e3 + vhalfh) / 10.) + 1.) alpm = 0.1967 * (-1.0 * v * 1e3 + vhalfm) / (np.exp( (-1.0 * v * 1e3 + vhalfm) / 10.0) - 1.0) betm = 0.046 * np.exp(-v * 1e3 / 20.73) a = alpm taum = mtfactor * 1 / (a + betm) minf = a * mtfactor * 1 / (a + betm) a = alph tauh = htfactor * 1 / (a + beth) hinf = a * htfactor * 1 / (a + beth) xgate = moose.element(Ca_N.path + '/gateX') xgate.min = Vmin xgate.max = Vmax xgate.divs = Vdivs xgate.tableA = minf / taum * 1e3 xgate.tableB = 1.0 / taum * 1e3 ygate = moose.element(Ca_N.path + '/gateY') ygate.min = Vmin ygate.max = Vmax ygate.divs = Vdivs ygate.tableA = hinf / tauh * 1e3 ygate.tableB = 1.0 / tauh * 1e3 zgate = moose.element(Ca_N.path + '/gateZ') zgate.min = Camin zgate.max = Camax zgate.divs = Cadivs zgate.tableA = ki / (ki + ca) zgate.tableB = ki / (ki + ca) addmsg2 = moose.Mstring(Ca_N.path + '/addmsg2') addmsg2.value = '. IkOut ../Ca_conc current' addmsg4 = moose.Mstring(Ca_N.path + '/addmsg4') addmsg4.value = '../Ca_conc concOut . concen' return Ca_N
def readSynapseML(self, synapseElement, units="SI units"): if 'Physiological Units' in units: # see pg 219 (sec 13.2) of Book of Genesis Vfactor = 1e-3 # V from mV Tfactor = 1e-3 # s from ms Gfactor = 1e-3 # S from mS elif 'SI Units' in units: Vfactor = 1.0 Tfactor = 1.0 Gfactor = 1.0 else: pu.fatal("Wrong units %s exiting ..." % units) sys.exit(1) if not moose.exists('/library'): moose.Neutral('/library') synname = synapseElement.attrib['name'] if utils.neuroml_debug: pu.info("Loading synapse : %s into /library" % synname) moosesynapse = moose.SynChan('/library/' + synname) doub_exp_syn = synapseElement.find('./{' + self.cml + '}doub_exp_syn') moosesynapse.Ek = float( doub_exp_syn.attrib['reversal_potential']) * Vfactor moosesynapse.Gbar = float( doub_exp_syn.attrib['max_conductance']) * Gfactor moosesynapse.tau1 = float( doub_exp_syn.attrib['rise_time']) * Tfactor # seconds moosesynapse.tau2 = float( doub_exp_syn.attrib['decay_time']) * Tfactor # seconds ## The delay and weight can be set only after connecting a spike event generator. ## delay and weight are arrays: multiple event messages can be connected to a single synapse ## graded synapses are not supported by neuroml, so set to False here, ## see my Demo/neuroml/lobster_pyloric/STG_net.py for how to still have graded synapses moosesynapse_graded = moose.Mstring(moosesynapse.path + '/graded') moosesynapse_graded.value = 'False' moosesynapse_mgblock = moose.Mstring(moosesynapse.path + '/mgblockStr') moosesynapse_mgblock.value = 'False' ## check if STDP synapse is present or not stdp_syn = synapseElement.find('./{' + self.cml + '}stdp_syn') if stdp_syn is None: moosesynhandler = moose.SimpleSynHandler('/library/' + synname + '/handler') else: moosesynhandler = moose.STDPSynHandler('/library/' + synname + '/handler') moosesynhandler.aPlus0 = float(stdp_syn.attrib['del_weight_ltp']) moosesynhandler.aMinus0 = float(stdp_syn.attrib['del_weight_ltd']) moosesynhandler.tauPlus = float(stdp_syn.attrib['tau_ltp']) moosesynhandler.tauMinus = float(stdp_syn.attrib['tau_ltd']) moosesynhandler.weightMax = float( stdp_syn.attrib['max_syn_weight']) moosesynhandler.weightMin = 0.0 ## connect the SimpleSynHandler or the STDPSynHandler to the SynChan (double exp) moose.connect(moosesynhandler, 'activationOut', moosesynapse, 'activation')
def KahpChanKO(name): Kahp = moose.HHChannel('/library/' + name) Kahp.Ek = Ek_K Kahp.Gbar = 8.0 * SOMA_A Kahp.Gk = 0.0 Kahp.Xpower = 0.0 Kahp.Ypower = 0.0 Kahp.Zpower = 1.0 Kahp.useConcentration = 1 #changed from Kahp.useConcentration = 0 zgate = moose.element(Kahp.path + '/gateZ') zgate.min = Camin zgate.max = Camax zgate.divs = Cadivs zA = np.zeros((zgate.divs + 1), dtype=float) zB = np.zeros((zgate.divs + 1), dtype=float) dx = (zgate.max - zgate.min) / zgate.divs x = zgate.min for i in range(zgate.divs + 1): # zA[i] = min( 500.00 * x * Ca_scale, 10 ) #in paper, its zA[i] = min( 0.02 * x, 10 ) zA[i] = min( 0.02 * x / 2, 10 ) #changed from zA[i] = min( 250.00 * x, 10 ) #2 times decrease in sensitivity # zA[i] = min( 0.02 * x, 10.0 ) zB[i] = 1.0 + min(0.02 * x, 10) #changed from zB[i] = 1.0 x = x + dx zgate.tableA = zA zgate.tableB = zB addmsg1 = moose.Mstring(Kahp.path + '/addmsg1') addmsg1.value = '../Ca_conc concOut . concen' return Kahp
def CaR_SChan(name): CaR_S = moose.HHChannel('/library/' + name) CaR_S.Ek = ECa CaR_S.Gbar = 300.0 * SOMA_A CaR_S.Gk = 0.0 CaR_S.Xpower = 3.0 CaR_S.Ypower = 1.0 CaR_S.Zpower = 0.0 celsius = 34 v = np.arange(Vmin, Vmax + dV, dV) infm = 1.0 / (1 + np.exp((v + 60e-3) / (-3e-3))) taum = 100e-3 + 0 * v infh = 1.0 / (1 + np.exp((v + 62e-3) / (1e-3))) tauh = 5e-3 + 0 * v xgate = moose.element(CaR_S.path + '/gateX') xgate.min = Vmin xgate.max = Vmax xgate.divs = Vdivs xgate.tableA = infm / taum xgate.tableB = 1.0 / taum ygate = moose.element(CaR_S.path + '/gateY') ygate.min = Vmin ygate.max = Vmax ygate.divs = Vdivs ygate.tableA = infh / tauh ygate.tableB = 1.0 / tauh addmsg1 = moose.Mstring(CaR_S.path + '/addmsg1') addmsg1.value = '. IkOut ../Ca_conc current' return CaR_S
def KsAHP_Chan(name): KsAHP = moose.HHChannel('/library/' + name) KsAHP.Ek = EK KsAHP.Gbar = 300.0 * SOMA_A KsAHP.Gk = 0.0 KsAHP.Xpower = 0.0 KsAHP.Ypower = 0.0 KsAHP.Zpower = 3.0 KsAHP.useConcentration = 1 celsius = 36 gbar = 0.01 beta = 0.03e3 cac = 0.025 taumin = 0.5e-3 tadj = 3**((celsius - 22.0) / 10) ca = np.arange(Camin, Camax + dCa, dCa) car = (ca / cac)**2 m_inf = car / (1 + car) tau_m = 1 / beta / (1 + car) / tadj tau_m[tau_m < taumin] = taumin zgate = moose.element(KsAHP.path + '/gateZ') zgate.min = Camin zgate.max = Camax zgate.divs = Cadivs zgate.tableA = m_inf / tau_m zgate.tableB = 1.0 / tau_m addmsg3 = moose.Mstring(KsAHP.path + '/addmsg3') addmsg3.value = '../Ca_conc concOut . concen' return KsAHP
def CaR_SChan(name): # Magee and Johnston (1995) and Poirazi et al. (2003) #Currently from Poirazi2003 CaR_S = moose.HHChannel( '/library/' + name ) CaR_S.Ek = ECa CaR_S.Gbar = 300.0*SOMA_A CaR_S.Gk = 0.0 CaR_S.Xpower = 3.0 CaR_S.Ypower = 1.0 CaR_S.Zpower = 0.0 celsius = 34 infm = 1 / (1 + np.exp((v*1e3+60)/(-3))) taum = (100 + 0*v)*1e-3 infh = 1/ (1 + np.exp((v*1e3+62)/(1))) tauh = (5 + 0*v)*1e-3 xgate = moose.element( CaR_S.path + '/gateX' ) xgate.min = Vmin xgate.max = Vmax xgate.divs = Vdivs xgate.tableA = infm/taum xgate.tableB = 1.0/taum ygate = moose.element( CaR_S.path + '/gateY' ) ygate.min = Vmin ygate.max = Vmax ygate.divs = Vdivs ygate.tableA = infh/tauh ygate.tableB = 1.0/tauh addmsg1 = moose.Mstring( CaR_S.path + '/addmsg1' ) addmsg1.value = '. IkOut ../Ca_conc current' return CaR_S
def CaT_Chan(name): CaT = moose.HHChannel('/library/' + name) CaT.Ek = ECa CaT.Gbar = 300.0 * SOMA_A CaT.Gk = 0.0 CaT.Xpower = 2.0 CaT.Ypower = 1.0 CaT.Zpower = 1.0 CaT.useConcentration = 1 CaT.instant = 4 tBase = 23.5 celsius = 22 gcatbar = 0 ki = 0.001 cai = 5.e-5 cao = 2 tfa = 1 tfi = 0.68 v = np.arange(Vmin, Vmax + dV, dV) alph = 1.6e-1 * np.exp(-(v + 57e-3) / 19e-3) beth = 1e3 / (np.exp((-v + 15e-3) / 10e-3) + 1.0) alpm = 0.1967e6 * (-1.0 * v + 19.88e-3) / (np.exp( (-1.0 * v + 19.88e-3) / 10.0e-3) - 1.0) betm = 0.046e3 * np.exp(-v / 22.73e-3) a = alpm taum = 1.0 / (tfa * (a + betm)) minf = a / (a + betm) a = alph tauh = 1.0 / (tfi * (a + beth)) hinf = a / (a + beth) xgate = moose.element(CaT.path + '/gateX') xgate.min = Vmin xgate.max = Vmax xgate.divs = Vdivs xgate.tableA = minf / taum xgate.tableB = 1.0 / taum ygate = moose.element(CaT.path + '/gateY') ygate.min = Vmin ygate.max = Vmax ygate.divs = Vdivs ygate.tableA = hinf / tauh ygate.tableB = 1.0 / tauh zgate = moose.element(CaT.path + '/gateZ') zgate.min = Camin zgate.max = Camax zgate.divs = Cadivs ca = np.arange(Camin, Camax + dCa, dCa) zgate.tableA = ki / (ki + ca) zgate.tableB = ki / (ki + ca) #Does not activate calcium-dependent currents addmsg4 = moose.Mstring(CaT.path + '/addmsg4') addmsg4.value = '../Ca_conc concOut . concen' return CaT
def KSK_Chan(name): KSK = moose.HHChannel('/library/' + name) KSK.Ek = EK KSK.Gbar = 300.0 * SOMA_A KSK.Gk = 0.0 KSK.Xpower = 0.0 KSK.Ypower = 0.0 KSK.Zpower = 1.0 KSK.useConcentration = 1 celsius = 36 cac = 0.56e-3 taumin = 6.3e-3 ca = np.arange(Camin, Camax + dCa, dCa) car = (ca / cac)**4.6 m_inf = car / (1 + car) tau_m = taumin + 0 * ca zgate = moose.element(KSK.path + '/gateZ') zgate.min = Camin zgate.max = Camax zgate.divs = Cadivs zgate.tableA = m_inf / tau_m zgate.tableB = 1.0 / tau_m addmsg3 = moose.Mstring(KSK.path + '/addmsg3') addmsg3.value = '../Ca_conc concOut . concen' return KSK
def K_BK_Chan(name): K_BK = moose.HHChannel2D( '/library/' + name ) K_BK.Ek = EK K_BK.Gbar = 300.0*SOMA_A K_BK.Gk = 0.0 K_BK.Xpower = 0.0 K_BK.Ypower = 0.0 K_BK.Zpower = 1.0 K_BK.Zindex = 'VOLT_C1_INDEX' zgate = moose.element( K_BK.path + '/gateZ' ) zgate.xminA = Vmin zgate.xmaxA = Vmax zgate.xdivsA = Vdivs zgate.yminA = Camin zgate.ymaxA = Camax zgate.ydivsA = Cadivs zgate.xminB = Vmin zgate.xmaxB = Vmax zgate.xdivsB = Vdivs zgate.yminB = Camin zgate.ymaxB = Camax zgate.ydivsB = Cadivs zgate.tableA = tblA*1e3 zgate.tableB = tblB*1e3 addmsg4 = moose.Mstring( K_BK.path + '/addmsg4' ) addmsg4.value = '../Ca_conc concOut . concen' return K_BK
def Ca_LVAst_Chan(name): Ca_LVAst = moose.HHChannel( '/library/' + name ) Ca_LVAst.Ek = ECa Ca_LVAst.Gbar = 300.0*SOMA_A Ca_LVAst.Gk = 0.0 Ca_LVAst.Xpower = 2.0 Ca_LVAst.Ypower = 1.0 Ca_LVAst.Zpower = 0.0 qt = 2.3**((34-21)/10) V = v+0.010 #Because Hay2011 shifted this mInf = 1.0000/(1+ np.exp((V*1e3 - -30.000)/-6)) mTau = (5.0000 + 20.0000/(1+np.exp((V*1e3 - -25.000)/5)))/qt hInf = 1.0000/(1+ np.exp((V*1e3 - -80.000)/6.4)) hTau = (20.0000 + 50.0000/(1+np.exp((V*1e3 - -40.000)/7)))/qt xgate = moose.element( Ca_LVAst.path + '/gateX' ) xgate.min = Vmin xgate.max = Vmax xgate.divs = Vdivs xgate.tableA = mInf/mTau*1e3 xgate.tableB = 1/mTau*1e3 ygate = moose.element( Ca_LVAst.path + '/gateY' ) ygate.min = Vmin ygate.max = Vmax ygate.divs = Vdivs ygate.tableA = hInf/hTau*1e3 ygate.tableB = 1/hTau*1e3 addmsg2 = moose.Mstring( Ca_LVAst.path + '/addmsg2' ) addmsg2.value = '. IkOut ../Ca_conc current' return Ca_LVAst
def simpChan(name): simp = moose.HHChannel('/library/' + name) simp.Ek = Ek_K simp.Gbar = 150 * SOMA_A simp.Gk = 0 simp.Xpower = 0 simp.Ypower = 0 simp.Zpower = 1 simp.instant = 4 simp.useConcentration = 1 zgate = moose.element(simp.path + '/gateZ') zgate.min = Camin zgate.max = Camax zgate.divs = Cadivs zA = np.zeros((zgate.divs + 1), dtype=float) zB = np.zeros((zgate.divs + 1), dtype=float) dx = (zgate.max - zgate.min) / zgate.divs x = zgate.min for i in range(zgate.divs + 1): zA[i] = min(1.0, x / zgate.max) #in the paper, its zA[i] = min( 1.0, x/250 ) # zA[i] = min( 1.0, x/250 ) zB[i] = 1.0 x += dx zgate.tableA = zA zgate.tableB = zB addmsg1 = moose.Mstring(simp.path + '/addmsg1') addmsg1.value = '../Ca_conc concOut . concen' return simp
def Ca_HVA_Chan(name): Ca_HVA = moose.HHChannel('/library/' + name) Ca_HVA.Ek = ECa Ca_HVA.Gbar = 300.0 * SOMA_A Ca_HVA.Gk = 0.0 Ca_HVA.Xpower = 2.0 Ca_HVA.Ypower = 1.0 Ca_HVA.Zpower = 0.0 mAlpha = (0.055 * (-27 - v * 1e3)) / (np.exp((-27 - v * 1e3) / 3.8) - 1) mBeta = (0.94 * np.exp((-75 - v * 1e3) / 17)) hAlpha = (0.000457 * np.exp((-13 - v * 1e3) / 50)) hBeta = (0.0065 / (np.exp((-v * 1e3 - 15) / 28) + 1)) xgate = moose.element(Ca_HVA.path + '/gateX') xgate.min = Vmin xgate.max = Vmax xgate.divs = Vdivs xgate.tableA = mAlpha * 1e3 xgate.tableB = (mAlpha + mBeta) * 1e3 ygate = moose.element(Ca_HVA.path + '/gateY') ygate.min = Vmin ygate.max = Vmax ygate.divs = Vdivs ygate.tableA = hAlpha * 1e3 ygate.tableB = (hAlpha + hBeta) * 1e3 addmsg2 = moose.Mstring(Ca_HVA.path + '/addmsg2') addmsg2.value = '. IkOut ../Ca_conc current' return Ca_HVA
def KSK_Chan(name): KSK = moose.HHChannel('/library/' + name) KSK.Ek = EK KSK.Gbar = 300.0 * SOMA_A KSK.Gk = 0.0 KSK.Xpower = 0.0 KSK.Ypower = 0.0 KSK.Zpower = 3.0 KSK.useConcentration = 1 celsius = 36 gbar = 0.01 beta = 0.03e3 cac = 0.025 #Seems too high to me # cac = 0.00075 #Its mentioned somewhere in the modelDB. So, try this too taumin = 5e-3 tadj = 3**((celsius - 22.0) / 10) ca = np.arange(Camin, Camax + dCa, dCa) car = (ca / cac)**2 m_inf = car / (1 + car) tau_m = 1 / beta / (1 + car) / tadj tau_m[tau_m < taumin] = taumin zgate = moose.element(KSK.path + '/gateZ') zgate.min = Camin zgate.max = Camax zgate.divs = Cadivs zgate.tableA = m_inf / tau_m zgate.tableB = 1.0 / tau_m addmsg3 = moose.Mstring(KSK.path + '/addmsg3') addmsg3.value = '../Ca_conc concOut . concen' return KSK
def K_BK_Chan(name): K_BK = moose.HHChannel2D('/library/' + name) K_BK.Ek = EK K_BK.Gbar = 300.0 * SOMA_A K_BK.Gk = 0.0 K_BK.Xpower = 0.0 K_BK.Ypower = 0.0 K_BK.Zpower = 1.0 K_BK.Zindex = 'VOLT_C1_INDEX' # cai = 5.e-5 # d1 = .84 # d2 = 1. # k1 = .48e-3 # k2 = .13e-6 # abar = .28 # bbar = .48 # st=1 # tfactor = 1 # F_KC = F/1000.0 # # def exp1(k,d,v): # return k*np.exp(-2*d*F_KC*v*1e3/R/(273.15 + celsius)) # def alp(v,c): # return c*abar/(c + exp1(k1,d1,v)) # def bet(v,c): # return bbar/(1 + c/exp1(k2,d2,v)) zgate = moose.element(K_BK.path + '/gateZ') zgate.xminA = Vmin zgate.xmaxA = Vmax zgate.xdivsA = Vdivs zgate.yminA = Camin zgate.ymaxA = Camax zgate.ydivsA = Cadivs zgate.xminB = Vmin zgate.xmaxB = Vmax zgate.xdivsB = Vdivs zgate.yminB = Camin zgate.ymaxB = Camax zgate.ydivsB = Cadivs # x = Vmin # tblA = np.zeros([len(v),len(ca)]) # tblB = np.zeros([len(v),len(ca)]) # for i in np.arange(len(v)): # tblA[i] = np.array([alp(x,y) for y in ca]) # tblB[i] = np.add(tblA[i],[bet(x, y) for y in ca])/tfactor # x = x + dV # print(i, end='\r') # # zgate.tableA = tblA*1e3 # zgate.tableB = tblB*1e3 zgate.tableA = tblA zgate.tableB = tblB addmsg4 = moose.Mstring(K_BK.path + '/addmsg4') addmsg4.value = '../Ca_conc concOut . concen' return K_BK
def KahpChan( name ): Kahp = moose.HHChannel( '/library/' + name ) Kahp.Ek = -0.015 + EREST Kahp.Gbar = 8*SOMA_A Kahp.Gk = 0 Kahp.Xpower = 0 Kahp.Ypower = 0 Kahp.Zpower = 1 Kahp.useConcentration = 1 #changed from Kahp.useConcentration = 0 zgate = moose.element( Kahp.path + '/gateZ' ) zgate.min = Camin zgate.max = Camax zgate.divs = Cadivs zA = np.zeros( (zgate.divs + 1), dtype=float) zB = np.zeros( (zgate.divs + 1), dtype=float) dx = (zgate.max - zgate.min)/zgate.divs x = zgate.min for i in range( zgate.divs + 1 ): zA[i] = min( 250.00 * x, 10 ) #in paper, its zA[i] = min( 0.02 * x, 10 ) zB[i] = 1.0 + zA[i] #changed from zB[i] = 1.0 x = x + dx zgate.tableA = zA zgate.tableB = zB addmsg1 = moose.Mstring( Kahp.path + '/addmsg1' ) addmsg1.value = '../Ca_conc concOut . concen' return Kahp
def make_K_AHP(): if moose.exists('K_AHP'): return K_AHP = moose.HHChannel('K_AHP') K_AHP.Ek = EK # V K_AHP.Gbar = 8 * SOMA_A # S K_AHP.Gk = 0 # S K_AHP.Xpower = 0 K_AHP.Ypower = 0 K_AHP.Zpower = 1 zgate = moose.element('K_AHP/gateZ') xmax = 500.0 zgate.min = 0 zgate.max = xmax zgate.divs = 3000 zA = numpy.zeros((zgate.divs + 1), dtype=float) zB = numpy.zeros((zgate.divs + 1), dtype=float) dx = (zgate.max - zgate.min) / zgate.divs x = zgate.min for i in range(zgate.divs + 1): if (x < (xmax / 2.0)): zA[i] = 0.02 * x else: zA[i] = 10.0 zB[i] = zA[i] + 1.0 x = x + dx zgate.tableA = zA zgate.tableB = zB addmsg1 = moose.Mstring('/library/K_AHP/addmsg1') addmsg1.value = '../Ca_conc concOut . concen'
def Ca_R_Chan(name): Ca_R = moose.HHChannel( '/library/' + name ) Ca_R.Ek = ECa Ca_R.Gbar = 300.0*SOMA_A Ca_R.Gk = 0.0 Ca_R.Xpower = 3.0 Ca_R.Ypower = 1.0 Ca_R.Zpower = 0.0 minf = 1 / (1 + np.exp((v*1e3+60)/(-3))) taum = 100 + 0*v*1e3 hinf = 1/ (1 + np.exp((v*1e3+62)/(1))) tauh = 5 + 0*v*1e3 xgate = moose.element( Ca_R.path + '/gateX' ) xgate.min = Vmin xgate.max = Vmax xgate.divs = Vdivs xgate.tableA = minf/taum*1e3 xgate.tableB = 1.0/taum*1e3 ygate = moose.element( Ca_R.path + '/gateY' ) ygate.min = Vmin ygate.max = Vmax ygate.divs = Vdivs ygate.tableA = hinf/tauh*1e3 ygate.tableB = 1.0/tauh*1e3 addmsg1 = moose.Mstring( Ca_R.path + '/addmsg1' ) addmsg1.value = '. IkOut ../Ca_conc current' return Ca_R
def make_K_AHP( name ): if moose.exists( '/library/' + name ): return K_AHP = moose.HHChannel( '/library/' + name ) K_AHP.Ek = EK # V K_AHP.Gbar = 8 * SOMA_A # S K_AHP.Gk = 0 # S K_AHP.Xpower = 0 K_AHP.Ypower = 0 K_AHP.Zpower = 1 K_AHP.useConcentration = 1 zgate = moose.element( K_AHP.path + '/gateZ' ) xmax = 0.02 # 20 micromolar. zgate.min = 0 zgate.max = xmax zgate.divs = 3000 zA = np.zeros( (zgate.divs + 1), dtype=float) zB = np.zeros( (zgate.divs + 1), dtype=float) dx = (zgate.max - zgate.min)/zgate.divs x = zgate.min for i in range( zgate.divs + 1 ): zA[i] = min( 250.00 * CA_SCALE * x, 10 ) zB[i] = 1.0 + zA[i] x = x + dx zgate.tableA = zA zgate.tableB = zB addmsg1 = moose.Mstring( K_AHP.path + '/addmsg1' ) addmsg1.value = '../Ca_conc concOut . concen'
def K_SK_Chan(name): K_SK = moose.HHChannel('/library/' + name) K_SK.Ek = EK K_SK.Gbar = 300.0 * SOMA_A K_SK.Gk = 0.0 K_SK.Xpower = 0 K_SK.Ypower = 0 K_SK.Zpower = 3 K_SK.useConcentration = 1 cai = 2.4e-5 gbar = 0.01 beta = 0.03 cac = 0.00035 taumin = 0.5 q10 = 3 tadj = q10**((celsius - 22.0) / 10) car = (ca / cac)**4 m_inf = car / (1 + car) tau_m = 1 / beta / (1 + car) / tadj tau_m[tau_m < taumin] = taumin zgate = moose.element(K_SK.path + '/gateZ') zgate.min = Camin zgate.max = Camax zgate.divs = Cadivs zgate.tableA = m_inf / tau_m * 1e3 zgate.tableB = 1.0 / tau_m * 1e3 addmsg3 = moose.Mstring(K_SK.path + '/addmsg3') addmsg3.value = '../Ca_conc concOut . concen' return K_SK
def K_SK_Chan(name): K_SK = moose.HHChannel('/library/' + name) K_SK.Ek = EK K_SK.Gbar = 300.0 * SOMA_A K_SK.Gk = 0.0 K_SK.Xpower = 0.0 K_SK.Ypower = 0.0 K_SK.Zpower = 3.0 K_SK.useConcentration = 1 n = 4 cai = 50.e-6 a0 = 1.3e13 b0 = .5e-2 tfactor = 1 cahalf = 140.04e-6 k = 0.10857 alp = a0 * ca**n a = alp tau = tfactor * 1 / (a + b0) inf = 1 / (1 + np.exp((np.log(cahalf / ca)) / k)) zgate = moose.element(K_SK.path + '/gateZ') zgate.min = Camin zgate.max = Camax zgate.divs = Cadivs zgate.tableA = inf / tau * 1e3 zgate.tableB = 1.0 / tau * 1e3 addmsg3 = moose.Mstring(K_SK.path + '/addmsg3') addmsg3.value = '../Ca_conc concOut . concen' return K_SK
def CaT_Chan(name): CaT = moose.HHChannel('/library/' + name) CaT.Ek = ECa CaT.Gbar = 300.0 * SOMA_A CaT.Gk = 0.0 CaT.Xpower = 2.0 CaT.Ypower = 1.0 CaT.Zpower = 0.0 celsius = 25 gcatbar = .003 cao = 2 q10 = 5 mmin = 0.2 hmin = 10 a0h = 0.015 zetah = 3.5 vhalfh = -70.018017 gmh = 0.6 a0m = 0.04 zetam = 2 vhalfm = -17.868123 gmm = 0.61 vhm = -60 vhh = -85 mtfactor = 1.552435 htfactor = 0.963171 alph = np.exp(0.0378 * zetah * (v * 1e3 - vhalfh)) beth = np.exp(0.0378 * zetah * gmh * (v * 1e3 - vhalfh)) alpmt = np.exp(0.0378 * zetam * (v * 1e3 - vhalfm)) betmt = np.exp(0.0378 * zetam * gmm * (v * 1e3 - vhalfm)) qt = q10**((celsius - 25) / 10) minf = (1 / (1 + np.exp(-(v * 1e3 - vhm) / 10))) mtau = mtfactor * betmt / (qt * a0m * (1 + alpmt)) * 1e-3 mtau[mtau < mmin * 1e-3] = mmin * 1e-3 hinf = (1 / (1 + np.exp((v * 1e3 - vhh) / 10))) htau = htfactor * beth / (a0h * (1 + alph)) * 1e-3 htau[htau < hmin * 1e-3] = hmin * 1e-3 xgate = moose.element(CaT.path + '/gateX') xgate.min = Vmin xgate.max = Vmax xgate.divs = Vdivs xgate.tableA = minf / mtau xgate.tableB = 1.0 / mtau ygate = moose.element(CaT.path + '/gateY') ygate.min = Vmin ygate.max = Vmax ygate.divs = Vdivs ygate.tableA = hinf / htau ygate.tableB = 1.0 / htau addmsg1 = moose.Mstring(CaT.path + '/addmsg1') addmsg1.value = '. IkOut ../Ca_conc current' return CaT
def KBK_Chan(name): KBK = moose.HHChannel2D('/library/' + name) KBK.Ek = EK KBK.Gbar = 300.0 * SOMA_A KBK.Gk = 0.0 KBK.Xpower = 0.0 KBK.Ypower = 0.0 KBK.Zpower = 1.0 KBK.Zindex = 'VOLT_C1_INDEX' cai = 5.e-5 d1 = .84 d2 = 1. k1 = 0.000588 k2 = 8.76481e-08 abar = .28 bbar = .48 st = 1 tfactor = 1.279493 F_KC = F / 1000.0 def exp1(k, d, v): return k * np.exp(-2 * d * F_KC * v * 1e3 / R / (273.15 + celsius)) def alp(v, c): return c * abar / (c + exp1(k1, d1, v)) def bet(v, c): return bbar / (1 + c / exp1(k2, d2, v)) zgate = moose.element(KBK.path + '/gateZ') zgate.xminA = Vmin zgate.xmaxA = Vmax zgate.xdivsA = Vdivs zgate.yminA = Camin zgate.ymaxA = Camax zgate.ydivsA = Cadivs zgate.xminB = Vmin zgate.xmaxB = Vmax zgate.xdivsB = Vdivs zgate.yminB = Camin zgate.ymaxB = Camax zgate.ydivsB = Cadivs x = Vmin tblA = np.zeros([len(v), len(ca)]) tblB = np.zeros([len(v), len(ca)]) for i in np.arange(len(v)): tblA[i] = np.array([alp(x, y) for y in ca]) tblB[i] = np.add(tblA[i], [bet(x, y) for y in ca]) / tfactor x = x + dV print(i, end='\r') zgate.tableA = tblA * 1e3 zgate.tableB = tblB * 1e3 addmsg4 = moose.Mstring(KBK.path + '/addmsg4') addmsg4.value = '../Ca_conc concOut . concen' return KBK
def readSynapseML(self, synapseElement, units="SI units"): # see pg 219 (sec 13.2) of Book of Genesis if 'Physiological Units' in units: Vfactor = 1e-3 # V from mV Tfactor = 1e-3 # s from ms Gfactor = 1e-3 # S from mS elif 'SI Units' in units: Vfactor = 1.0 Tfactor = 1.0 Gfactor = 1.0 else: debug.printDebug("ERROR", "Wrong units {0}".format(units)) raise UserWarning, "Wrong value or parameter {0}".format(units) # creates /library in MOOSE tree; elif present, wraps # NOTE: This path is created by NeuroML now in __init__. Disabling, # Dilawar Singh #moose.Neutral(self.libraryPath+'') if utils.neuroml_debug: synName = synapseElement.attrib['name'] msg = "Loading synapse : %s into library ." % synName debug.printDebug("INFO", msg) self.mooseSynp = moose.SynChan( os.path.join(self.libraryPath, synapseElement.attrib['name'])) doub_exp_syn = synapseElement.find('./{' + self.cml + '}doub_exp_syn') self.mooseSynp.Ek = float(doub_exp_syn.attrib['reversal_potential']) \ * Vfactor self.mooseSynp.Gbar = float(doub_exp_syn.attrib['max_conductance'])\ * Gfactor # seconds self.mooseSynp.tau1 = float(doub_exp_syn.attrib['rise_time']) * Tfactor # second\s self.mooseSynp.tau2 = float( doub_exp_syn.attrib['decay_time']) * Tfactor # The delay and weight can be set only after connecting a spike event # generator. delay and weight are arrays: multiple event messages can # be connected to a single synapse self.mooseSynp_graded = moose.Mstring(self.mooseSynp.path + '/graded') self.mooseSynp_graded.value = 'False' self.mooseSynp_mgblock = moose.Mstring(self.mooseSynp.path + '/mgblock') self.mooseSynp_mgblock.value = 'False'
def make_vclamp( name = 'Vclamp', parent = '/library' ): if moose.exists( '/library/' + name ): return vclamp = moose.VClamp( parent + '/' + name ) vclamp.mode = 0 # Default. could try 1, 2 as well vclamp.tau = 0.2e-3 # lowpass filter for command voltage input vclamp.ti = 20e-6 # Integral time vclamp.td = 5e-6 # Differential time. Should it be >= dt? vclamp.gain = 0.00005 # Gain of vclamp ckt. # Connect voltage clamp circuitry addmsg1 = moose.Mstring( vclamp.path + '/addmsg1' ) addmsg1.value = '. currentOut .. injectMsg' addmsg2 = moose.Mstring( vclamp.path + '/addmsg2' ) addmsg2.value = '.. VmOut . sensedIn' return vclamp