“IndexError ” raised when trying to monitor a subgroup

36 views
Skip to first unread message

huweit...@gmail.com

unread,
Mar 14, 2017, 2:16:10 AM3/14/17
to Brian
Hi,
It is really confusing for me that an error raised when I was running some codes modified a little from user's guide:


from brian2 import *

duration = 100*ms
G = NeuronGroup(10, '''dv/dt = -v/tau : volt
tau : second''',
threshold='v > -50*mV',
reset='v = -70*mV',
method='linear')
G.v = -65*mV
# Create subgroups
G1 = G[:5]
G2 = G[5:]
G1.tau = 10*ms
G2.tau = 10*ms
S1=SpikeMonitor(G1)
S2=SpikeMonitor(G2)
run(duration)


The detailed error information is as following:



ERROR Brian 2 encountered an unexpected error. If you think this is bug in Brian 2, please report this issue either to the mailing list at <http://groups.google.com/group/brian-development/>, or to the issue tracker at <https://github.com/brian-team/brian2/issues>. Please include this file with debug information in your report: c:\users\jason\appdata\local\temp\brian_debug_omnwsa.log Additionally, you can also include a copy of the script that was run, available at: c:\users\jason\appdata\local\temp\brian_script_lhislv.py You can also include a copy of the redirected std stream outputs, available at c:\users\jason\appdata\local\temp\brian_stdout_50tkvh.log and c:\users\jason\appdata\local\temp\brian_stderr_lx4vvu.log Thanks! [brian2]
Traceback (most recent call last):
File "D:/HieraticalSNN/test2.py", line 17, in <module>
run(duration)
File "D:\Program Files (x86)\Python27\lib\site-packages\brian2\units\fundamentalunits.py", line 2428, in new_f
result = f(*args, **kwds)
File "D:\Program Files (x86)\Python27\lib\site-packages\brian2\core\magic.py", line 371, in run
namespace=namespace, profile=profile, level=2+level)
File "D:\Program Files (x86)\Python27\lib\site-packages\brian2\core\magic.py", line 231, in run
namespace=namespace, profile=profile, level=level+1)
File "D:\Program Files (x86)\Python27\lib\site-packages\brian2\core\base.py", line 278, in device_override_decorated_function
return func(*args, **kwds)
File "D:\Program Files (x86)\Python27\lib\site-packages\brian2\units\fundamentalunits.py", line 2428, in new_f
result = f(*args, **kwds)
File "D:\Program Files (x86)\Python27\lib\site-packages\brian2\core\network.py", line 842, in run
obj.run()
File "D:\Program Files (x86)\Python27\lib\site-packages\brian2\core\base.py", line 181, in run
codeobj()
File "D:\Program Files (x86)\Python27\lib\site-packages\brian2\codegen\codeobject.py", line 98, in __call__
return self.run()
File "D:\Program Files (x86)\Python27\lib\site-packages\brian2\codegen\runtime\numpy_rt\numpy_rt.py", line 131, in run
raise brian_object_exception(message, self.owner, exc)
BrianObjectException: Original error and traceback:
Traceback (most recent call last):
File "D:\Program Files (x86)\Python27\lib\site-packages\brian2\codegen\runtime\numpy_rt\numpy_rt.py", line 122, in run
exec self.compiled_code in self.namespace
File "(string)", line 30, in <module>
IndexError: index 5 is out of bounds for axis 1 with size 5

Error encountered with object named "spikemonitor".
Object was created here (most recent call only, full details in debug log):
File "D:/HieraticalSNN/test2.py", line 15, in <module>
S1=SpikeMonitor(G1)

An exception occured during the execution of code object spikemonitor_codeobject.
The error was raised in the following line:
_array_spikemonitor_count[_events - _source_start] += 1
IndexError: index 5 is out of bounds for axis 1 with size 5
(See above for original error message and traceback.)

Process finished with exit code 1

huweit...@gmail.com

unread,
Mar 14, 2017, 2:58:31 AM3/14/17
to Brian, huweit...@gmail.com
Well, the error disappeared when I installed the Cython module(to eliminate the warning about Cython). And now there still exists a warning :

WARNING    Cannot use weave, a test compilation failed: error: Command "C:\Users\Jason\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG /arch:SSE2 -I"D:\Program Files (x86)\Python27\lib\site-packages\scipy\weave" -I"D:\Program Files (x86)\Python27\lib\site-packages\scipy\weave\scxx" -I"D:\Program Files (x86)\Python27\lib\site-packages\numpy\core\include" -I"D:\Program Files (x86)\Python27\include" -I"D:\Program Files (x86)\Python27\PC" /TpD:\Program Files (x86)\Python27\lib\site-packages\scipy\weave\scxx\weave_imp.cpp /Foc:\users\jason\appdata\local\temp\scipy-walt-es8yjn\python27_intermediate\compiler_e3b0c44298fc1c149afbf4c8996fb924\Release\Program Files (x86)\Python27\lib\site-packages\scipy\weave\scxx\weave_imp.obj /Ox /w /arch:SSE2 /Zm1000" failed with exit status 2 (CompileError) [brian2.codegen.runtime.weave_rt.weave_rt.failed_compile_test]

Now I wonder whether the error is solved properly and whether the existing warning does influence.


在 2017年3月14日星期二 UTC+8下午2:16:10,huweit...@gmail.com写道:

Marcel Stimberg

unread,
Mar 14, 2017, 6:03:53 AM3/14/17
to brians...@googlegroups.com

Hi,

thanks for reporting this issue, this seems to be a genuine bug :-/ It only affects the "numpy" code generation target, i.e. if Brian can use Cython then all should be fine. It'd be interesting to know why the compilation with weave fails as well (if you add " prefs.codegen.target = 'weave' " to your script, it should fail with an error message stating the name of the log file, that log file might be helpful). You get the warning because if you do not explicitly chose a code generation target, Brian will try first weave then cython, and finally numpy. If Cython works correctly, you can ignore the warning. To get rid of it, explicitly add

    prefs.codegen.target = 'cython'

to the top of your script (after the import). You can find more information on all this in the docs: http://brian2.readthedocs.io/en/stable/user/computation.html

Oh, and a final note: the bug is apparently triggered by the use of SpikeMonitor on subgroups -- this *should* of course work, but in your specific example it is not necessary, you could have a single SpikeMonitor recording from the full group, instead.

Best,

  Marcel

-- http://www.facebook.com/briansimulator https://twitter.com/briansimulator   New paper about Brian 2: Stimberg M, Goodman DFM, Benichoux V, Brette R (2014).Equation-oriented specification of neural models for simulations. Frontiers Neuroinf, doi: 10.3389/fninf.2014.00006. --- You received this message because you are subscribed to the Google Groups "Brian" group. To unsubscribe from this group and stop receiving emails from it, send an email to briansupport...@googlegroups.com. To post to this group, send email to brians...@googlegroups.com. Visit this group at https://groups.google.com/group/briansupport. For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages