コード例 #1
0
ファイル: leaky_iaf.py プロジェクト: INCF/old_nineml_repo
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
コード例 #2
0
ファイル: aeIF.py プロジェクト: INCF/old_nineml_repo
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
コード例 #3
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
コード例 #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)
コード例 #5
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
コード例 #6
0
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
コード例 #7
0
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
コード例 #8
0
ファイル: nmda.py プロジェクト: INCF/old_nineml_repo
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
コード例 #9
0
ファイル: hh.py プロジェクト: INCF/old_nineml_repo
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
コード例 #10
0
def get_component():
    coba = al.dynamics.DynamicsClass(
        name="CobaSyn",
        aliases=["I:=g*(vrev-V)", ],
        regimes=[
            al.Regime(
                name="cobadefaultregime",
                time_derivatives=["dg/dt = -g/tau", ],
                transitions=al.On('spikeinput', do=["g=g+q"]),
            )
        ],
        state_variables=[al.StateVariable('g')],
        analog_ports=[al.AnalogReceivePort("V"), al.AnalogSendPort("I"), ],
        parameters=['tau', 'q', 'vrev']
    )
    return coba
コード例 #11
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
コード例 #12
0
def get_component():
    regimes = [
        al.Regime(
            name='defaultregime',
            time_derivatives=[
                "dR/dt = (1-R)/tau_r",  # tau_r is the recovery time constant for depression
                "du/dt = -(u-U)/tau_f",  # tau_f is the time constant of facilitation
            ],
            transition=al.On(
                'spikeoutput',
                do=[
                    "Wout = u*R*Win", "R = R -  u*R", "u = u + U*(1-u)",
                    al.PreEventRelay
                ])  # Should I put a OutputEvent('spikeoutput') here?
        )
    ]

    analog_ports = [al.SendPort("Wout")]

    c1 = al.ComponentClass("MarkramSynapseDynamics",
                           regimes=regimes,
                           analog_ports=analog_ports)
コード例 #13
0
ファイル: if_cond_exp.py プロジェクト: INCF/old_nineml_repo
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
コード例 #14
0
#    filter. Although the current paper used a 40 ms window for the
#    Gaussian filter, this kind of a-priori spike generation will be
#    impossible to address with a state machine design as an
#    online-thing (because future can affect the past). We need to
#    separate the cases where all spikes/inputs are to be generated
#    beforehand and processed during simulation and where teh
#    spikes/inputs can be generated on-line during simulation.

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,
コード例 #15
0
Spike timing-dependent plasticity is affected by the interplay of
intrinsic and network oscillations. J. Physiol. 104 91--98


Author: Abigail Morrison, 1/2011.

"""
import nineml.abstraction_layer as nineml

# 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(
コード例 #16
0
ファイル: addSTDPid7.py プロジェクト: INCF/old_nineml_repo
Author: Abigail Morrison, 1/2011.

"""

import nineml.abstraction_layer as nineml

# note: this assumes that Pre/PostEvent are the arrival times of the event
# at the synapse, i.e. after application of axonal or back-propagation delays
regimes = [
    nineml.Regime(
        "dr/dt = -r/tau_plus",
        "do/dt = -o/tau_minus",
        "deps_r/dt = (1-eps_r)/tau_er",
        "deps_o/dt = (1-eps_o)/tau_eo",
        transitions=[nineml.On(nineml.PreEvent,
                               do=["W -= A_minus * eps_r * o,
                                   "W = max(W,W_min)",
                                   "r += eps_r",
                                   "eps_r = 0.0",
                                   nineml.PreEventRelay]),
                     nineml.On(nineml.PostEvent,
                               do=["W  += A_plus*eps_o*r",
                                   "W = max(W,W_max)",
                                   "o += eps_o",
                                   "eps_o = 0.0"])]
    )]
ports = [nineml.SendPort("W")]

c1 = nineml.Component("addSTDPid7", regimes=regimes, ports=ports)

# write to file object f if defined
コード例 #17
0
# A model which generates a fixed sequence of spikes
# Here we use a pre-generated poisson process as an example.

# define a poisson spike-train
rate = 10  # events per time unit
length = 1.0  # one time unit
isi = numpy.random.exponential(1.0 / rate, size=(rate * length * 2,))
# spike times
t = numpy.add.accumulate(isi)
spike_times = t[t < length]

regimes = []
events = []
for i, t_spike in enumerate(spike_times):
        events += [nineml.On("t>%f" % t_spike, do=nineml.SpikeOutputEvent)]

spiker = nineml.Regime(transitions=events)

c1 = nineml.Component("Spike Generator", regimes=[spiker])

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

    base = "spike_generator"
    c1.write(base + ".xml")
    c2 = nineml.parse(base + ".xml")
コード例 #18
0
ファイル: RmulSTDPid7.py プロジェクト: INCF/old_nineml_repo
Author: Abigail Morrison, 1/2011.

"""

import nineml.abstraction_layer as nineml

# note: this assumes that Pre/PostEvent are the arrival times of the event
# at the synapse, i.e. after application of axonal or back-propagation delays
regimes = [
    nineml.Regime(
        "dr/dt = -r/tau_plus",
        "do/dt = -o/tau_minus",
        "deps_r/dt = (1-eps_r)/tau_er",
        "deps_o/dt = (1-eps_o)/tau_eo",
        transitions=[nineml.On(nineml.PreEvent,
                               do=["W -= R * A_minus * eps_r * o * (W - Wmin) / (Wmax - Wmin),
                                   "W = max(W,W_min)",
                                   "r += eps_r",
                                   "eps_r = 0.0",
                                   nineml.PreEventRelay]),
                     nineml.On(nineml.PostEvent,
                               do=["W  += R*A_plus*eps_o*r*(Wmax-W)/(Wmax-Wmin)",
                                   "W = max(W,W_max)",
                                   "o += eps_o",
                                   "eps_o = 0.0"])]
    )]
ports = [nineml.RecvPort("R"), nineml.SendPort("W")]

c1 = nineml.Component("RmulSTDPid7", regimes=regimes, ports=ports)

# write to file object f if defined
コード例 #19
0
Author: Eilif Muller, 2010.

"""

import nineml.abstraction_layer as nineml

regimes = [
    nineml.Regime("dr1/dt = -r1/tau_plus",
                  "dr2/dt = -r2/tau_x",
                  "do1/dt = -o1/tau_minus",
                  "do2/dt = -o2/tau_y",
                  transitions=[
                      nineml.On(nineml.PreEvent,
                                do=[
                                    "W  -= o1*(A2_minus + A3_minus*r2)",
                                    "r1 += 1.0", "r2 += 1.0",
                                    nineml.EventPort("PreEventRelay",
                                                     mode="send")
                                ]),
                      nineml.On(nineml.PostEvent,
                                do=[
                                    "W  += r1*(A2_plus + A3_plus*o2)",
                                    "o1 += 1.0", "o2 += 1.0"
                                ])
                  ])
]

ports = [nineml.SendPort("W")]

c1 = nineml.Component("PfisterTripletSTDP", regimes=regimes, ports=ports)
コード例 #20
0
ファイル: LPNid8.py プロジェクト: INCF/old_nineml_repo
Implements linear poisson neuron as described in eq. 5 of:

R. Guetig, R. Aharonov, S. Rotter, and Haim Sompolinsky (2003),
Learning Input Correlations through Nonlinear Temporally Asymmetric
Hebbian Plasticity, J. Neuroscience, 23(9) 3697--3714


Author: Abigail Morrison, 1/2011.

"""

import nineml.abstraction_layer as nineml

regimes = [
    nineml.Regime(transitions=nineml.On(nineml.SpikeInputEvent,
                                        do=nineml.SpikeOutputEvent),
                  name="ongoing-regime")
]

linear_poiss = nineml.Component("LPNid8", regimes=regimes, ports=[])

inter_event_regime = nineml.Regime(transitions=nineml.On(
    nineml.SpikeInputEvent,
    do=["pfire = W/N", "p = rand()"],
    to="probabilistic_regime"),
                                   name="inter_event_regime")

probabilistic_regime = nineml.Regime(transitions=[
    nineml.On("pfire >= p",
              do=nineml.SpikeInputEventRelay,
              to=inter_event_regime),
コード例 #21
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']))
コード例 #22
0
A. Morrison, A. Aertsen, M. Diesmann, "Spike-Timing-Dependent Plasticity in Balanced Random Networks", Neural Computation 2007.


Author: Eilif Muller, 2012.

"""

import nineml.abstraction_layer as nineml

regimes = [
    nineml.Regime("dr/dt = -r1/tau_plus",
                  "do/dt = -o1/tau_minus",
                  transitions=[
                      nineml.On(nineml.PreEvent,
                                do=[
                                    "W  -= lambda*alpha*W*o", "r += 1.0",
                                    nineml.EventPort("PreEventRelay",
                                                     mode="send")
                                ]),
                      nineml.On(
                          nineml.PostEvent,
                          do=["W  += (lambda*w0*(weight/w0)^mu*r", "o += 1.0"])
                  ])
]

ports = [nineml.SendPort("W")]

c1 = nineml.Component("MorrisonPowerlawSTDP", regimes=regimes, ports=ports)

# write to file object f if defined
try:
    # This case is used in the test suite for examples.
コード例 #23
0
ファイル: gLIFid8.py プロジェクト: INCF/old_nineml_repo
as decribed on p 3699 of:

R. Guetig, R. Aharonov, S. Rotter, and Haim Sompolinsky (2003),
Learning Input Correlations through Nonlinear Temporally Asymmetric
Hebbian Plasticity, J. Neuroscience, 23(9) 3697--3714


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"),
コード例 #24
0
Hebbian Plasticity, J. Neuroscience, 23(9) 3697--3714

Author: Abigail Morrison, 1/2011.
"""

import nineml.abstraction_layer as nineml

# note: this assumes that Pre/PostEvent are the arrival times of the event
# at the synapse, i.e. after application of axonal or back-propagation delays
regimes = [
    nineml.Regime("dr/dt = -r/tau_plus",
                  "do/dt = -o/tau_minus",
                  transitions=[
                      nineml.On(nineml.PreEvent,
                                do=[
                                    "W = W - o*learning_rate*alpha*W",
                                    "r = r + 1.0", nineml.PreEventRelay
                                ]),
                      nineml.On(
                          nineml.PostEvent,
                          do=["W = W + r*learning_rate*(1-W)", "o = o + 1.0"])
                  ],
                  name="basic regime")
]
# should there be an additional parameter to scale the weight?
ports = [nineml.SendPort("W")]

STDPid8 = nineml.Component("STDP_id8", regimes=regimes, ports=ports)

#"W = W - o*learning_rate*alpha*W**mu",
#"W = max(W,0.0)",
コード例 #25
0
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")
コード例 #26
0
ファイル: poisson.py プロジェクト: INCF/old_nineml_repo
"""

"""

import nineml.abstraction_layer as al
from nineml.abstraction_layer.units import time, per_time

model = al.DynamicsClass(
    name="Poisson",
    regimes=[
        al.Regime(name="default",
                  transitions=al.On(
                      "t > t_next",
                      do=[
                          "t_next = t + random.exponential(1000/rate)",
                          al.OutputEvent('spikeOutput')
                      ]))
    ],
    event_ports=[al.EventSendPort('spikeOutput')],
    state_variables=[al.StateVariable('t_next', dimension=time)],
    parameters=[
        al.Parameter('rate', dimension=per_time),
    ])

if __name__ == "__main__":
    from nineml.abstraction_layer.dynamics.writers import XMLWriter
    filename = __file__[0].upper() + __file__[1:].replace(".py", ".xml")
    XMLWriter.write(model, filename)
コード例 #27
0
Author: Abigail Morrison, 1/2011.

"""

import nineml.abstraction_layer as nineml

# note: this assumes that Pre/PostEvent are the arrival times of the event
# at the synapse, i.e. after application of axonal or back-propagation delays
regimes = [
    nineml.Regime("dr/dt = -r/tau_plus",
                  "do/dt = -o/tau_minus",
                  transitions=[
                      nineml.On(nineml.PreEvent,
                                do=[
                                    "W  -= o*learning_rate*alpha*W**mu",
                                    "W = max(W,0.0)", "r += 1.0",
                                    nineml.PreEventRelay
                                ]),
                      nineml.On(nineml.PostEvent,
                                do=[
                                    "W  += r*learning_rate*(1-W)**mu",
                                    "W = min(W,1.0)", "o += 1.0"
                                ])
                  ])
]
# should there be an additional parameter to scale the weight?
ports = [nineml.SendPort("W")]

c1 = nineml.Component("STDP_id8", regimes=regimes, ports=ports)

# write to file object f if defined
コード例 #28
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")]
)
コード例 #29
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=[
コード例 #30
0
ファイル: STDPid1.py プロジェクト: INCF/old_nineml_repo
development. Neural Network, 23 517-527


Author: Abigail Morrison, 1/2011.

"""

import nineml.abstraction_layer as nineml

# note: this assumes that Pre/PostEvent are the arrival times of the event
# at the synapse, i.e. after application of axonal or back-propagation delays
regimes = [
    nineml.Regime(
        "dr/dt = -r/tau_plus",
        "do/dt = -o/tau_minus",
        transitions=[nineml.On(nineml.PreEvent,
                               do=["W -= W_max * A_minus * o,
                                   "W = max(W,0.0)",
                                   "r += 1.0",
                                   nineml.PreEventRelay]),
                     nineml.On(nineml.PostEvent,
                               do=["W  += W_max*A_plus*r",
                                   "W = min(W,W_max)",
                                   "o += 1.0"])]
    )]
ports = [nineml.SendPort("W")]

c1 = nineml.Component("STDPid1", regimes=regimes, ports=ports)

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