SynapseCollection#
- class brainpy.state.network.SynapseCollection(spanned)#
A filtered, lazy view over realized synapses (NEST
SynapseCollection).Returned by
get_connections(). It stores, per spanned projection, only the kept edge indices and their population-localsource/target— no copy of weight or delay. Eachget()re-reads weight / delay from the live projection, so a query made beforesimulate()still reflects post-simulation evolved plastic weights.Methods mirror the NEST object:
get()(one key -> array, a list of keys -> dict),set()('weight'/'delay'write-back, guarded), thesource/targetarrays,len(), iteration over(source, target)pairs, andrepr.Notes
source/targetare population-local indices (brainpy.statehas no global node-id space).set('weight', value)accepts a scalar (broadcast to every edge) or a full per-edge array; a per-edge array is refused on a homogeneous-weight projection, and any write is refused on a projection whose plastic rule evolves the weight.set('delay', scalar)is homogeneous per projection (grid-rounded todt) and applies only to the static event path.- set(key, value)[source]#
Write a connection attribute back into the live projections.
- Parameters:
key (
str) –'weight'or'delay'('source'/'target'are read-only).value (
scalar,array, orbrainunit.Quantity) – For'weight': a scalar broadcasts to every edge, a per-edge array sets each edge. For'delay': a scalar homogeneous delay per projection.
- Raises:
ValueError – A per-edge weight on a homogeneous-weight projection; any weight write on a weight-evolving plastic projection; or a delay write on a plastic projection.
KeyError – A key other than
'weight'/'delay'.
- property source#
Population-local source index per edge (
(N,)int array).
- property target#
Population-local target index per edge (
(N,)int array).