Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
`PopulationRateMonitor` can give wrong results for subgroups #772
So I happened to come across this quite severe bug which can lead a monitor to give incorrect results (without any error) for all codegen targets except numpy. It's about a
Here's a toy example that shows the bug:
>>> G = NeuronGroup(4, '''do_spike : boolean''', threshold='do_spike') >>> G.do_spike = [True, True, False, False] >>> rate_1 = PopulationRateMonitor(G[:2]) >>> rate_2 = PopulationRateMonitor(G[2:]) >>> run(defaultclock.dt) >>> rate_1.rate # correct <ratemonitor_1.rate: array([ 10.]) * khertz> >>> rate_2.rate # wrong! <ratemonitor_2.rate: array([ 10.]) * khertz>
This is obviously the worst kind of bug (wrong result, no error or other indication that something went wrong), however it applies to a quite specific situation (and involves
The fix is ready (will open a PR in a sec), I just wanted to put it here as an issue so that it is clearly documented.