AlignPostProj

AlignPostProj#

class brainpy.state.AlignPostProj(*modules, comm, syn, out, post, label=None)#

Post-synaptic alignment projection.

In this projection pattern, the synapse dynamics and synaptic output are aligned with (owned by) the post-synaptic neuron. Multiple projections targeting the same post-synaptic population with the same synapse/output descriptor share a single synapse and output instance, enabling efficient event-driven updates.

The update pipeline is:

  1. Optional pre-processing modules transform the input.

  2. The communication module (comm) maps pre-synaptic signals to post-synaptic space.

  3. The result is added as a delta input to the shared synapse.

  4. The synapse and output are updated by the post-synaptic neuron’s before_update hook (if using descriptor merging).

Parameters:
  • *modules – Optional pre-processing modules applied sequentially to the input before the communication step.

  • comm (Callable) – Communication module (e.g., brainevent.nn.FixedProb) that maps pre-synaptic activity to post-synaptic space.

  • syn (ParamDescriber[AlignPost] or AlignPost) – Synapse model or its descriptor. When a descriptor is provided, the synapse is created lazily and shared across projections targeting the same post-synaptic neuron.

  • out (ParamDescriber[SynOut] or SynOut) – Synaptic output module or its descriptor.

  • post (Dynamics) – Post-synaptic neural population.

  • label (str, optional) – Label for identifying this projection’s contribution in the post-synaptic neuron’s input dictionary.

Raises:

TypeError – If comm is not callable, if syn/out types are inconsistent, or if post is not a Dynamics instance.

See also

DeltaProj

Direct delta-input projection.

CurrentProj

Current-based projection.

align_post_projection

Convenience wrapper with spike generation.

Notes

  • When both syn and out are descriptors (ParamDescriber), the projection attempts to merge with existing synapse/output instances on the post-synaptic neuron, avoiding duplicate state.

  • When syn is an already-instantiated AlignPost object, no merging occurs and out must also be an instantiated SynOut.

References

Examples

>>> import brainpy
>>> import brainstate
>>> import saiunit as u
>>> n_pre, n_post = 800, 200
>>> post_pop = brainpy.state.LIF(n_post, tau=20.*u.ms)
>>> post_pop.init_state()
>>> proj = brainpy.state.AlignPostProj(
...     comm=brainstate.nn.Linear(n_pre, n_post),
...     syn=brainpy.state.Expon.desc(n_post, tau=5.*u.ms),
...     out=brainpy.state.CUBA.desc(scale=u.volt),
...     post=post_pop,
... )
init_state(*args, **kwargs)[source]#

State initialization function.