Exemplo n.º 1
0
def makeChannelPrototypes():
    """Create channel prototypes for readcell."""
    library = moose.Neutral('/library')
    moose.setCwe('/library')
    compt = moose.SymCompartment('/library/symcompartment')
    Em = EREST_ACT + 10.613e-3
    compt.Em = Em
    compt.initVm = EREST_ACT
    compt.Cm = 7.85e-9 * 0.5
    compt.Rm = 4.2e5 * 5.0
    compt.Ra = 7639.44e3
    nachan = moose.HHChannel('/library/Na')
    nachan.Xpower = 3
    xGate = moose.HHGate(nachan.path + '/gateX')
    xGate.setupAlpha(Na_m_params + [VDIVS, VMIN, VMAX])
    xGate.useInterpolation = 1
    nachan.Ypower = 1
    yGate = moose.HHGate(nachan.path + '/gateY')
    yGate.setupAlpha(Na_h_params + [VDIVS, VMIN, VMAX])
    yGate.useInterpolation = 1
    nachan.Gbar = 0.942e-3
    nachan.Ek = 115e-3 + EREST_ACT

    kchan = moose.HHChannel('/library/K')
    kchan.Xpower = 4.0
    xGate = moose.HHGate(kchan.path + '/gateX')
    xGate.setupAlpha(K_n_params + [VDIVS, VMIN, VMAX])
    xGate.useInterpolation = 1
    kchan.Gbar = 0.2836e-3
    kchan.Ek = -12e-3 + EREST_ACT
Exemplo n.º 2
0
def createSquid():
    """Create a single compartment squid model."""
    parent = moose.Neutral('/n')
    compt = moose.SymCompartment('/n/compt')
    Em = EREST_ACT + 10.613e-3
    compt.Em = Em
    compt.initVm = EREST_ACT
    compt.Cm = 7.85e-9 * 0.5
    compt.Rm = 4.2e5 * 5.0
    compt.Ra = 7639.44e3
    nachan = moose.HHChannel('/n/compt/Na')
    nachan.Xpower = 3
    xGate = moose.HHGate(nachan.path + '/gateX')
    xGate.setupAlpha(Na_m_params + [VDIVS, VMIN, VMAX])
    xGate.useInterpolation = 1
    nachan.Ypower = 1
    yGate = moose.HHGate(nachan.path + '/gateY')
    yGate.setupAlpha(Na_h_params + [VDIVS, VMIN, VMAX])
    yGate.useInterpolation = 1
    nachan.Gbar = 0.942e-3
    nachan.Ek = 115e-3 + EREST_ACT
    moose.connect(nachan, 'channel', compt, 'channel', 'OneToOne')

    kchan = moose.HHChannel('/n/compt/K')
    kchan.Xpower = 4.0
    xGate = moose.HHGate(kchan.path + '/gateX')
    xGate.setupAlpha(K_n_params + [VDIVS, VMIN, VMAX])
    xGate.useInterpolation = 1
    kchan.Gbar = 0.2836e-3
    kchan.Ek = -12e-3 + EREST_ACT
    moose.connect(kchan, 'channel', compt, 'channel', 'OneToOne')
    return compt
Exemplo n.º 3
0
 def loadCell(self):
     self.context.readCell('gran_aditya_migliore.p',self.path)
     self._gran = moose.Cell(self.path)
     self._granSoma = moose.Compartment(self.path+'/soma')
     self._granSomaKA = moose.Compartment(self.path+'/soma/KA_ms')
     self._granPeri = moose.Compartment(self.path+'/periphery')
     self._granPeriNa = moose.HHChannel(self.path+'/periphery/Na_rat_ms')
     self._granPeriKA = moose.HHChannel(self.path+'/periphery/KA_ms')
Exemplo n.º 4
0
def make_Na():
    if moose.exists('Na'):
        return
    Na = moose.HHChannel('Na')
    Na.Ek = ENA  #	V
    Na.Gbar = 300 * SOMA_A  #	S
    Na.Gk = 0  #	S
    Na.Xpower = 2
    Na.Ypower = 1
    Na.Zpower = 0

    xgate = moose.element('Na/gateX')
    xA = numpy.array([
        320e3 * (0.0131 + EREST_ACT), -320e3, -1.0,
        -1.0 * (0.0131 + EREST_ACT), -0.004, -280e3 * (0.0401 + EREST_ACT),
        280e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 5.0e-3, 3000, -0.1, 0.05
    ])
    xgate.alphaParms = xA

    #xgate.alpha( 320e3 * (0.0131 + EREST_ACT), -320e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.004 )
    #xgate.beta( -280e3 * (0.0401 + EREST_ACT), 280e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 5.0e-3 )

    ygate = moose.element('Na/gateY')
    yA = numpy.array([
        128.0, 0.0, 0.0, -1.0 * (0.017 + EREST_ACT), 0.018, 4.0e3, 0.0, 1.0,
        -1.0 * (0.040 + EREST_ACT), -5.0e-3, 3000, -0.1, 0.05
    ])
    ygate.alphaParms = yA
Exemplo n.º 5
0
    def __init__(self,
                 name,
                 compartment,
                 specific_gbar,
                 e_rev,
                 Xpower,
                 Ypower=0.0,
                 Zpower=0.0):
        """Instantuate an ion channel.

        name -- name of the channel.
        
        compartment -- moose.Compartment object that contains the channel.

        specific_gbar -- specific value of maximum conductance.

        e_rev -- reversal potential of the channel.
        
        Xpower -- exponent for the first gating parameter.

        Ypower -- exponent for the second gatinmg component.
        """
        self.path = "%s/%s" % (compartment.path, name)
        self.chan = moose.HHChannel(self.path)
        self.chan.Gbar = specific_gbar * compartment.area
        self.chan.Ek = e_rev
        self.chan.Xpower = Xpower
        self.chan.Ypower = Ypower
        self.chan.Zpower = Zpower
        moose.connect(self.chan, "channel", compartment.C, "channel")
Exemplo n.º 6
0
def create_k_proto():
    lib = moose.Neutral('/library')
    k = moose.HHChannel('/library/k')
    k.Xpower = 4.0
    xGate = moose.HHGate(k.path + '/gateX')
    xGate.setupAlpha(K_n_params + [VDIVS, VMIN, VMAX])
    return k
Exemplo n.º 7
0
def make_LCa( name = 'LCa', parent = '/library' ):
        if moose.exists( parent + '/' + name ):
                return
        Ca = moose.HHChannel( parent + '/' + name )
        Ca.Ek = ECA
        Ca.Gbar = 0
        Ca.Gk = 0
        Ca.Xpower = 2
        Ca.Ypower = 1
        Ca.Zpower = 0

        xgate = moose.element( parent + '/' + name + '/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.alphaParms = xA
        ygate = moose.element( parent + '/' + name + '/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] = 5.0
                yB[i] = 5.0
                x += dx
        ygate.tableA = yA
        ygate.tableB = yB
        return Ca
Exemplo n.º 8
0
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
Exemplo n.º 10
0
def make_K_A(name):
    if moose.exists('/library/' + name):
        return
    K_A = moose.HHChannel('/library/' + name)
    K_A.Ek = EK  #    V
    K_A.Gbar = 50 * SOMA_A  #    S
    K_A.Gk = 0  #    S
    K_A.Xpower = 1
    K_A.Ypower = 1
    K_A.Zpower = 0

    xgate = moose.element(K_A.path + '/gateX')
    xA = np.array([
        20e3 * (0.0131 + EREST_ACT), -20e3, -1.0, -1.0 * (0.0131 + EREST_ACT),
        -0.01, -17.5e3 * (0.0401 + EREST_ACT), 17.5e3, -1.0,
        -1.0 * (0.0401 + EREST_ACT), 0.01, 3000, -0.1, 0.05
    ])
    xgate.alphaParms = xA

    ygate = moose.element(K_A.path + '/gateY')
    yA = np.array([
        1.6, 0.0, 0.0, 0.013 - EREST_ACT, 0.018, 50.0, 0.0, 1.0,
        -1.0 * (0.0101 + EREST_ACT), -0.005, 3000, -0.1, 0.05
    ])
    ygate.alphaParms = yA
Exemplo n.º 11
0
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
Exemplo n.º 12
0
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
Exemplo n.º 13
0
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
Exemplo n.º 14
0
def h_Chan(name):
    h = moose.HHChannel('/library/' + name)
    h.Ek = Eh
    h.Gbar = 300.0 * SOMA_A
    h.Gk = 0.0
    h.Xpower = 1.0
    h.Ypower = 0.0
    h.Zpower = 0.0

    ena = 50e-3
    K = 8.5e-3
    vhalf = -81e-3

    v = np.arange(Vmin, Vmax + dV, dV)
    taun = 1e-3 + v * 0
    taun[v <= -30e-3] = 5e-3 * (1 / (np.exp(
        (v[v <= -30e-3] + 145e-3) / -17.5e-3) + np.exp(
            (v[v <= -30e-3] + 16.8e-3) / 16.5e-3)) + 5)
    ninf = 1 - (1 / (1 + np.exp((vhalf - v) / K)))

    xgate = moose.element(h.path + '/gateX')
    xgate.min = Vmin
    xgate.max = Vmax
    xgate.divs = Vdivs
    xgate.tableA = ninf / taun
    xgate.tableB = 1.0 / taun
    return h
Exemplo n.º 15
0
def KM_Chan(name):
    KM = moose.HHChannel('/library/' + name)
    KM.Ek = EK
    KM.Gbar = 300.0 * SOMA_A
    KM.Gk = 0.0
    KM.Xpower = 1.0
    KM.Ypower = 0.0
    KM.Zpower = 0.0

    vhalfl = -42e-3
    kl = -4e-3
    vhalft = -42e-3
    a0t = 0.04e3
    zetat = 4
    gmt = 0.7
    q10 = 5
    b0 = 60e-3
    celsius = 34

    v = np.arange(Vmin, Vmax + dV, dV)
    alpt = np.exp(0.0378e3 * zetat * (v - vhalft))
    bett = np.exp(0.0378e3 * zetat * gmt * (v - vhalft))

    qt = q10**((celsius - 35) / 10)
    inf = (1.0 / (1 + np.exp((v - vhalfl) / kl)))
    a = alpt
    tau = b0 + bett / (a0t * (1 + a))

    xgate = moose.element(KM.path + '/gateX')
    xgate.min = Vmin
    xgate.max = Vmax
    xgate.divs = Vdivs
    xgate.tableA = inf / tau
    xgate.tableB = 1.0 / tau
    return KM
Exemplo n.º 16
0
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
Exemplo n.º 17
0
def K_DR_Chan(name):
    K_DR = moose.HHChannel('/library/' + name)
    K_DR.Ek = EK
    K_DR.Gbar = 300.0 * SOMA_A
    K_DR.Gk = 0.0
    K_DR.Xpower = 1.0
    K_DR.Ypower = 0.0
    K_DR.Zpower = 0.0

    vhalfn = 13
    a0n = 0.02
    zetan = -3
    gmn = 0.7
    nmax = 2
    q10 = 1
    ntfactor = 1

    qt = q10**((celsius - 24) / 10)
    alpn = np.exp(1.e-3 * zetan * (v * 1e3 - vhalfn) * 9.648e4 /
                  (8.315 * (273.16 + celsius)))
    betn = np.exp(1.e-3 * zetan * gmn * (v * 1e3 - vhalfn) * 9.648e4 /
                  (8.315 * (273.16 + celsius)))
    ninf = 1 / (1 + alpn)
    taun = ntfactor * betn / (qt * a0n * (1 + alpn))
    taun[taun < nmax] = nmax

    xgate = moose.element(K_DR.path + '/gateX')
    xgate.min = Vmin
    xgate.max = Vmax
    xgate.divs = Vdivs
    xgate.tableA = ninf / taun * 1e3
    xgate.tableB = 1 / taun * 1e3
    return K_DR
Exemplo n.º 18
0
def make_HH_K(name='HH_K',
              parent='/library',
              vmin=-120e-3,
              vmax=40e-3,
              vdivs=3000):
    """Create a Hodhkin-Huxley K channel under `parent`.

    vmin, vmax, vdivs: voltage range and number of divisions for gate tables

    """
    k = moose.HHChannel('%s/%s' % (parent, name))
    k.Ek = -77e-3
    k.Xpower = 4
    v = np.linspace(vmin, vmax, vdivs + 1) - EREST_ACT_HH
    n_alpha = per_ms * (10 - v * 1e3) / (100 * (np.exp(
        (10 - v * 1e3) / 10) - 1))
    n_beta = per_ms * 0.125 * np.exp(-v * 1e3 / 80)
    n_gate = moose.element('%s/gateX' % (k.path))
    n_gate.min = vmin
    n_gate.max = vmax
    n_gate.divs = vdivs
    n_gate.tableA = n_alpha
    n_gate.tableB = n_alpha + n_beta
    k.tick = -1
    return k
Exemplo n.º 19
0
def make_Na( name ):
    if moose.exists( '/library/' + name ):
        return
    Na = moose.HHChannel( '/library/' + name )
    Na.Ek = 0.055             #    V
    Na.Gbar = 300 * SOMA_A    #    S
    Na.Gk = 0                 #    S
    Na.Xpower = 2
    Na.Ypower = 1
    Na.Zpower = 0

    xgate = moose.element( Na.path + '/gateX' )
    xA = np.array( [ 320e3 * (0.0131 + EREST_ACT),
        -320e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.004, 
        -280e3 * (0.0401 + EREST_ACT), 280e3, -1.0, 
        -1.0 * (0.0401 + EREST_ACT), 5.0e-3, 
        3000, -0.1, 0.05 ] )
    xgate.alphaParms = xA

    ygate = moose.element( Na.path + '/gateY' )
    yA = np.array( [ 128.0, 0.0, 0.0, -1.0 * (0.017 + EREST_ACT), 0.018,
        4.0e3, 0.0, 1.0, -1.0 * (0.040 + EREST_ACT), -5.0e-3, 
        3000, -0.1, 0.05 ] )
    ygate.alphaParms = yA
    return Na
Exemplo n.º 20
0
def createChanProto(libraryName, channelParams, rateParams):
    # Create a library to store the channel prototypes
    if not moose.exists(libraryName):
        lib = moose.Neutral(libraryName)
    else:
        lib = moose.element(libraryName)

    # Create the channel and set the powers and reversal potential
    channel = moose.HHChannel(lib.path + '/' + channelParams.name)
    channel.Ek = channelParams.Erev
    channel.Xpower = channelParams.Xpow
    channel.Ypower = channelParams.Ypow

    # Define the activation gating kinetics if they exist
    if channel.Xpower > 0:
        xGate = moose.HHGate(channel.path + '/' + 'gateX')
        xGate.setupAlpha(channelParams.Xparam + rateParams)

    # Define the inactivation gating kinetics if they exist
    if channel.Ypower > 0:
        yGate = moose.HHGate(channel.path + '/' + 'gateY')
        yGate.setupAlpha(channelParams.Yparam + rateParams)

    # Set the tick for the channel so that it is set appropriately when it
    # is copied to a channel from the library
    channel.tick = -1

    return channel
Exemplo n.º 21
0
def make_HH_Na(name = 'HH_Na', parent='/library', vmin=-110e-3, vmax=50e-3, vdivs=3000):
    """Create a Hodhkin-Huxley Na channel under `parent`.

    vmin, vmax, vdivs: voltage range and number of divisions for gate tables

    """
    na = moose.HHChannel('%s/%s' % (parent, name))
    na.Ek = 50e-3
    na.Xpower = 3
    na.Ypower = 1
    v = np.linspace(vmin, vmax, vdivs+1) - EREST_ACT_HH
    m_alpha = per_ms * (25 - v * 1e3) / (10 * (np.exp((25 - v * 1e3) / 10) - 1))
    m_beta = per_ms * 4 * np.exp(- v * 1e3/ 18)
    m_gate = moose.element('%s/gateX' % (na.path))
    m_gate.min = vmin
    m_gate.max = vmax
    m_gate.divs = vdivs
    m_gate.tableA = m_alpha
    m_gate.tableB = m_alpha + m_beta
    h_alpha = per_ms * 0.07 * np.exp(-v / 20e-3)
    h_beta = per_ms * 1/(np.exp((30e-3 - v) / 10e-3) + 1)
    h_gate = moose.element('%s/gateY' % (na.path))
    h_gate.min = vmin
    h_gate.max = vmax
    h_gate.divs = vdivs
    h_gate.tableA = h_alpha
    h_gate.tableB = h_alpha + h_beta
    na.tick = -1
    return na
Exemplo n.º 22
0
def setup_single_compartment(container_path, channel_proto, Gbar=1e-9):
    comp = make_testcomp(container_path)
    moose.context.copy(channel_proto.id, comp.id, channel_proto.name)
    channel = moose.HHChannel('%s/%s' % (comp.path, channel_proto.name))
    channel.connect('channel', comp, 'channel')
    channel.Gbar = Gbar
    pulsegen = make_pulsegen(container_path)
    pulsegen.connect('outputSrc', comp, 'injectMsg')
    vm_table = moose.Table('%s/Vm' % (container_path))
    vm_table.connect('inputRequest', comp, 'Vm')
    vm_table.stepMode = 3
    gk_table = moose.Table('%s/Gk' % (container_path))
    gk_table.connect('inputRequest', channel, 'Gk')
    gk_table.stepMode = 3
    moose.context.setClock(0, 1e-5)
    moose.context.setClock(1, 1e-5)
    moose.context.useClock(0, '%s/##[TYPE=Compartment]' % (container_path),
                           'init')
    moose.context.useClock(1, '%s/##' % (container_path), 'process')
    return {
        'compartment': comp,
        'stimulus': pulsegen,
        'channel': channel,
        'Vm': vm_table,
        'Gk': gk_table
    }
def K_D_Chan(name):
    K_D = moose.HHChannel('/library/' + name)
    K_D.Ek = EK
    K_D.Gbar = 300.0 * SOMA_A
    K_D.Gk = 0.0
    K_D.Xpower = 1.0
    K_D.Ypower = 0.0
    K_D.Zpower = 0

    vhalfn = -33
    a0n = 0.005
    zetan = 3
    gmn = 0.7
    nmax = 2
    q10 = 1
    sh = 0
    gkdbar = .01e4

    qt = q10**((celsius - 24) / 10)
    a = np.exp(1.e-3 * zetan * (v * 1e3 - vhalfn - sh) * 9.648e4 /
               (8.315 * (273.16 + celsius)))
    ninf = 1 / (1 + a)
    taun = np.exp(1.e-3 * zetan * gmn * (v * 1e3 - vhalfn - sh) * 9.648e4 /
                  (8.315 * (273.16 + celsius))) / (qt * a0n * (1 + a))
    taun[taun < nmax] = nmax / qt

    xgate = moose.element(K_D.path + '/gateX')
    xgate.min = Vmin
    xgate.max = Vmax
    xgate.divs = Vdivs
    xgate.tableA = ninf / taun * 1e3
    xgate.tableB = 1.0 / taun * 1e3

    return K_D
Exemplo n.º 24
0
def K_Pst_Chan(name):
    K_Pst = moose.HHChannel('/library/' + name)
    K_Pst.Ek = EK
    K_Pst.Gbar = 300.0 * SOMA_A
    K_Pst.Gk = 0.0
    K_Pst.Xpower = 2.0
    K_Pst.Ypower = 1.0
    K_Pst.Zpower = 0.0

    qt = 2.3**((34 - 21) / 10)
    V = v + 0.010
    mInf = (1 / (1 + np.exp(-(V * 1e3 + 1) / 12)))
    VV = V[V < -0.050]
    mTau = (1.25 + 175.03 * np.exp(-VV * 1e3 * -0.026)) / qt
    VV = V[V >= -0.050]
    mTau = np.append(mTau, ((1.25 + 13 * np.exp(-VV * 1e3 * 0.026))) / qt)
    hInf = 1 / (1 + np.exp(-(V * 1e3 + 54) / -11))
    hTau = (360 + (1010 + 24 *
                   (V * 1e3 + 55)) * np.exp(-((V * 1e3 + 75) / 48)**2)) / qt

    xgate = moose.element(K_Pst.path + '/gateX')
    xgate.min = Vmin
    xgate.max = Vmax
    xgate.divs = Vdivs
    xgate.tableA = mInf / mTau * 1e3
    xgate.tableB = 1 / mTau * 1e3

    ygate = moose.element(K_Pst.path + '/gateY')
    ygate.min = Vmin
    ygate.max = Vmax
    ygate.divs = Vdivs
    ygate.tableA = hInf / hTau * 1e3
    ygate.tableB = 1 / hTau * 1e3

    return K_Pst
Exemplo n.º 25
0
def loadGran98NeuroML_L123(filename):
    neuromlR = NeuroML()
    populationDict, projectionDict = \
        neuromlR.readNeuroMLFromFile(filename)
    soma_path = populationDict['Gran'][1][0].path + '/Soma_0'
    somaVm = setupTable('somaVm', moose.Compartment(soma_path), 'Vm')
    somaCa = setupTable('somaCa', moose.CaConc(soma_path + '/Gran_CaPool_98'),
                        'Ca')
    somaIKCa = setupTable('somaIKCa',
                          moose.HHChannel(soma_path + '/Gran_KCa_98'), 'Gk')
    #KDrX = setupTable('ChanX',moose.HHChannel(soma_path+'/Gran_KDr_98'),'X')
    soma = moose.Compartment(soma_path)
    print("Reinit MOOSE ... ")
    resetSim(['/elec', '/cells'], simdt, plotdt,
             simmethod='ee')  # from moose.utils
    print("Running ... ")
    moose.start(runtime)
    tvec = arange(0.0, runtime, plotdt)
    plot(tvec, somaVm.vector[1:])
    title('Soma Vm')
    xlabel('time (s)')
    ylabel('Voltage (V)')
    figure()
    plot(tvec, somaCa.vector[1:])
    title('Soma Ca')
    xlabel('time (s)')
    ylabel('Ca conc (mol/m^3)')
    figure()
    plot(tvec, somaIKCa.vector[1:])
    title('KCa current (A)')
    xlabel('time (s)')
    ylabel('')
    print("Showing plots ...")
    show()
Exemplo n.º 26
0
def K_A_Chan(name):
    K_A = moose.HHChannel('/library/' + name)
    K_A.Ek = EK
    K_A.Gbar = 300.0 * SOMA_A
    K_A.Gk = 0.0
    K_A.Xpower = 1.0
    K_A.Ypower = 1.0
    K_A.Zpower = 0.0

    vhalfn = 11
    vhalfl = -56
    a0l = 0.05
    a0n = 0.05
    zetan = -1.5
    zetal = 3
    gmn = 0.55
    gml = 1
    lmin = 2
    nmin = 0.1
    pw = -1
    tq = -40
    qq = 5
    q10 = 5
    qtl = 1
    ntfactor = 1
    ltfactor = 1

    qt = q10**((celsius - 24) / 10)
    zeta = zetan + pw / (1 + np.exp((v * 1e3 - tq) / qq))
    alpn = np.exp(1.e-3 * zeta * (v * 1e3 - vhalfn) * 9.648e4 /
                  (8.315 * (273.16 + celsius)))
    zeta = zetan + pw / (1 + np.exp((v * 1e3 - tq) / qq))
    betn = np.exp(1.e-3 * zeta * gmn * (v * 1e3 - vhalfn) * 9.648e4 /
                  (8.315 * (273.16 + celsius)))
    ninf = 1 / (1 + alpn)
    taun = ntfactor * betn / (qt * a0n * (1 + alpn))
    taun[taun < nmin] = nmin

    alpl = np.exp(1.e-3 * zetal * (v * 1e3 - vhalfl) * 9.648e4 /
                  (8.315 * (273.16 + celsius)))
    betl = np.exp(1.e-3 * zetal * gml * (v * 1e3 - vhalfl) * 9.648e4 /
                  (8.315 * (273.16 + celsius)))
    linf = 1 / (1 + alpl)
    taul = ltfactor * 0.26 * (v * 1e3 + 50) / qtl
    taul[v < lmin / qtl] = lmin / qtl

    xgate = moose.element(K_A.path + '/gateX')
    xgate.min = Vmin
    xgate.max = Vmax
    xgate.divs = Vdivs
    xgate.tableA = ninf / taun * 1e3
    xgate.tableB = 1.0 / taun * 1e3

    ygate = moose.element(K_A.path + '/gateY')
    ygate.min = Vmin
    ygate.max = Vmax
    ygate.divs = Vdivs
    ygate.tableA = linf / taul * 1e3
    ygate.tableB = 1.0 / taul * 1e3
    return K_A
Exemplo n.º 27
0
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'
Exemplo n.º 28
0
def K_M_Chan(name):
    K_M = moose.HHChannel('/library/' + name)
    K_M.Ek = EK
    K_M.Gbar = 300.0 * SOMA_A
    K_M.Gk = 0.0
    K_M.Xpower = 1.0
    K_M.Ypower = 0.0
    K_M.Zpower = 0.0

    vhalfl = -40
    kl = -10
    vhalft = -42
    a0t = 0.009
    zetat = 7
    gmt = .4
    q10 = 5
    b0 = 60
    st = 1
    tfactor = 1

    alpt = np.exp(0.0378 * zetat * (v * 1e3 - vhalft))
    bett = np.exp(0.0378 * zetat * gmt * (v * 1e3 - vhalft))
    qt = q10**((celsius - 35) / 10)
    inf = (1 / (1 + np.exp((v * 1e3 - vhalfl) / kl)))
    a = alpt
    tau = tfactor * (b0 + bett) / (a0t * (1 + a))

    xgate = moose.element(K_M.path + '/gateX')
    xgate.min = Vmin
    xgate.max = Vmax
    xgate.divs = Vdivs
    xgate.tableA = inf / tau * 1e3
    xgate.tableB = 1.0 / tau * 1e3
    return K_M
Exemplo n.º 29
0
def make_K_A():
    if moose.exists('K_A'):
        return
    K_A = moose.HHChannel('K_A')
    K_A.Ek = EK  #	V
    K_A.Gbar = 50 * SOMA_A  #	S
    K_A.Gk = 0  #	S
    K_A.Xpower = 1
    K_A.Ypower = 1
    K_A.Zpower = 0

    xgate = moose.element('K_A/gateX')
    xA = numpy.array([
        20e3 * (0.0131 + EREST_ACT), -20e3, -1.0, -1.0 * (0.0131 + EREST_ACT),
        -0.01, -17.5e3 * (0.0401 + EREST_ACT), 17.5e3, -1.0,
        -1.0 * (0.0401 + EREST_ACT), 0.01, 3000, -0.1, 0.05
    ])
    xgate.alphaParms = xA
    # xgate.alpha( 20e3 * (0.0131 + EREST_ACT), -20e3, -1.0, -1.0 * (0.0131 + EREST_ACT), -0.01 )
    # xgate.beta( -17.5e3 * (0.0401 + EREST_ACT), 17.5e3, -1.0, -1.0 * (0.0401 + EREST_ACT), 0.01 )

    ygate = moose.element('K_A/gateY')
    yA = numpy.array([
        1.6, 0.0, 0.0, 0.013 - EREST_ACT, 0.018, 50.0, 0.0, 1.0,
        -1.0 * (0.0101 + EREST_ACT), -0.005, 3000, -0.1, 0.05
    ])
    ygate.alphaParms = yA
Exemplo n.º 30
0
def h_Chan(name):
    h = moose.HHChannel('/library/' + name)
    h.Ek = Eh
    h.Gbar = 300.0 * SOMA_A
    h.Gk = 0.0
    h.Xpower = 1.0
    h.Ypower = 0.0
    h.Zpower = 0.0

    vhalfl = -81
    kl = -8
    vhalft = -75
    a0t = 0.011
    zetal = 4
    zetat = 2.2
    gmt = .4
    q10 = 4.5
    qtl = 1
    ltfactor = 1

    alpt = np.exp(0.0378 * zetat * (v * 1e3 - vhalft))
    bett = np.exp(0.0378 * zetat * gmt * (v * 1e3 - vhalft))
    qt = q10**((celsius - 33) / 10)
    a = alpt
    linf = 1 / (1 + np.exp(-(v * 1e3 - vhalfl) / kl))
    taul = ltfactor * bett / (qtl * qt * a0t * (1 + a))

    xgate = moose.element(h.path + '/gateX')
    xgate.min = Vmin
    xgate.max = Vmax
    xgate.divs = Vdivs
    xgate.tableA = linf / taul * 1e3
    xgate.tableB = 1.0 / taul * 1e3
    return h