Closed tnowotny closed 5 years ago
Hum ... was just about to make a pull request for this but while it gives more precise timestep information and is more efficient, I could see problems as t and dt is passed to the function, a user could in principle pass in completely different t and dt into the function than is currently used int he simulation. I guess it would be quite dangerous to change is actually. So I guess we leave it as is.
It is unfortunately a bit more complicated than that. The main expression where we use the timestep
function is when checking whether a neuron is refractory. The expression we use is something like:
bool not_refractory = _timestep(t - lastspike, dt) >= _timestep(0.005, dt);
(where the 0.005
stands for a refractory time of 5ms). We could certainly implement this in a more efficient way, but I think it would be better to do this for Brian in general and not only for Brian2GeNN. For example, we could not only have a lastspike
variable, but also an integer variable steps_since_last_spike
that we can then directly compare.
And yes, in principle a user could use the timestep
for something else, even though I don't see many use cases.
Hi @mstimberg, I notice you implemented the Brian 2 _timestep function to derive an integer timestep from the global variable
t
asIs there a particular reason why not return the GeNN intrinsic integer timestep
(maybe you didn't know of its existence but I thought I'd ask before changing your solution)?