I am working on a model in which I have to accumulate the spikes fired by a NeuronGroup during the simulation and, based on the accumulated values, I have to update the rates of a PoissonGroup which acts as an input to the network.
I have attached an example script.
Basically, each simulation "step" lasts 20ms, there is an input which consists in the rate for each neuron at each step.
The issue is that this input has to change based on some computation that I cannot express using Brian2 Equation objects.
So, at the beginning at each step I count the spikes fired in the previous 20ms, perform the "accumulation" (which is used to control an agent in a 2d simulation) and then I need to update the rates of the stimulus for the next 20ms.
As it is right now, the stimulus_values array gets updated correctly, but the spikes generated from the PoissonGroup are not updated in the same way.
I have also tried to split up the run commands in the following way:
net = Network(collect())
for _ in range(sim_steps):
but it behaves in the same way.
Thank you very much!