class brainpy.dyn.HalfProjAlignPostMg(comm, syn, out, post, out_label=None, name=None, mode=None)[source]#

Defining the half part of synaptic projection with the align-post reduction and the automatic synapse merging.

The half-part means that the model only needs to provide half information needed for a projection, including comm -> syn -> out -> post. Therefore, the model’s update function needs the manual providing of the spiking input.

The align-post means that the synaptic variables have the same dimension as the post-synaptic neuron group.

The merging means that the same delay model is shared by all synapses, and the synapse model with same parameters (such like time constants) will also share the same synaptic variables.

All align-post projection models prefer to use the event-driven computation mode. This means that the comm model should be the event-driven model.

Code Examples

To define an E/I balanced network model.

import brainpy as bp
import brainpy.math as bm

class EINet(bp.DynSysGroup):
  def __init__(self):
    self.N = bp.dyn.LifRef(4000, V_rest=-60., V_th=-50., V_reset=-60., tau=20., tau_ref=5.,
                           V_initializer=bp.init.Normal(-55., 2.))
    self.delay = bp.VarDelay(self.N.spike, entries={'I': None})
    self.E = bp.dyn.HalfProjAlignPostMg(comm=bp.dnn.EventJitFPHomoLinear(3200, 4000, prob=0.02, weight=0.6),
                                     syn=bp.dyn.Expon.desc(size=4000, tau=5.),
    self.I = bp.dyn.HalfProjAlignPostMg(comm=bp.dnn.EventJitFPHomoLinear(800, 4000, prob=0.02, weight=6.7),
                                     syn=bp.dyn.Expon.desc(size=4000, tau=10.),

  def update(self, input):
    spk = self.delay.at('I')
    return self.N.spike.value

model = EINet()
indices = bm.arange(1000)
spks = bm.for_loop(lambda i: model.step_run(i, 20.), indices)
bp.visualize.raster_plot(indices, spks, show=True)
  • comm (DynamicalSystem) – The synaptic communication.

  • syn (ParamDescriber) – The synaptic dynamics.

  • out (ParamDescriber) – The synaptic output.

  • post (DynamicalSystem) – The post-synaptic neuron group.

  • out_label (Optional[str]) – str. The prefix of the output function.

  • name (Optional[str]) – str. The projection name.

  • mode (Optional[Mode]) – Mode. The computing mode.


The function to specify the updating rule.