rate_connection_instantaneous#
- class brainpy.state.rate_connection_instantaneous(*args, **kwargs)#
NEST-compatible
rate_connection_instantaneousconnection spec.Carries the NEST-facing parameters and status of an instantaneous (zero-delay) rate connection: a scalar
weightplus the delay-rejection semantics that distinguish this model fromrate_connection_delayed. It mirrors NEST’sGetStatus/SetStatussurface (weight, a read-onlydelaycompatibility 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
rateeach step, the connection depositsweight · rateinto the postsynaptic neuron’s delta input channel, and the post reads it viasum_delta_inputs. The one-step pipeline lag of that path is exactly NEST’suse_wfr=Falseinstantaneous 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:
- delay#
Compatibility field, always
1. Exposed inget_statusfor NEST API parity but ignored by transmission logic. Cannot be modified.- Type:
- SUPPORTS_WFR#
Class attribute, always
True(NEST advertises waveform-relaxation support for instantaneous connections).- Type:
Parameter Mapping
The following table maps NEST parameters to this implementation:
NEST Parameter
brainpy.state
Notes
weightweightConnection gain (scalar float)
delaydelayRead-only, always
1(compatibility)has_delayHAS_DELAYAlways
False(class attribute)supports_wfrSUPPORTS_WFRAlways
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(), orset_status(delay=...)raises aValueErrorwith the message:"rate_connection_instantaneous has no delay. Please use rate_connection_delayed."The
delayattribute is exposed inget_status()for NEST API compatibility (always returns1), but this value is ignored by the transmission logic and cannot be modified.Unit Handling
All parameters accept
brainunit.Quantityobjects or plain numeric values. If aQuantityis 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_wfrflag is set toTrue, matching NEST’s advertisement that instantaneous connections participate in its waveform-relaxation solver.
- Raises:
ValueError – If
weightis not scalar.ValueError – If any method attempts to set
delayordelay_steps.
See also
rate_connection_delayedDelayed rate connection model (NEST equivalent)
rate_neuron_ipnInput rate neuron (instantaneous rate receiver)
rate_neuron_opnOutput 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:
dictorscalar- Raises:
KeyError – If
keyis 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
GetStatusAPI convention.- Returns:
Dictionary with keys:
'weight'(float): Connection gain.'delay'(int): Always1(compatibility field, read-only).'has_delay'(bool): AlwaysFalse.'supports_wfr'(bool): AlwaysTrue.
- Return type:
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): AlwaysFalsefor this model.'supports_wfr'(bool): AlwaysTrue(waveform relaxation supported).
- Return type:
- set_delay(_)[source]#
Reject delay modification (instantaneous model has no delay).
This method always raises a
ValueErrorto 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
ValueErrorto 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
SetStatusAPI convention. Only allows updatingweight. Any attempt to setdelayordelay_stepsraises aValueError.- Parameters:
- Raises:
ValueError – If
delayordelay_stepsis present in updates (with NEST-matching error message).ValueError – If
weightfails 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 (
floatorarray-like) – New connection gain. Must be scalar. Acceptsbrainunit.Quantity(mantissa will be extracted).- Raises:
ValueError – If
weightis not scalar.
Examples
>>> conn = rate_connection_instantaneous() >>> conn.set_weight(2.5) >>> conn.get('weight') 2.5