How to change poisson rates every 30ms for example?

Hi, may I know how can I implement to make the poisson rates more dynamic? For instance, in some image training from some papers, each image input is presented to the input neurons for 30ms with poisson rates proportional to its intensity? Then the code should be : PoissonGroup(N , ???) Thanks!

Hi,
One way to do that is using TimedArray:

https://brian2.readthedocs.io/en/stable/user/input.html?highlight=PoissonGroup#efficient-poisson-inputs-via-poissoninput

stimulus = b2.TimedArray(np.tile([50.0, 0.0], 5)*b2.Hz, dt=30.*b2.ms)
P = b2.PoissonGroup(1, rates='stimulus(t)')

resulting in five 30ms blocks of 50 Hz stimulation, followed by 30ms of silence.

I don’t know if it works on brian2genn, maybe the developers can guide you better.

1 Like

so lets say if I have 4 poisson input neurons, for the first 30ms, i want the rates to be [20,10,30,40] in order of the neurons, and for the next 30ms, i want the rates to be [50,60,70,80], is this way of implementing correct?

ta2d = TimedArray([[20, 10, 30, 40], [50, 60, 70, 80]]*Hz, dt=30*ms)
p = PoissonGroup(4, rates = 'ta2d(t,i)')

Thank you!

1 Like

Yes, that’s correct :+1:

1 Like