rate_connection_instantaneous#

class brainpy.state.rate_connection_instantaneous(*args, **kwargs)#

NEST-compatible rate_connection_instantaneous connection spec.

Carries the NEST-facing parameters and status of an instantaneous (zero-delay) rate connection: a scalar weight plus the delay-rejection semantics that distinguish this model from rate_connection_delayed. It mirrors NEST’s GetStatus / SetStatus surface (weight, a read-only delay compatibility field, has_delay, supports_wfr) so that connection parameters round-trip identically to the C++ model.

The instantaneous rate coupling itself is realized by the Simulator’s continuous-rate (seam-(H)) emission path: a presynaptic rate neuron emits its graded rate each step, the connection deposits weight · rate into the postsynaptic neuron’s delta input channel, and the post reads it via sum_delta_inputs. The one-step pipeline lag of that path is exactly NEST’s use_wfr=False instantaneous fixed-point seed — so this spec object only needs to carry the parameters, not route the signal.

Unlike rate_connection_delayed, this model enforces zero delay and rejects any attempt to configure a delay parameter.

Parameters:
  • weight (float or array-like, optional) – Connection gain/strength applied to transmitted rate signals. Must be scalar. Default: 1.0.

  • name (str or None, optional) – Optional name identifier for this connection instance. Default: None.

weight#

Connection gain (validated scalar).

Type:

float

delay#

Compatibility field, always 1. Exposed in get_status for NEST API parity but ignored by transmission logic. Cannot be modified.

Type:

int

name#

Instance name.

Type:

str or None

HAS_DELAY#

Class attribute, always False (this model enforces zero delay).

Type:

bool

SUPPORTS_WFR#

Class attribute, always True (NEST advertises waveform-relaxation support for instantaneous connections).

Type:

bool

Parameter Mapping

The following table maps NEST parameters to this implementation:

NEST Parameter

brainpy.state

Notes

weight

weight

Connection gain (scalar float)

delay

delay

Read-only, always 1 (compatibility)

has_delay

HAS_DELAY

Always False (class attribute)

supports_wfr

SUPPORTS_WFR

Always True (class attribute)

Mathematical Description

An instantaneous connection transmits a rate signal \(r_\text{pre}\) to the postsynaptic neuron without delay, applying only the connection weight \(w\):

\[r_\text{post}(t) = w \cdot r_\text{pre}(t)\]

On the JAX substrate this is delivered with a single-step pipeline lag — the presynaptic rate captured at step \(k\) is deposited into the postsynaptic input at step \(k+1\). That lag is the discrete-time counterpart of NEST’s instantaneous (use_wfr=False) coupling and seeds the same network fixed point \(r^* = (I - gW)^{-1}\mu\) for a linear rate network.

Implementation Notes

Delay Restriction

This model enforces zero delay for all transmissions. Any attempt to set a delay via set_delay(), set_delay_steps(), or set_status(delay=...) raises a ValueError with the message:

"rate_connection_instantaneous has no delay. Please use rate_connection_delayed."

The delay attribute is exposed in get_status() for NEST API compatibility (always returns 1), but this value is ignored by the transmission logic and cannot be modified.

Unit Handling

All parameters accept brainunit.Quantity objects or plain numeric values. If a Quantity is provided, its mantissa is extracted. Internally, values are stored as dimensionless floats.

Compatibility with NEST

  • NEST stores connection properties in synapse objects and enforces delay restrictions at runtime. This implementation replicates that behavior by raising errors when delay modification is attempted.

  • The supports_wfr flag is set to True, matching NEST’s advertisement that instantaneous connections participate in its waveform-relaxation solver.

Raises:
  • ValueError – If weight is not scalar.

  • ValueError – If any method attempts to set delay or delay_steps.

See also

rate_connection_delayed

Delayed rate connection model (NEST equivalent)

rate_neuron_ipn

Input rate neuron (instantaneous rate receiver)

rate_neuron_opn

Output rate neuron (instantaneous rate receiver)

References

Examples

Basic Usage

Create an instantaneous connection with weight 2.0 and inspect its status:

>>> from brainpy import state as bst
>>> conn = bst.rate_connection_instantaneous(weight=2.0)
>>> conn.get_status()
{'weight': 2.0, 'delay': 1, 'has_delay': False, 'supports_wfr': True}

Dynamic Weight Updates

Update the connection weight at runtime:

>>> conn.set_weight(1.5)
>>> conn.get('weight')
1.5
>>> conn.set_status(weight=3.0)
>>> conn.get('weight')
3.0

Delay Restriction Enforcement

Attempting to set a delay raises an error:

>>> conn.set_delay(3)
Traceback (most recent call last):
    ...
ValueError: rate_connection_instantaneous has no delay. Please use rate_connection_delayed.

Using with Rate Neurons

Typical usage in a rate-based network — the Simulator wires the seam-(H) rate path from the connection’s parameters:

>>> import brainunit as u
>>> from brainpy import state as bst
>>> sim = bst.Simulator(dt=0.1 * u.ms)
>>> pre = sim.create(bst.lin_rate_ipn, 10, params=dict(tau=10.0 * u.ms))
>>> post = sim.create(bst.lin_rate_ipn, 5, params=dict(tau=10.0 * u.ms))
>>> proj = sim.connect(pre, post, weight=0.8, comm='dense')
get(key='status')[source]#

Retrieve a specific parameter or full status dictionary.

Parameters:

key (str, optional) – Parameter name to retrieve. Special value 'status' returns full status dictionary. Supported keys: 'status', 'weight', 'delay', 'has_delay', 'supports_wfr'. Default: 'status'.

Returns:

If key == 'status', returns full status dictionary. Otherwise, returns the requested parameter value.

Return type:

dict or scalar

Raises:

KeyError – If key is not a recognized parameter name.

Examples

>>> conn = rate_connection_instantaneous(weight=2.0)
>>> conn.get('weight')
2.0
>>> conn.get('has_delay')
False
>>> conn.get('status')
{'weight': 2.0, 'delay': 1, 'has_delay': False, 'supports_wfr': True}
get_status()[source]#

Retrieve all connection parameters as a dictionary.

Follows NEST’s GetStatus API convention.

Returns:

Dictionary with keys:

  • 'weight' (float): Connection gain.

  • 'delay' (int): Always 1 (compatibility field, read-only).

  • 'has_delay' (bool): Always False.

  • 'supports_wfr' (bool): Always True.

Return type:

dict

Examples

>>> conn = rate_connection_instantaneous(weight=1.5)
>>> status = conn.get_status()
>>> status['weight']
1.5
>>> status['delay']
1
>>> status['has_delay']
False
property properties#

Return connection model properties.

Returns:

Dictionary with keys:

  • 'has_delay' (bool): Always False for this model.

  • 'supports_wfr' (bool): Always True (waveform relaxation supported).

Return type:

dict

set_delay(_)[source]#

Reject delay modification (instantaneous model has no delay).

This method always raises a ValueError to enforce NEST semantics.

Parameters:

_ (any) – Ignored. Delay cannot be set for instantaneous connections.

Raises:

ValueError – Always raised with NEST-matching error message.

Examples

>>> conn = rate_connection_instantaneous()
>>> conn.set_delay(5)
Traceback (most recent call last):
    ...
ValueError: rate_connection_instantaneous has no delay. Please use rate_connection_delayed.
set_delay_steps(_)[source]#

Reject delay_steps modification (instantaneous model has no delay).

This method always raises a ValueError to enforce NEST semantics.

Parameters:

_ (any) – Ignored. Delay cannot be set for instantaneous connections.

Raises:

ValueError – Always raised with NEST-matching error message.

Examples

>>> conn = rate_connection_instantaneous()
>>> conn.set_delay_steps(3)
Traceback (most recent call last):
    ...
ValueError: rate_connection_instantaneous has no delay. Please use rate_connection_delayed.
set_status(status=None, **kwargs)[source]#

Update connection parameters from a dictionary or keyword arguments.

Follows NEST’s SetStatus API convention. Only allows updating weight. Any attempt to set delay or delay_steps raises a ValueError.

Parameters:
  • status (dict or None, optional) – Dictionary of parameters to update. Only 'weight' is allowed.

  • **kwargs – Alternative parameter specification as keyword arguments. Merged with status (keyword args take precedence).

Raises:
  • ValueError – If delay or delay_steps is present in updates (with NEST-matching error message).

  • ValueError – If weight fails validation (non-scalar).

Examples

>>> conn = rate_connection_instantaneous(weight=1.0)
>>> conn.set_status({'weight': 2.5})
>>> conn.get('weight')
2.5
>>> conn.set_status(weight=3.0)  # Keyword argument style
>>> conn.get('weight')
3.0

Delay updates are rejected:

>>> conn.set_status(delay=3)
Traceback (most recent call last):
    ...
ValueError: rate_connection_instantaneous has no delay. Please use rate_connection_delayed.
set_weight(weight)[source]#

Update the connection weight.

Parameters:

weight (float or array-like) – New connection gain. Must be scalar. Accepts brainunit.Quantity (mantissa will be extracted).

Raises:

ValueError – If weight is not scalar.

Examples

>>> conn = rate_connection_instantaneous()
>>> conn.set_weight(2.5)
>>> conn.get('weight')
2.5