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
Exemple #2
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
Exemple #3
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
Exemple #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_Izh_component():
    subthreshold_regime = 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('spike'),
                  ],
                  to='subthreshold_regime')
        ])

    ports = [
        al.AnalogSendPort("V"),
        al.AnalogReducePort("Isyn", reduce_op="+")
    ]

    c1 = al.DynamicsClass(name="Izhikevich",
                          regimes=[subthreshold_regime],
                          analog_ports=ports)
    return c1
Exemple #6
0
def get_component():
    iaf = al.dynamics.DynamicsClass(
        name="iaf",
        regimes=[
            al.Regime(
                name="subthresholdregime",
                time_derivatives=["dV/dt = ( gl*( vrest - V ) + ISyn)/(cm)"],
                transitions=al.On("V > vthresh",
                                  do=[
                                      "tspike = t", "V = vreset",
                                      al.OutputEvent('spikeoutput')
                                  ],
                                  to="refractoryregime"),
            ),
            al.Regime(
                name="refractoryregime",
                time_derivatives=["dV/dt = 0"],
                transitions=[
                    al.On("t >= tspike + taurefrac", to="subthresholdregime")
                ],
            )
        ],
        state_variables=[
            al.StateVariable('V'),
            al.StateVariable('tspike'),
        ],
        analog_ports=[
            al.AnalogSendPort("V"),
            al.AnalogReducePort("ISyn", reduce_op="+"),
        ],
        event_ports=[
            al.EventSendPort('spikeoutput'),
        ],
        parameters=['cm', 'taurefrac', 'gl', 'vreset', 'vrest', 'vthresh'])
    return iaf
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
Exemple #8
0
def get_component():
    regimes = [
        al.Regime(
            name="sub_threshold_regime",
            time_derivatives=[
                "dV/dt = (v_rest - V)/tau_m + (gE*(e_rev_E - V) + gI*(e_rev_I - V) + i_offset)/cm",
                "dgE/dt = -gE/tau_syn_E",
                "dgI/dt = -gI/tau_syn_I",
            ],
            transitions=(
                al.On("V > v_thresh",
                      do=[
                          "t_spike = t", "V = v_reset",
                          al.OutputEvent('spikeoutput')
                      ],
                      to="refractory_regime"),
                al.On('excitatory', do="gE=gE+q"),
                al.On('inhibitory', do="gI=gI+q"),
            ),
        ),
        al.Regime(
            name="refractory_regime",
            time_derivatives=[
                "dgE/dt = -gE/tau_syn_E",
                "dgI/dt = -gI/tau_syn_I",
            ],
            transitions=(
                al.On("t >= t_spike + tau_refrac", to="sub_threshold_regime"),
                al.On('excitatoryspike', do="gE=gE+q"),
                al.On('inhibitoryspike', do="gI=gI+q"),
            ),
        )
    ]

    analog_ports = [
        al.SendPort("V"),
        al.SendPort("gE"),
        al.SendPort("gI"),
        al.RecvPort("q")
    ]

    c1 = al.ComponentClass("IF_cond_exp",
                           regimes=regimes,
                           analog_ports=analog_ports)
    return c1
Exemple #9
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
Exemple #10
0
import nineml.abstraction_layer as al

# Define a single regime, and specify the differential equations,
# and a transition when we reach spiking threshold:
regime = al.Regime(
    name='defaultregime',
    time_derivatives=[
        'dV/dt = 0.04*V*V + 5*V + 140 -U + I', 'dU/dt = a*(b*V - U)'
    ],
    transitions=[
        al.On('V > a',
              do=['V = c', 'U = U + d ',
                  al.OutputEvent('spikeoutput')])
    ])

# Create the ComponentClass, including the dynamics.
iz = al.ComponentClass(name="IzikevichNeuron",
                       parameters=['a', 'b', 'c', 'd'],
                       analog_ports=[
                           al.AnalogPort('I', mode='recv'),
                           al.AnalogPort('V', mode='send')
                       ],
                       event_ports=[al.EventPort('spikeoutput', mode='send')],
                       dynamicsblock=al.DynamicsBlock(
                           regimes=[regime], state_variables=['V', 'U']))
Exemple #11
0
"""

import nineml.abstraction_layer as al
from nineml.abstraction_layer.units import voltage, time, resistance, current

model = al.DynamicsClass(
    name="BrunelIaF",
    regimes=[
        al.Regime(
            name="subthresholdRegime",
            time_derivatives=["dV/dt = (-V + R*Isyn)/tau"],
            transitions=al.On("V > theta",
                              do=[
                                  "t_rpend = t + tau_rp", "V = Vreset",
                                  al.OutputEvent('spikeOutput')
                              ],
                              to="refractoryRegime"),
        ),
        al.Regime(
            name="refractoryRegime",
            time_derivatives=["dV/dt = 0"],
            transitions=[
                al.On(
                    "t > t_rpend",
                    #do=[al.OutputEvent('refractoryEnd')],
                    to="subthresholdRegime")
            ],
        )
    ],
    state_variables=[
import nineml.abstraction_layer as al
r1 = al.Regime(
    name="sub-threshold-regime",
    time_derivatives=["dV/dt = (-gL*(V-vL) + I)/C", ],
    transitions=[al.On("V>Vth",
                       do=["tspike = t",
                           "V = V_reset",
                           al.OutputEvent('spike')],
                 to="refractory-regime"), ],
)

r2 = al.Regime(name="refractory-regime",
               transitions=[al.On("t >= tspike + trefractory",
                                  to="sub-threshold-regime"), ],
               )

leaky_iaf = al.ComponentClass("LeakyIAF",
                              dynamicsblock=al.DynamicsBlock(
                              regimes=[r1, r2],
                              state_variables=['V', 'tspike'],

                              ),
                              analog_ports=[al.AnalogPort("I", mode='recv')],
                              parameters=['C', 'V_reset', 'Vth', 'gL', 't', 'trefractory', 'vL'],
                              )


leaky_iaf.write("leaky_iaf.xml")