EventPlasticProj#

class brainpy.state.network.EventPlasticProj(*args, **kwargs)#

Event-driven plastic projection from one population segment.

Each step it reads the pre population’s captured spike vector via pre_spike(), applies the axonal InputDelay, restricts to this projection’s pre/post segments, maintains any rule-declared per-neuron traces, calls the synapse rule kernel to obtain the per-edge effective weight, and delivers it through a brainevent.CSR event matmul into post.add_delta_input (summing multapses, scattering into sub-segments).

Parameters:
  • pre_spike (Callable[[], jax.Array]) – Returns the full pre-population spike vector, shape (n_pre_pop,).

  • n_pre_pop (int) – Size of the full pre population.

  • pre_local_idx (array_like) – Local indices into the pre population selected by this projection.

  • post (Dynamics or None) – Post-synaptic population (receives add_delta_input). None is permitted for substrate-only tests that do not deliver.

  • post_local_idx (array_like) – Local indices into the post population targeted by this projection.

  • rule (PlasticSynapse) – The synapse spec carrying the pure update kernel and the parameter declarations (weight, delay, traces, stochastic, homogeneity).

  • conn (ConnRule, optional) – Connectivity sampler; used when explicit pre_idx/post_idx edges are not supplied.

  • pre_idx (array_like, optional) – Explicit segment-local edges (skip sampling). Both or neither.

  • post_idx (array_like, optional) – Explicit segment-local edges (skip sampling). Both or neither.

  • n_post_pop (int, optional) – Size of the full post population (defaults to len(post_local_idx)).

  • post_spike (Callable[[], jax.Array], optional) – Returns the full post-population spike vector (STDP seam).

  • pre_is_post (bool) – Forwarded to the connectivity sampler.

  • allow_autapses (bool) – Forwarded to the connectivity sampler.

  • allow_multapses (bool) – Forwarded to the connectivity sampler.

  • seed (int, optional) – Connectivity sampling seed.

  • delta_key (str, optional) – Unique add_delta_input key (defaults to one derived from id).

  • receptor_type (int, optional) – Named-channel routing for a multi-compartment / named-channel post (a post exposing delta_label_for_receptor and no n_receptors, e.g. pp_cond_exp_mc_urbanczik). Resolved once to a delta-input channel label (mirroring the static EventProjection seam); each per-step deposit is then tagged with that label so the deposit reaches the correct compartment/sign. None (default) delivers to the unlabeled key.

Examples

>>> import jax.numpy as jnp, brainstate, brainunit as u
>>> from brainpy_state._nest_network.event_plastic import EventPlasticProj, _StaticTestRule
>>> class _Sink:
...     def add_delta_input(self, key, val): self.last = val
>>> sink = _Sink()
>>> brainstate.environ.set(dt=0.1 * u.ms)
>>> proj = EventPlasticProj(
...     pre_spike=lambda: jnp.array([1., 0.]), n_pre_pop=2,
...     pre_local_idx=jnp.arange(2), post=sink,
...     post_local_idx=jnp.arange(2), n_post_pop=2,
...     pre_idx=jnp.array([0, 1]), post_idx=jnp.array([0, 1]),
...     rule=_StaticTestRule(weight=jnp.array([3., 4.]) * u.pA))
>>> _ = brainstate.nn.init_all_states(proj)
>>> with brainstate.environ.context(t=0.1 * u.ms, i=1):
...     _ = proj.update()
>>> u.get_mantissa(sink.last).tolist()
[3.0, 0.0]
init_state(*args, **kwargs)[source]#

State initialization function.

realized_edges()[source]#

Enumerate this plastic projection’s realized edges (GetConnections view).

Reads the live (post-simulation evolved) weight State when allocated, else the pre-simulation init. A weight-evolving rule exposes no weight write-back. See plastic_proj_edges().

Returns:

Population-local source / target plus live weight / delay in the canonical edge order.

Return type:

ProjEdges