ProjAlignPost1#

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

Synaptic projection which defines the synaptic computation with the dimension of postsynaptic neuron group.

To simulate an E/I balanced network:

class EINet(bp.DynSysGroup):
  def __init__(self):
    super().__init__()
    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.ProjAlignPost1(comm=bp.dnn.EventJitFPHomoLinear(3200, 4000, prob=0.02, weight=0.6),
                                   syn=bp.dyn.Expon(size=4000, tau=5.),
                                   out=bp.dyn.COBA(E=0.),
                                   post=self.N)
    self.I = bp.dyn.ProjAlignPost1(comm=bp.dnn.EventJitFPHomoLinear(800, 4000, prob=0.02, weight=6.7),
                                   syn=bp.dyn.Expon(size=4000, tau=10.),
                                   out=bp.dyn.COBA(E=-80.),
                                   post=self.N)

  def update(self, input):
    spk = self.delay.at('I')
    self.E(spk[:3200])
    self.I(spk[3200:])
    self.delay(self.N(input))
    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)
Parameters:
update(x)[source]#

The function to specify the updating rule.