FullProjAlignPostMg

FullProjAlignPostMg#

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

Full-chain synaptic projection with the align-post reduction and the automatic synapse merging.

The full-chain means that the model needs to provide all information needed for a projection, including pre -> delay -> comm -> syn -> out -> post.

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.

Moreover, it’s worth noting that FullProjAlignPostMg has a different updating order with all align-pre projection models. The updating order of align-post projections is spikes -> comm -> syn -> out. While, the updating order of all align-pre projection models is usually spikes -> syn -> comm -> out.

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):
    super().__init__()
    ne, ni = 3200, 800
    self.E = bp.dyn.LifRef(ne, V_rest=-60., V_th=-50., V_reset=-60., tau=20., tau_ref=5.,
                           V_initializer=bp.init.Normal(-55., 2.))
    self.I = bp.dyn.LifRef(ni, V_rest=-60., V_th=-50., V_reset=-60., tau=20., tau_ref=5.,
                           V_initializer=bp.init.Normal(-55., 2.))
    self.E2E = bp.dyn.FullProjAlignPostMg(pre=self.E,
                                       delay=0.1,
                                       comm=bp.dnn.EventJitFPHomoLinear(ne, ne, prob=0.02, weight=0.6),
                                       syn=bp.dyn.Expon.desc(size=ne, tau=5.),
                                       out=bp.dyn.COBA.desc(E=0.),
                                       post=self.E)
    self.E2I = bp.dyn.FullProjAlignPostMg(pre=self.E,
                                       delay=0.1,
                                       comm=bp.dnn.EventJitFPHomoLinear(ne, ni, prob=0.02, weight=0.6),
                                       syn=bp.dyn.Expon.desc(size=ni, tau=5.),
                                       out=bp.dyn.COBA.desc(E=0.),
                                       post=self.I)
    self.I2E = bp.dyn.FullProjAlignPostMg(pre=self.I,
                                       delay=0.1,
                                       comm=bp.dnn.EventJitFPHomoLinear(ni, ne, prob=0.02, weight=6.7),
                                       syn=bp.dyn.Expon.desc(size=ne, tau=10.),
                                       out=bp.dyn.COBA.desc(E=-80.),
                                       post=self.E)
    self.I2I = bp.dyn.FullProjAlignPostMg(pre=self.I,
                                       delay=0.1,
                                       comm=bp.dnn.EventJitFPHomoLinear(ni, ni, prob=0.02, weight=6.7),
                                       syn=bp.dyn.Expon.desc(size=ni, tau=10.),
                                       out=bp.dyn.COBA.desc(E=-80.),
                                       post=self.I)

  def update(self, inp):
    self.E2E()
    self.E2I()
    self.I2E()
    self.I2I()
    self.E(inp)
    self.I(inp)
    return self.E.spike

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)
Parameters:
update()[source]#

The function to specify the updating rule.