Warning when TimedArray uses different time step than simulation

Hi!

Using TimedArray like so:

defaultclock.dt = 0.01*ms
I_stim = TimedArray(([0]*4+[2]+[0]*15+[15]+[0])*uA/(cmeter**2), dt=0.5*ms

I get the following warning:

WARNING    Group uses a dt of 1. us while TimedArray uses dt of 0.5 ms [brian2.input.timedarray]

Why is this a warning? I do want a stimulus with a width of 0.5 ms at certain points in time.

Is there better way that does not yield a warning? Of course I could set TimedArray to use the defaultclock.dt but why should I have to?

Thanks,

Sebastian

Hi! Your example above shouldn’t raise the warning, but I can reproduce it with dt = 0.001*ms (which you seemed to have used as the warning suggests). This is quite a small dt! Anyway, you get the warning because of numerical issues: 0.5*ms is not an integer multiple of 0.001*ms (given that everything is stored as floating point numbers) – the former is exactly 500.00000000000006 bigger than the latter…
In other places we are dealing with such issues a bit more gracefully, I think here you can safely ignore the warning. The warning is meant for situations where for example the group dt is 0.1*ms, and the TimedArray dt is 0.15*ms, i.e. where it is not obvious how to map the stimulus changes on the dt grid.

1 Like

Hi! You’re of course right. I’ve used dt = 0.001*ms. The warning makes sense now with your hint to floating point. Cheers, Sebastian

1 Like