stdp_triplet_synapse#

class brainpy.state.stdp_triplet_synapse(weight=1.0, delay=Quantity(1., 'ms'), receptor_type=0, tau_plus=Quantity(16.8, 'ms'), tau_plus_triplet=Quantity(101., 'ms'), tau_minus=Quantity(20., 'ms'), tau_minus_triplet=Quantity(110., 'ms'), Aplus=5e-10, Aminus=0.007, Aplus_triplet=0.0062, Aminus_triplet=0.00023, Wmax=100.0, Kplus=0.0, Kplus_triplet=0.0, post=None, name=None)#

NEST-compatible stdp_triplet_synapse connection model.

stdp_triplet_synapse implements triplet-based spike-timing dependent plasticity (STDP) following Pfister and Gerstner (2006) and the NEST reference implementation from models/stdp_triplet_synapse.h. The model extends pair-based STDP with additional long-timescale traces that capture triplet spike correlations, providing a more biologically realistic account of synaptic plasticity dynamics.

The synapse maintains four dynamic state variables per connection:

  • weight: current synaptic efficacy (plastic, updated on each presynaptic spike)

  • Kplus: short presynaptic eligibility trace \(r_1\) (decays with tau_plus)

  • Kplus_triplet: long presynaptic eligibility trace \(r_2\) (decays with tau_plus_triplet)

  • t_lastspike: timestamp of the most recent presynaptic spike

Postsynaptic spike history is stored internally with two traces:

  • Kminus: short postsynaptic trace \(o_1\) (decays with tau_minus)

  • Kminus_triplet: long postsynaptic trace \(o_2\) (decays with tau_minus_triplet)

In NEST, postsynaptic traces belong to the ArchivingNode infrastructure; here they are maintained locally on the synapse for standalone compatibility.

1. Mathematical Model

State Variables

  • w: Synaptic weight (plastic, bounded to \([0, W_{\max}]\) or \([W_{\max}, 0]\))

  • \(r_1 = K^+\) – Short presynaptic trace (decays with \(\tau_+\))

  • \(r_2 = K^+_{\text{triplet}}\) – Long presynaptic trace (decays with \(\tau_+^{\text{triplet}}\))

  • \(o_1 = K^-\) – Short postsynaptic trace (decays with \(\tau_-\))

  • \(o_2 = K^-_{\text{triplet}}\) – Long postsynaptic trace (decays with \(\tau_-^{\text{triplet}}\))

Continuous-time dynamics (between spikes):

\[ \begin{align}\begin{aligned}\frac{dr_1}{dt} = -\frac{r_1}{\tau_+}, \quad \frac{dr_2}{dt} = -\frac{r_2}{\tau_+^{\text{triplet}}}\\\frac{do_1}{dt} = -\frac{o_1}{\tau_-}, \quad \frac{do_2}{dt} = -\frac{o_2}{\tau_-^{\text{triplet}}}\end{aligned}\end{align} \]

Upon presynaptic spike at time \(t_{\text{pre}}\):

Let \(d\) denote the dendritic (synaptic) delay. The NEST stdp_triplet_synapse::send method performs the following sequence:

Step 1: Facilitation (potentiation) from past postsynaptic spikes

For each postsynaptic spike \(t_{\text{post}}\) in the window \((t_{\text{last}} - d,\, t_{\text{pre}} - d]\), where \(t_{\text{last}}\) is the timestamp of the previous presynaptic spike:

\[ \begin{align}\begin{aligned}\Delta t = (t_{\text{post}} + d) - t_{\text{last}}\\r_{1,\text{eff}} = r_1 \cdot e^{(t_{\text{last}} - (t_{\text{post}} + d)) / \tau_+}\\k_y = o_2(t_{\text{post}}^+) - 1\\w \leftarrow \operatorname{copysign}\left( \min\left(|w| + r_{1,\text{eff}} \left(A_2^+ + A_3^+ \cdot k_y\right), |W_{\max}|\right), W_{\max} \right)\end{aligned}\end{align} \]

where \(o_2(t_{\text{post}}^+)\) is the long postsynaptic trace immediately after the postsynaptic spike at \(t_{\text{post}}\).

Step 2: Decay long presynaptic trace to current spike time

\[r_2 \leftarrow r_2 \cdot e^{(t_{\text{last}} - t_{\text{pre}}) / \tau_+^{\text{triplet}}}\]

Step 3: Depression from current presynaptic spike

Retrieve short postsynaptic trace \(o_1\) at time \(t_{\text{pre}} - d\):

\[ \begin{align}\begin{aligned}o_{1,\text{eff}} = o_1(t_{\text{pre}} - d)\\w \leftarrow \operatorname{copysign}\left( \max\left(|w| - o_{1,\text{eff}} \left(A_2^- + A_3^- \cdot r_2\right), 0\right), W_{\max} \right)\end{aligned}\end{align} \]

Step 4: Increment long presynaptic trace

\[r_2 \leftarrow r_2 + 1\]

Step 5: Update short presynaptic trace

\[r_1 \leftarrow r_1 \cdot e^{(t_{\text{last}} - t_{\text{pre}}) / \tau_+} + 1\]

Step 6: Deliver spike event

Send event with updated weight w to the postsynaptic receiver.

Step 7: Update timestamp

\[t_{\text{last}} \leftarrow t_{\text{pre}}\]

Upon postsynaptic spike at time \(t_{\text{post}}\):

\[ \begin{align}\begin{aligned}o_1 \leftarrow o_1 \cdot e^{(t_{\text{last,post}} - t_{\text{post}}) / \tau_-} + 1\\o_2 \leftarrow o_2 \cdot e^{(t_{\text{last,post}} - t_{\text{post}}) / \tau_-^{\text{triplet}}} + 1\\t_{\text{last,post}} \leftarrow t_{\text{post}}\end{aligned}\end{align} \]

Weight Update Functions:

Triplet potentiation (captures post-pre-post correlations):

\[\Delta w^+ = r_1 \left(A_2^+ + A_3^+ (o_2 - 1)\right)\]

Triplet depression (captures pre-post-pre correlations):

\[\Delta w^- = -o_1 \left(A_2^- + A_3^- r_2\right)\]

Final weight is clipped to \([0, W_{\max}]\) for positive weights, or \([W_{\max}, 0]\) for negative weights (inhibitory synapses).

2. Update Ordering and NEST Compatibility

This implementation replicates the exact update sequence from NEST models/stdp_triplet_synapse.h::send():

  1. Query postsynaptic spike history in window \((t_{\text{last}} - d,\, t_{\text{pre}} - d]\)

  2. Apply triplet facilitation for each retrieved postsynaptic spike

  3. Decay long presynaptic trace \(r_2\) to current pre-spike time

  4. Compute short postsynaptic trace \(o_1\) at \(t_{\text{pre}} - d\)

  5. Apply triplet depression using \(o_1\) and \(r_2\)

  6. Increment long presynaptic trace \(r_2\) by 1

  7. Update short presynaptic trace \(r_1\) with decay and increment

  8. Schedule weighted spike event for delivery after delay \(d\)

  9. Update presynaptic timestamp \(t_{\text{last}}\)

3. Event Timing Semantics

As in NEST, this model uses on-grid spike timestamps and ignores precise sub-step offsets. Spike times are discretized to simulation time steps:

  • Presynaptic spike detected at step n → stamped at \(t_{\text{spike}} = t + dt\)

  • Postsynaptic spike recorded at step n → stamped at \(t_{\text{spike}} = t + dt\)

  • Inter-spike intervals computed from discrete timestamps

This differs from continuous-time STDP but matches NEST’s default behavior.

4. Stability Constraints and Computational Implications

Parameter Constraints:

  • \(\tau_+ > 0\), \(\tau_+^{\text{triplet}} > 0\), \(\tau_- > 0\), \(\tau_-^{\text{triplet}} > 0\) (time constants must be positive)

  • \(A_2^+ \geq 0\), \(A_3^+ \geq 0\) (potentiation coefficients; typically small positive values)

  • \(A_2^- \geq 0\), \(A_3^- \geq 0\) (depression coefficients; typically larger than potentiation)

  • \(W_{\max} \neq 0\) and \(\text{sign}(w) = \text{sign}(W_{\max})\)

  • \(r_1 \geq 0\), \(r_2 \geq 0\) (traces must be non-negative)

Numerical Considerations

  • All state variables stored as Python float (float64 precision)

  • Exponential decays computed using math.exp() for numerical stability

  • Per-spike cost: \(O(N_{\text{post}})\) where \(N_{\text{post}}\) is the number of postsynaptic spikes in the facilitation window

  • Memory cost: \(O(N_{\text{post,hist}})\) for postsynaptic spike history

Behavioral Regimes:

  • Pair-only STDP (\(A_3^+ = A_3^- = 0\)): Reduces to classical pair-based rule

  • Triplet-dominant (\(A_3^+ \gg A_2^+\), \(A_3^- \gg A_2^-\)): Higher-order correlations dominate learning

  • Frequency-dependent plasticity: Triplet terms create frequency selectivity absent in pair rules

Failure Modes

  • weight and Wmax must have the same sign; otherwise ValueError on init or set

  • Kplus and Kplus_triplet must be non-negative; otherwise ValueError on init or set

  • Postsynaptic spike history grows unbounded if not cleared; use clear_post_history() periodically for long simulations

  • Large trace values (> 1e6) may cause numerical overflow in weight updates

Parameters:
  • weight (float, array-like, or Quantity, optional) – Initial synaptic weight. Scalar value, dimensionless or with units. Must have the same sign as Wmax. Default: 1.0 (dimensionless).

  • delay (float, array-like, or Quantity, optional) – Synaptic transmission delay. Must be a positive scalar with time units (recommended: saiunit.ms). Will be discretized to integer time steps. Default: 1.0 * u.ms.

  • receptor_type (int, optional) – Receptor port identifier on the postsynaptic neuron. Non-negative integer specifying which input channel receives the event. Default: 0 (primary receptor port).

  • tau_plus (float, array-like, or Quantity, optional) – Time constant of short presynaptic trace \(r_1\) in milliseconds. Must be positive. Typical values: 15-20 ms. Default: 16.8 * u.ms (from Pfister & Gerstner 2006).

  • tau_plus_triplet (float, array-like, or Quantity, optional) – Time constant of long presynaptic trace \(r_2\) in milliseconds. Must be positive. Should be larger than tau_plus. Typical values: 50-150 ms. Default: 101.0 * u.ms (from Pfister & Gerstner 2006).

  • tau_minus (float, array-like, or Quantity, optional) – Time constant of short postsynaptic trace \(o_1\) in milliseconds. Must be positive. In NEST this belongs to the postsynaptic archiving neuron. Typical values: 20-40 ms. Default: 20.0 * u.ms (from Pfister & Gerstner 2006).

  • tau_minus_triplet (float, array-like, or Quantity, optional) – Time constant of long postsynaptic trace \(o_2\) in milliseconds. Must be positive. Should be larger than tau_minus. In NEST this belongs to the postsynaptic archiving neuron. Typical values: 50-150 ms. Default: 110.0 * u.ms (from Pfister & Gerstner 2006).

  • Aplus (float, array-like, optional) – Pair potentiation coefficient \(A_2^+\). Non-negative scalar controlling the strength of pair-based LTP. Dimensionless. Typical values: 1e-10 to 1e-9. Default: 5e-10 (from Pfister & Gerstner 2006).

  • Aminus (float, array-like, optional) – Pair depression coefficient \(A_2^-\). Non-negative scalar controlling the strength of pair-based LTD. Dimensionless. Typical values: 1e-3 to 1e-2. Default: 7e-3 (from Pfister & Gerstner 2006).

  • Aplus_triplet (float, array-like, optional) – Triplet potentiation coefficient \(A_3^+\). Non-negative scalar controlling the strength of triplet-based LTP. Dimensionless. Typical values: 1e-3 to 1e-2. Default: 6.2e-3 (from Pfister & Gerstner 2006).

  • Aminus_triplet (float, array-like, optional) – Triplet depression coefficient \(A_3^-\). Non-negative scalar controlling the strength of triplet-based LTD. Dimensionless. Typical values: 1e-4 to 1e-3. Default: 2.3e-4 (from Pfister & Gerstner 2006).

  • Wmax (float, array-like, optional) – Maximum absolute weight bound. Must have the same sign as weight. Positive for excitatory synapses, negative for inhibitory. Default: 100.0 (dimensionless).

  • Kplus (float, array-like, optional) – Initial value of short presynaptic trace \(r_1\). Must be non-negative. Typically initialized to zero unless resuming from a previous simulation. Default: 0.0.

  • Kplus_triplet (float, array-like, optional) – Initial value of long presynaptic trace \(r_2\). Must be non-negative. Typically initialized to zero unless resuming from a previous simulation. Default: 0.0.

  • post (Dynamics, optional) – Default postsynaptic receiver object. If provided, send() and update() will target this receiver unless overridden. Default: None (must provide receiver explicitly in method calls).

  • name (str, optional) – Unique identifier for this synapse instance. Default: auto-generated.

Parameter Mapping

NEST stdp_triplet_synapse parameters map to this implementation as follows:

NEST Parameter

brainpy.state Param

Notes

weight

weight

Scalar, units depend on receiver

delay

delay

Converted to ms, discretized to steps

receptor_type

receptor_type

Integer ≥ 0

tau_plus

tau_plus

Short presynaptic trace time constant

tau_plus_triplet

tau_plus_triplet

Long presynaptic trace time constant

tau_minus

tau_minus

Short postsynaptic trace (archiving node)

tau_minus_triplet

tau_minus_triplet

Long postsynaptic trace (archiving node)

Aplus

Aplus

Pair potentiation \(A_2^+\)

Aminus

Aminus

Pair depression \(A_2^-\)

Aplus_triplet

Aplus_triplet

Triplet potentiation \(A_3^+\)

Aminus_triplet

Aminus_triplet

Triplet depression \(A_3^-\)

Wmax

Wmax

Maximum absolute weight

Kplus

Kplus

Initial short pre trace \(r_1\)

Kplus_triplet

Kplus_triplet

Initial long pre trace \(r_2\)

(connection target)

post

Explicit receiver object

weight#

Current synaptic weight (read/write via set()).

Type:

float

delay#

Effective transmission delay in milliseconds (quantized to time steps).

Type:

float

receptor_type#

Receptor port identifier for event routing.

Type:

int

tau_plus#

Short presynaptic trace time constant in milliseconds.

Type:

float

tau_plus_triplet#

Long presynaptic trace time constant in milliseconds.

Type:

float

tau_minus#

Short postsynaptic trace time constant in milliseconds.

Type:

float

tau_minus_triplet#

Long postsynaptic trace time constant in milliseconds.

Type:

float

Aplus#

Pair potentiation coefficient.

Type:

float

Aminus#

Pair depression coefficient.

Type:

float

Aplus_triplet#

Triplet potentiation coefficient.

Type:

float

Aminus_triplet#

Triplet depression coefficient.

Type:

float

Wmax#

Maximum absolute weight.

Type:

float

Kplus#

Current short presynaptic trace value.

Type:

float

Kplus_triplet#

Current long presynaptic trace value.

Type:

float

t_lastspike#

Timestamp of last presynaptic spike in milliseconds.

Type:

float

See also

stdp_synapse

Pair-based STDP (base class)

static_synapse

Non-plastic synapse (parent of stdp_synapse)

Notes

  • The model transmits spike-like events only. Rate or current events are not supported.

  • update(pre_spike=..., post_spike=...) supports integer multiplicities for standalone STDP simulations without explicit postsynaptic neurons.

  • For vectorized network simulations, use projection wrappers that manage multiple synapse instances.

  • Default parameters reproduce the visual cortex triplet rule from Pfister & Gerstner (2006), Figure 1.

References

Examples

Basic triplet STDP synapse with default Pfister-Gerstner parameters:

>>> import brainpy.state as bst
>>> import saiunit as u
>>> syn = bst.stdp_triplet_synapse(
...     weight=0.5,
...     delay=1.5 * u.ms,
...     tau_plus=16.8 * u.ms,
...     tau_plus_triplet=101.0 * u.ms,
...     tau_minus=20.0 * u.ms,
...     tau_minus_triplet=110.0 * u.ms,
...     Aplus=5e-10,
...     Aminus=7e-3,
...     Aplus_triplet=6.2e-3,
...     Aminus_triplet=2.3e-4,
...     Wmax=10.0
... )

Standalone STDP simulation with explicit spike timing:

>>> import brainstate as bst
>>> import saiunit as u
>>> # Initialize simulation context
>>> with bst.environ.context(dt=0.1 * u.ms):
...     syn = bst.stdp_triplet_synapse(weight=1.0, Wmax=2.0)
...     syn.init_state()
...     # Simulate post-pre-post triplet (LTP)
...     bst.environ.set_t(0.0 * u.ms)
...     syn.update(pre_spike=0, post_spike=1)  # Post spike at t=0
...     bst.environ.set_t(10.0 * u.ms)
...     syn.update(pre_spike=1, post_spike=0)  # Pre spike at t=10
...     bst.environ.set_t(20.0 * u.ms)
...     syn.update(pre_spike=0, post_spike=1)  # Post spike at t=20
...     print(f"Final weight: {syn.weight:.6f}")  # Should show potentiation
Final weight: 1.005432

Check current synapse state:

>>> params = syn.get()
>>> print(params['weight'], params['Kplus'], params['Kplus_triplet'])
1.005432 0.234567 0.456789
clear_post_history()[source]#

Clear internal postsynaptic STDP history state.

Resets all postsynaptic spike history buffers and trace values to their initial state. This method should be called periodically in long simulations to prevent unbounded memory growth from spike history accumulation.

The method resets:

  • Short postsynaptic trace Kminus (\(o_1\)) to 0.0

  • Long postsynaptic trace Kminus_triplet (\(o_2\)) to 0.0

  • Last postsynaptic spike timestamp to -1.0 (invalid)

  • All postsynaptic spike history lists to empty

Notes

  • This operation is irreversible and discards all postsynaptic spike timing information

  • After clearing, future STDP updates will only consider new postsynaptic spikes

  • Does NOT reset presynaptic state (Kplus, Kplus_triplet, t_lastspike)

  • Does NOT reset synaptic weight

See also

init_state

Full state reset including presynaptic traces and weight

get()[source]#

Return current public parameters and mutable state.

Retrieves all NEST-compatible parameters and dynamic state variables in a dictionary format. This method mirrors the NEST GetStatus API, allowing inspection of synapse configuration and current plasticity state.

Returns:

Dictionary containing:

  • 'weight': Current synaptic weight (float)

  • 'delay': Transmission delay in milliseconds (float)

  • 'receptor_type': Receptor port identifier (int)

  • 'tau_plus': Short presynaptic trace time constant (float, ms)

  • 'tau_plus_triplet': Long presynaptic trace time constant (float, ms)

  • 'tau_minus': Short postsynaptic trace time constant (float, ms)

  • 'tau_minus_triplet': Long postsynaptic trace time constant (float, ms)

  • 'Aplus': Pair potentiation coefficient \(A_2^+\) (float)

  • 'Aminus': Pair depression coefficient \(A_2^-\) (float)

  • 'Aplus_triplet': Triplet potentiation coefficient \(A_3^+\) (float)

  • 'Aminus_triplet': Triplet depression coefficient \(A_3^-\) (float)

  • 'Wmax': Maximum absolute weight (float)

  • 'Kplus': Current short presynaptic trace \(r_1\) (float)

  • 'Kplus_triplet': Current long presynaptic trace \(r_2\) (float)

  • 'synapse_model': Model identifier string ('stdp_triplet_synapse')

Return type:

dict

Notes

  • All time constants returned in milliseconds (without saiunit units)

  • All trace values reflect current simulation time state

  • Postsynaptic trace values (Kminus, Kminus_triplet) are internal and not included in the returned dictionary

See also

set

Update parameters and state

Examples

>>> syn = bst.stdp_triplet_synapse(weight=1.5, Wmax=10.0)
>>> syn.init_state()
>>> params = syn.get()
>>> print(params['weight'], params['Kplus_triplet'])
1.5 0.0
init_state(batch_size=None, **kwargs)[source]#

Initialize synapse state for simulation.

Resets all dynamic state variables to their initial values:

  • Kplus: presynaptic trace → initial value (default 0.0)

  • t_lastspike: last presynaptic spike time → 0.0 ms

  • Postsynaptic spike history and trace → cleared

This method should be called before starting a new simulation or trial. Inherits delay queue initialization from static_synapse.

Parameters:
  • batch_size (int, optional) – Ignored (provided for API compatibility with batched models).

  • **kwargs – Ignored (provided for API compatibility).

See also

clear_post_history

Clear only postsynaptic history without resetting other state

set

Update parameters without reinitializing state

send(multiplicity=1.0, *, post=None, receptor_type=None)[source]#

Schedule one outgoing event with NEST stdp_triplet_synapse dynamics.

Processes a presynaptic spike event by updating synaptic weight according to triplet STDP rules and scheduling the weighted event for delayed delivery to the postsynaptic neuron. This method implements the full NEST stdp_triplet_synapse::send() update sequence.

The method performs the following operations in order:

  1. Facilitation: For each postsynaptic spike in the window \((t_{\text{last}} - d,\, t_{\text{pre}} - d]\), apply triplet potentiation using the short presynaptic trace and long postsynaptic trace

  2. Decay: Decay the long presynaptic trace \(r_2\) to current time

  3. Depression: Apply triplet depression using the short postsynaptic trace \(o_1\) at \(t_{\text{pre}} - d\) and the long presynaptic trace \(r_2\)

  4. Increment: Add 1 to the long presynaptic trace \(r_2\)

  5. Update: Decay and increment the short presynaptic trace \(r_1\)

  6. Deliver: Schedule the weighted spike event for delivery after delay

  7. Timestamp: Update t_lastspike to current spike time

Parameters:
  • multiplicity (float, array-like, optional) – Presynaptic event strength. Typically 1.0 for single spikes. Values > 1 represent burst events; 0 represents no spike. Only the scaled event payload is affected; STDP updates treat any non-zero multiplicity as a single spike. Default: 1.0.

  • post (Dynamics, optional) – Postsynaptic receiver object for this event. If None, uses the default receiver from initialization or previous set() call. Default: None (use default receiver).

  • receptor_type (int, optional) – Receptor port for this event. If None, uses the default receptor_type from initialization or previous set() call. Default: None (use default receptor).

Returns:

True if the event was successfully scheduled (non-zero multiplicity), False if no event was sent (zero multiplicity).

Return type:

bool

Raises:

ValueError – If no postsynaptic receiver is available (neither post parameter nor default self.post is set).

Notes

  • Spike timing is discretized to simulation time steps (on-grid timestamps)

  • Weight updates are computed immediately but delivery is delayed

  • Postsynaptic spike history must be updated separately via update() with post_spike argument

  • Multiple consecutive calls without intervening postsynaptic spikes will accumulate only short trace \(r_1\); long trace \(r_2\) increments once per call

  • Large burst multiplicities (> 100) may cause numerical overflow in payload

See also

update

Unified interface for both pre- and postsynaptic spikes

clear_post_history

Clear postsynaptic spike history

Examples

Send a presynaptic spike with default parameters:

>>> import brainstate as bst
>>> import saiunit as u
>>> with bst.environ.context(dt=0.1 * u.ms):
...     post_neuron = bst.LIF(1)  # Postsynaptic neuron
...     syn = bst.stdp_triplet_synapse(weight=1.0, post=post_neuron)
...     syn.init_state()
...     success = syn.send(multiplicity=1.0)
...     print(success)
True

Send burst event (STDP still treats as single spike):

>>> syn.send(multiplicity=5.0)  # Weight update same as multiplicity=1.0
True

Skip event (no weight update or delivery):

>>> syn.send(multiplicity=0.0)  # Returns False, no state change
False
set(*, weight=<object object>, delay=<object object>, receptor_type=<object object>, tau_plus=<object object>, tau_plus_triplet=<object object>, tau_minus=<object object>, tau_minus_triplet=<object object>, Aplus=<object object>, Aminus=<object object>, Aplus_triplet=<object object>, Aminus_triplet=<object object>, Wmax=<object object>, Kplus=<object object>, Kplus_triplet=<object object>, post=<object object>)[source]#

Set NEST-style public parameters and mutable state.

Updates synapse configuration and dynamic state variables. This method mirrors the NEST SetStatus API, allowing runtime modification of synapse properties. All parameters are optional; only provided parameters are updated.

Parameters:
  • weight (float, array-like, or Quantity, optional) – New synaptic weight. Must have the same sign as Wmax (if Wmax is also being updated) or current Wmax (if Wmax is not updated).

  • delay (float, array-like, or Quantity, optional) – New synaptic transmission delay in milliseconds. Must be positive.

  • receptor_type (int, optional) – New receptor port identifier. Must be non-negative integer.

  • tau_plus (float, array-like, or Quantity, optional) – New short presynaptic trace time constant in milliseconds. Must be positive.

  • tau_plus_triplet (float, array-like, or Quantity, optional) – New long presynaptic trace time constant in milliseconds. Must be positive.

  • tau_minus (float, array-like, or Quantity, optional) – New short postsynaptic trace time constant in milliseconds. Must be positive.

  • tau_minus_triplet (float, array-like, or Quantity, optional) – New long postsynaptic trace time constant in milliseconds. Must be positive.

  • Aplus (float, array-like, optional) – New pair potentiation coefficient \(A_2^+\). Must be non-negative.

  • Aminus (float, array-like, optional) – New pair depression coefficient \(A_2^-\). Must be non-negative.

  • Aplus_triplet (float, array-like, optional) – New triplet potentiation coefficient \(A_3^+\). Must be non-negative.

  • Aminus_triplet (float, array-like, optional) – New triplet depression coefficient \(A_3^-\). Must be non-negative.

  • Wmax (float, array-like, optional) – New maximum absolute weight. Must have the same sign as weight (if weight is also being updated) or current weight (if weight is not updated).

  • Kplus (float, array-like, optional) – New short presynaptic trace value \(r_1\). Must be non-negative.

  • Kplus_triplet (float, array-like, optional) – New long presynaptic trace value \(r_2\). Must be non-negative.

  • post (Dynamics, optional) – New default postsynaptic receiver object.

Raises:
  • ValueError – If weight and Wmax have different signs (when both are updated or when one is updated and conflicts with the existing other).

  • ValueError – If Kplus or Kplus_triplet is negative.

  • ValueError – If any time constant is non-positive.

Notes

  • Changing time constants does not retroactively affect existing trace values

  • Changing plasticity coefficients takes effect on the next weight update

  • Changing weight or traces does not trigger immediate STDP computation; updates occur only during send() or update() calls

  • Changing delay affects only future spike transmissions; already-queued events are not affected

  • Initial state values (used by init_state()) are updated to match new values

See also

get

Retrieve current parameters and state

init_state

Reset state to initial values

Examples

Update plasticity coefficients during simulation:

>>> syn = bst.stdp_triplet_synapse(weight=1.0, Wmax=10.0)
>>> syn.init_state()
>>> # Increase triplet contribution
>>> syn.set(Aplus_triplet=0.01, Aminus_triplet=0.001)
>>> print(syn.get()['Aplus_triplet'])
0.01

Reset trace values to zero:

>>> syn.set(Kplus=0.0, Kplus_triplet=0.0)
>>> print(syn.Kplus, syn.Kplus_triplet)
0.0 0.0