stdp_nn_restr_synapse#
- class brainpy.state.stdp_nn_restr_synapse(*args, **kwargs)#
Restricted symmetric nearest-neighbour STDP synapse spec (NEST
stdp_nn_restr_synapse).Like
stdp_nn_symm_synapse, bothK+andK-run in the substrate’s'nearest'mode (reset-to-1 on spike); the difference is a one-pair-per-spike restriction carried by two per-edge eligibility flags:pre_avail— a pre has occurred since the previous post (a post may facilitate),post_avail— a post has occurred since the previous pre (a pre may depress).
On a post spike, potentiation fires only if
pre_avail(then the pre is consumed); on a pre spike, depression fires only ifpost_avail(then the post is consumed). A spike sets its own side available and clears the opposite. The weight maps are the same asstdp_synapse:\[ \begin{align}\begin{aligned}\hat w \leftarrow \hat w + \lambda (1-\hat w)^{\mu_+} K^+ \quad\text{(post spike, if } \mathtt{pre\_avail})\\\hat w \leftarrow \hat w - \alpha \lambda \hat w^{\mu_-} K^- \quad\text{(pre spike, if } \mathtt{post\_avail})\end{aligned}\end{align} \]with \(\hat w = w/W_{\max}\), clamped to \([0, W_{\max}]\). The gathered trace excludes the current step’s own spike (
K+ = pre_trace - pre_spike,K- = post_trace - post_spike), which recovers the second-latest partner on an exactly-coinciding step (stdp_nn_restr_synapse.h:62-66). The restriction makes restr diverge from symm whenever several spikes of one side fall between two of the other: symm pairs every one, restr only the first.- Parameters:
weight (
ArrayLikeorQuantity, optional) – Per-edge weight (pA; bare numbers are pA). Same sign asWmax. Default1.0pA.delay (
Quantity, optional) – Homogeneous axonal delay (> 0). Default1.0 ms.receptor_type (
int, optional) – Postsynaptic receptor port (>= 0). Default0.tau_plus (
Quantity, optional) – PresynapticK+trace constant (> 0). Default20.0 ms.tau_minus (
Quantity, optional) – PostsynapticK-trace constant (> 0). Default20.0 ms.lambda (
float, optional) – Learning rate \(\lambda\). Default0.01.alpha (
float, optional) – Depression asymmetry \(\alpha\). Default1.0.mu_plus (
float, optional) – Potentiation/depression exponents (0additive,1multiplicative soft-bound). Default1.0.mu_minus (
float, optional) – Potentiation/depression exponents (0additive,1multiplicative soft-bound). Default1.0.Wmax (
float, optional) – Weight bound (same sign asweight). Default100.0.
Notes
NEST divergence — ``tau_minus`` location. In NEST
tau_minusis a parameter of the postsynaptic neuron (ArchivingNode), not the synapse; here it is a synapse-spec attribute driving the substrate’s per-postK-trace.Phantom-pre-at-0 (shared with symm). NEST’s first send (
t_lastspike_=0) facilitates a post preceding the first pre against a virtual pre att=0; the substrate’spre_availflag starts at 0, so that post is simply not eligible — the physically correct nearest behaviour. Parity is asserted where this is absent/below tolerance.The eager substrate applies potentiation at post-spike steps and depression at pre-spike steps; NEST defers both to the next
send. The cumulative op set is identical at every send, so the trajectories coincide where theweight_recordersamples (pre-spike steps).Parity note. The exact nearest-neighbour pairing convention, the NEST source citation, and the single-pair regression test are documented in STDP parity: where state lives and how spikes pair (stdp_nn_restr_synapse — restricted symmetric nearest-neighbour).
References
Examples
>>> import brainunit as u >>> from brainpy.state import stdp_nn_restr_synapse >>> s = stdp_nn_restr_synapse(weight=1.0, tau_plus=20.0 * u.ms) >>> s.pre_trace_mode, s.post_trace_mode ('nearest', 'nearest') >>> s.edge_state_init() {'pre_avail': 0.0, 'post_avail': 0.0}