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

32 bit integer types cannot be used as index for synaptic variables #888

Closed
mstimberg opened this Issue Sep 29, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@mstimberg
Member

mstimberg commented Sep 29, 2017

Using a 32 bit numpy integer type (i.e., np.int32) as an index for a synaptic variable fails. E.g. with:

G = NeuronGroup(10, '')
S = Synapses(G, G, 'w : 1')
S.connect()

Using normal integers works:

S.w[0] = 1

While the following does not:

S.w[np.int32(0)] = 1  #FAILS

This also means that while you can use numpy arrays (depends on your architecture/OS whether you have to explicitly specify the dtype for the bug to trigger):

S.w[np.arange(10, dtype=np.int32)] = 1

Using a single element out of that array fails

S.w[np.arange(10, dtype=np.int32)[0]] = 1  #FAILS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment