KeyError related to PoissonGroup and net.remove() after update to brian2 2.3

8 views
Skip to first unread message

Wilhelm Braun

unread,
Jan 31, 2020, 5:57:19 AM1/31/20
to Brian Development
Dear all,

I recently upgraded to brian2 2.3 and observe the following error (before, with brian2 2.2.2.1 all was fine) when using

net.remove(poisson_group)

with a standard PoissonGroup object.
It reads

File "/home/wilhelm/projects/brian2-new/lib/python3.6/site-packages/brian2/core/network.py", line 516, in remove
self.objects.remove(obj)
KeyError: Thresholder(clock=Clock(dt=10. * usecond, name='defaultclock'), when=thresholds, order=0, name='poissongroup_thresholder')

In the beginning of the simulation file, I explicitly set defaultclock.dt. Could this have something to do with the new functionality of net.restore()?

Thanks for your answer!

Best, Wilhelm

Marcel Stimberg

unread,
Jan 31, 2020, 12:00:12 PM1/31/20
to brian-de...@googlegroups.com
Hi Wilhelm,

thanks, that seems indeed to be a bug. I am pretty sure we introduced it
when fixing https://github.com/brian-team/brian2/issues/1009, a shame
that our test suite did not catch it. As a workaround for Brian 2.3, you
should be able to use

    net.objects.remove(poisson_group)

(do not use it in earlier versions, though, it would probably break things).

I opened a github issue here:
https://github.com/brian-team/brian2/issues/1151

Best,

  Marcel


Reply all
Reply to author
Forward
0 new messages