Пример #1
0
def get_component():
    inter_event_regime = al.Regime(
        name="intereventregime",
        time_derivatives=["dA/dt = -A/taur", "dB/dt = -B/taud"],
        transitions=[
            al.On('spikeinput',
                  do=["A = A + weight*factor", "B = B + weight*factor"])
        ])

    dynamicsblock = al.DynamicsBlock(
        aliases=[
            "taupeak := taur*taud/(taud - taur)*log(taud/taur)",
            "factor := 1/(exp(-taupeak/taud) - exp(-taupeak/taur))",
            "gB := 1/(1 + mgconc*exp(-1*gamma*V)/beta)",
            "g := gB*gmax*(B-A)",
            "I := g * df",
            "df := (E-V)",
        ],
        state_variables=[al.StateVariable(o) for o in ('A', 'B')],
        regimes=[inter_event_regime],
    )

    nmda = al.ComponentClass(name="NMDAPSR",
                             dynamicsblock=dynamicsblock,
                             analog_ports=[
                                 al.RecvPort("V"),
                                 al.SendPort("I"),
                             ],
                             event_ports=[al.RecvEventPort('spikeinput')],
                             parameters=[
                                 'taur', 'taud', 'gmax', 'mgconc', 'gamma',
                                 'beta', 'E', 'weight'
                             ])

    return nmda
Пример #2
0
import nineml.abstraction_layer as al

cond_decay = al.Regime(name='default',
                       time_derivatives=["dg/dt = -g/tau"],
                       transitions=[al.On(al.InputEvent('spikeinput'), do="g = g + q")]
                       )


coba_syn = al.ComponentClass(
    name="CoBaSynapse",
    dynamics=al.DynamicsBlock(
        regimes=[cond_decay],
        aliases=["I := g*(E-V)"],
    ),
    analog_ports=[al.RecvPort("V"), al.SendPort("I")]
)
Пример #3
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']))
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")