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 axonalInputDelay, 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 abrainevent.CSRevent matmul intopost.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 (
DynamicsorNone) – Post-synaptic population (receivesadd_delta_input).Noneis 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 pureupdatekernel and the parameter declarations (weight, delay, traces, stochastic, homogeneity).conn (
ConnRule, optional) – Connectivity sampler; used when explicitpre_idx/post_idxedges 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 tolen(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) – Uniqueadd_delta_inputkey (defaults to one derived fromid).receptor_type (
int, optional) – Named-channel routing for a multi-compartment / named-channel post (a post exposingdelta_label_for_receptorand non_receptors, e.g.pp_cond_exp_mc_urbanczik). Resolved once to a delta-input channel label (mirroring the staticEventProjectionseam); 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]
- realized_edges()[source]#
Enumerate this plastic projection’s realized edges (
GetConnectionsview).Reads the live (post-simulation evolved)
weightState when allocated, else the pre-simulation init. A weight-evolving rule exposes no weight write-back. Seeplastic_proj_edges().- Returns:
Population-local
source/targetplus liveweight/delayin the canonical edge order.- Return type:
ProjEdges