# Warning when TimedArray uses different time step than simulation

**URL:** <https://brian.discourse.group/t/warning-when-timedarray-uses-different-time-step-than-simulation/401>\
**Category:** Support\
**Created:** [8 June 2021 06:38 UTC](https://brian.discourse.group/t/warning-when-timedarray-uses-different-time-step-than-simulation/401 "2021-06-08T06:38:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![schmitts](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/schmitts/32/191_2.png) [@schmitts](https://brian.discourse.group/u/schmitts)\
**Post date:** [8 June 2021 06:38 UTC](https://brian.discourse.group/t/warning-when-timedarray-uses-different-time-step-than-simulation/401/1 "2021-06-08T06:38:29Z")

</div>

Hi!

Using `TimedArray` like so:

```auto
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:

```auto
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

---

<div class="post-metadata">

**Author:** ![mstimberg](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/mstimberg/32/11_2.png) [@mstimberg](https://brian.discourse.group/u/mstimberg)\
**Post date:** [8 June 2021 16:39 UTC](https://brian.discourse.group/t/warning-when-timedarray-uses-different-time-step-than-simulation/401/2 "2021-06-08T16:39:02Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![schmitts](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/schmitts/32/191_2.png) [@schmitts](https://brian.discourse.group/u/schmitts)\
**Post date:** [8 June 2021 17:29 UTC](https://brian.discourse.group/t/warning-when-timedarray-uses-different-time-step-than-simulation/401/3 "2021-06-08T17:29:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![schmitts](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/schmitts/32/191_2.png) [@schmitts](https://brian.discourse.group/u/schmitts)\
**Post date:** [8 June 2021 19:47 UTC](https://brian.discourse.group/t/warning-when-timedarray-uses-different-time-step-than-simulation/401/4 "2021-06-08T19:47:28Z")

</div>

> <https://github.com/brian-team/brian2/pull/1310>
