Esempio n. 1
0
def get_component():
    subthreshold_regime = al.Regime(
        name="subthreshold_regime",
        time_derivatives=[
            "dV/dt = (g_L*(E_L-V) + g_sfa*(E_sfa-V) + g_rr*(E_rr-V) + Isyn)/C",
            "dg_sfa/dt = -g_sfa/tau_sfa",
            "dg_rr/dt = -g_rr/tau_rr",
        ],
        transitions=al.On("V> theta",
                          do=["g_sfa =g_sfa +  q_sfa", "g_rr =g_rr + q_rr", "t_spike = t",
                              al.OutputEvent('spikeoutput')],
                          to="refractory_regime"),
    )

    refractory_regime = al.Regime(
        name="refractory_regime",
        transitions=al.On("t >= t_spike + t_ref",
                          to='subthreshold_regime'),
    )

    analog_ports = [al.SendPort("V"),
                    al.ReducePort("Isyn", reduce_op="+")]

    c1 = al.ComponentClass("iaf_sfa_relref",
                           regimes=[subthreshold_regime, refractory_regime],
                           analog_ports=analog_ports,
                           )

    return c1
Esempio n. 2
0
def get_component():

    parameters = [
        'C_m', 'g_L', 'E_L', 'Delta', 'V_T', 'S', 'tau_ref', 'tau_w', 'a', 'b'
    ]

    aeIF = al.ComponentClass(
        "aeIF",
        regimes=[
            al.Regime(
                name="subthresholdregime",
                time_derivatives=[
                    "dV/dt = -g_L*(V-E_L)/C_m + g_L*Delta*exp((V-V_T)/Delta-w/S)/C_m+ Isyn/C_m",
                    "dw/dt = (a*(V-E_L)-w)/tau_w",
                ],
                transitions=al.On(
                    "V > V_T",
                    do=["V = E_L", "w = w + b",
                        al.OutputEvent('spikeoutput')],
                    to="refractoryregime"),
            ),
            al.Regime(
                name="refractoryregime",
                transitions=al.On("t>=tspike+trefractory",
                                  to="subthresholdregime"),
            )
        ],
        analog_ports=[al.ReducePort("Isyn", reduce_op="+")])

    return aeIF
Esempio n. 3
0
def get_component():
    subthreshold_regime = al.Regime(
        name="subthreshold_regime",
        time_derivatives=[
            "dV/dt = (-gL*(V-vL) + Isyn)/C",
        ],
        transitions=[
            al.On("V> theta",
                  do=[
                      "t_spike = t", "V = V_reset",
                      al.OutputEvent('spikeoutput')
                  ],
                  to="refractory_regime")
        ],
    )

    refractory_regime = al.Regime(
        transitions=[al.On("t >= t_spike + t_ref", to='subthreshold_regime')],
        name="refractory_regime")

    analog_ports = [al.SendPort("V"), al.ReducePort("Isyn", reduce_op="+")]

    c1 = al.ComponentClass("LeakyIAF",
                           regimes=[subthreshold_regime, refractory_regime],
                           analog_ports=analog_ports)

    return c1
Esempio n. 4
0
def get_component():
# Leaky iaf
    regimes = [
        al.Regime(
            "dV/dt = (-gL*(V-vL) + Isyn)/C",
            transitions=al.On(
                "V>Vth", do=["tspike = t", "V = V_reset", al.OutputEvent('spikeoutput')], to="refractory-regime"),
            name="sub-threshold-regime"
        ),
        al.Regime(
            transitions=al.On("t >= tspike + trefractory", to="sub-threshold-regime"),
            name="refractory-regime"
        )]

    analog_ports = [al.SendPort("V"),
                    al.ReducePort("Isyn", reduce_op="+")]

    leaky_iaf = al.ComponentClass("LeakyIAF", regimes=regimes, analog_ports=analog_ports)

# ampa

    regimes = [
        al.Regime(
            "dg/dt = -g/tau",
            transitions=al.On(al.SpikeInputEvent, do="g+=q")
        )]

    analog_ports = [al.RecvPort("V"),
                    al.SendPort("Isyn = g(E-V)")]

    coba_syn = al.ComponentClass("CoBaSynapse", regimes=regimes, analog_ports=analog_ports)
def get_aeIF_component():
    """
    Adaptive exponential integrate-and-fire neuron as described in
    A. Destexhe, J COmput Neurosci 27: 493--506 (2009)

    Author B. Kriener (Jan 2011)

    ## neuron model: aeIF

    ## variables:
    ## V: membrane potential
    ## w: adaptation variable

    ## parameters:
    ## C_m     # specific membrane capacitance [muF/cm**2]
    ## g_L     # leak conductance [mS/cm**2]
    ## E_L     # resting potential [mV]
    ## Delta   # steepness of exponential approach to threshold [mV]
    ## V_T     # spike threshold [mV]
    ## S       # membrane area [mum**2]
    ## trefractory # refractory time [ms]
    ## tspike  # spike time [ms]
    ## tau_w   # adaptation time constant
    ## a, b    # adaptation parameters [muS, nA]
    """
    parameters = [
        'C_m', 'g_L', 'E_L', 'Delta', 'V_T', 'S', 'trefractory', 'tspike',
        'tau_w', 'a', 'b'
    ]

    aeIF = al.ComponentClass(
        "aeIF",
        regimes=[
            al.Regime(
                name="subthresholdregime",
                time_derivatives=[
                    "dV/dt = -g_L*(V-E_L)/C_m + Isyn/C_m + g_L*Delta*exp((V-V_T)/Delta-w/S)/C_m",
                    "dw/dt = (a*(V-E_L)-w)/tau_w",
                ],
                transitions=al.On(
                    "V > V_T",
                    do=["V = E_L", "w = w + b",
                        al.OutputEvent('spikeoutput')],
                    to="refractoryregime"),
            ),
            al.Regime(
                name="refractoryregime",
                transitions=al.On("t>=tspike+trefractory",
                                  to="subthresholdregime"),
            )
        ],
        analog_ports=[al.ReducePort("Isyn", reduce_op="+")])

    return aeIF
Esempio n. 6
0
def get_component():
    aliases = [
        "q10 := 3.0**((celsius - 6.3)/10.0)",  # temperature correction factor
        "alpha_m := -0.1*(V+40.0)/(exp(-(V+40.0)/10.0) - 1.0)",  # m
        "beta_m := 4.0*exp(-(V+65.0)/18.0)",
        "mtau := 1/(q10*(alpha_m + beta_m))",
        "minf := alpha_m/(alpha_m + beta_m)",
        "alpha_h := 0.07*exp(-(V+65.0)/20.0)",  # h
        "beta_h := 1.0/(exp(-(V+35)/10.0) + 1.0)",
        "htau := 1.0/(q10*(alpha_h + beta_h))",
        "hinf := alpha_h/(alpha_h + beta_h)",
        "alpha_n := -0.01*(V+55.0)/(exp(-(V+55.0)/10.0) - 1.0)",  # n
        "beta_n := 0.125*exp(-(V+65.0)/80.0)",
        "ntau := 1.0/(q10*(alpha_n + beta_n))",
        "ninf := alpha_n/(alpha_n + beta_n)",
        "gna := gnabar*m*m*m*h",  #
        "gk := gkbar*n*n*n*n",
        "ina := gna*(ena - V)",  # currents
        "ik := gk*(ek - V)",
        "il := gl*(el - V )"
    ]

    hh_regime = al.Regime("dn/dt = (ninf-n)/ntau",
                          "dm/dt = (minf-m)/mtau",
                          "dh/dt = (hinf-h)/htau",
                          "dV/dt = (ina + ik + il + Isyn)/C",
                          transitions=al.On("V > theta",
                                            do=al.SpikeOutputEvent()))

    # the rest are not "parameters" but aliases, assigned vars, state vars,
    # indep vars, analog_analog_ports, etc.
    parameters = [
        'el',
        'C',
        'ek',
        'ena',
        'gkbar',
        'gnabar',
        'theta',
        'gl',
        'celsius',
    ]

    analog_ports = [al.SendPort("V"), al.ReducePort("Isyn", reduce_op="+")]

    c1 = al.ComponentClass("HodgkinHuxley",
                           parameters=parameters,
                           regimes=(hh_regime, ),
                           aliases=aliases,
                           analog_ports=analog_ports)
    return c1
Esempio n. 7
0
def get_component():
    regimes = [
        al.Regime(
            name="subthreshold_regime",
            time_derivatives=[
                "dV/dt = 0.04*V*V + 5*V + 140.0 - U + Isyn",
                "dU/dt = a*(b*V - U)"
            ],
            transitions=[
                al.On("V > theta",
                      do=["V = c", "U = U + d",
                          al.OutputEvent('spikeoutput')])
            ],
        )
    ]

    analog_ports = [al.SendPort("V"), al.ReducePort("Isyn", reduce_op="+")]

    c1 = al.ComponentClass("Izhikevich",
                           regimes=regimes,
                           analog_ports=analog_ports)
    return c1
Esempio n. 8
0
# there may be a better way of doing this. this also does not clamp the individual v_i to
# v_reset durung the refractory period, it just doesn't sum over them.

regimes = [
    nineml.Regime("dv/dt = Isyn",
                  transitions=nineml.On(
                      "V>Vth",
                      do=["tspike = t", "V = Vrest", nineml.SpikeOutputEvent],
                      to=refractory - regime),
                  name="sub-threshold-regime"),
    nineml.Regime(transitions=nineml.On("t >= tspike + trefractory",
                                        to="sub-threshold-regime"),
                  name="refractory-regime")
]

ports = [nineml.ReducePort("Isyn", op="+")]

leaky_iaf = nineml.Component("deltaLIFid5", regimes=regimes, ports=ports)

# delta jump synapses

regimes = [
    nineml.Regime(
        "dv/dt = -g*v",
        transitions=nineml.On(nineml.SpikeInputEvent, do="g+=W"),
    )
]

ports = [nineml.RecvPort("W"), nineml.SendPort("Isyn = dv/dt")]

# can i even send dv/dt as a variable?
Esempio n. 9
0

Author: Abigail Morrison, 1/2011.

"""
import nineml.abstraction_layer as nineml

regimes = [
    nineml.Regime("dV/dt = (Vrest - V)/(Rm*Cm) + Isyn/Cm",
                  transitions=nineml.On(
                      "V>Vth",
                      do=["tspike = t", "V = Vrest", nineml.SpikeOutputEvent]),
                  name="sub-threshold-regime")
]

ports = [nineml.SendPort("V"), nineml.ReducePort("Isyn", op="+")]

leaky_iaf = nineml.Component("gLIFid8", regimes=regimes, ports=ports)

# alpha conductances

regimes = [
    nineml.Regime(
        "dg_a/dt = -g_a/tau_a",
        "dg/dt = g_a - g/tau_a",
        transitions=nineml.On(nineml.SpikeInputEvent, do="g+=W"),
    )
]

ports = [
    nineml.RecvPort("V"),
Esempio n. 10
0
hh_regime = al.Regime(
    "dn/dt = (ninf(V)-n)/ntau(V)",
    "dm/dt = (minf(V)-m)/mtau(V)",
    "dh/dt = (hinf(V)-h)/htau(V)",
    "dV/dt = (ina(m,h,V) + ik(n,V) + il(V) + Isyn - I)/C",
    # I is a current injected as a function of orientation
    name="hh_regime",
    transitions=al.On("V > theta", do=[al.SpikeOutputEvent]))

parameters = [
    'el', 'C', 'ek', 'ena', 'gkbar', 'gnabar', 'theta', 'gl', 'celsius'
]

ports = [
    al.SendPort("V"),
    al.ReducePort("Isyn", op="+"),
    al.ReducePort("I", op="+"),
    # "op" keyword argument determines how multiple inputs to this port are handled ?
]
c1 = al.Component("Hodgkin-Huxley-id14",
                  parameters=parameters,
                  regimes=(hh_regime, ),
                  aliases=aliases,
                  ports=ports)

# write to file object f if defined
try:
    # This case is used in the test suite for examples.
    c1.write(f)
except NameError: