This is very related to my comment here: Multiple run in standalone mode - #9 by mstimberg
If you need this kind of logic, then using runtime mode is much more straightforward (you could either stop the simulation or implement the logic in a network_operation
). If you want to do it in C++ standalone mode, then the only way I can think of is via C++ code that implements the logic. Instead of rate = ta_img(t, i)*Hz
you’d use something like rate = my_func(t, i)*Hz
and implement my_func
in C++ so that it looks at the recent firing rate and decides whether to present the next stimulus or the same stimulus with a higher firing rate. This solution is not very “elegant”, though, because you’d have to access some Brian internals such as the names of arrays in the generated code. If you want to go down that road, have a look at this thread: User-defined functions