align_pre_projection#

class brainpy.state.align_pre_projection(*spike_generator, syn, comm, out, post, stp=None)#

Pre-synaptic alignment projection with spike generation.

A convenience wrapper that combines spike generation, optional short-term plasticity (STP), pre-synaptic synapse dynamics, and a CurrentProj into a single module. The synapse operates in pre-synaptic space, processing spikes before the communication step transmits them to post-synaptic neurons.

The update pipeline is:

  1. Spike generator modules produce binary spike signals.

  2. If STP is provided, spikes are modulated by short-term plasticity dynamics.

  3. The pre-synaptic synapse model filters the (modulated) spikes.

  4. The CurrentProj maps the filtered signal to post-synaptic current.

Parameters:
  • *spike_generator – One or more modules that produce spike signals from the input.

  • syn (Dynamics) – Pre-synaptic synapse dynamics (e.g., Expon).

  • comm (Callable) – Communication module mapping pre-synaptic to post-synaptic space.

  • out (SynOut) – Synaptic output module.

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

  • stp (Dynamics, optional) – Short-term plasticity module applied after spike generation.

See also

align_post_projection

Post-synaptic alignment variant.

CurrentProj

Underlying current projection used internally.

AlignPostProj

Alternative projection with post-synaptic alignment.

Notes

  • Pre-synaptic alignment means the synapse state lives in pre-synaptic space. This is natural for models where synaptic filtering (e.g., exponential decay) should happen before the communication step.

  • Spike signals are wrapped in brainevent.BinaryArray for efficient event-driven processing.

  • When STP is used, its output is wrapped in brainevent.MaskedFloat to preserve sparsity.

Examples

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

State initialization function.