New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The `dt` attribute referenced by groups can be out-of-sync with the actual dt #684

Closed
mstimberg opened this Issue Apr 22, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@mstimberg
Member

mstimberg commented Apr 22, 2016

If you change the dt of a clock, then there is a bit of complicated machinery delaying the actual update until the start of the run (this is to deal with changes in dt between runs and the update of the internal clock based on integers). If you ask the clock for its dt, then this internal change is hidden from the user, but for the objects using the clock this is not the case. This can be confusing for a user checking the dt of a group, but more importantly it also screws up the PoissonInput class, which uses the group's dt for an internal check at the start of a run (see report on the mailing list: https://groups.google.com/d/topic/brian-development/AcmUIWURBoE/discussion)

Note that there is nothing wrong during the simulation, the groups use the correct clock/dt.

In [2]: defaultclock.dt = 0.5*ms

In [3]: G = NeuronGroup(1, '')  # uses defaultclock

In [4]: defaultclock.dt
Out[4]: 0.5 * msecond

In [5]: G.clock.dt
Out[5]: 0.5 * msecond

In [6]: G.dt  # <-- the problem
Out[6]: <neurongroup.dt: 100. * usecond>

In [7]: run(0*ms)  # This will consolidate the clock information

In [8]: G.dt  # <-- now all is good
Out[8]: <neurongroup.dt: 0.5 * msecond>

@mstimberg mstimberg self-assigned this Apr 22, 2016

@mstimberg mstimberg added this to the 2.0 milestone Apr 22, 2016

mstimberg added a commit that referenced this issue Apr 26, 2016

Change the stored scalar value of `dt` immediately when the clock is …
…changed instead of at the start of the run

Fixes #684

mstimberg added a commit that referenced this issue Apr 27, 2016

Change the stored scalar value of `dt` immediately when the clock is …
…changed instead of at the start of the run

Fixes #684

@mstimberg mstimberg closed this in #688 Apr 27, 2016

@mstimberg mstimberg removed the in progress label Apr 27, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment