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

Handle `_pre` and `_post` variables in `Synapses` model #818

Closed
denisalevi opened this Issue Mar 2, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@denisalevi
Member

denisalevi commented Mar 2, 2017

Just did a little test after @mstimberg mentioned concerns for using *_pre and *_post variables in Synapses models. And it is quite confusing, especially when using a variable A in a NeuronGroup and connecting it in a Synapses object with variable A_pre or A_post, since it is not clear which variable is going to get modified if we have on_pre = 'A_post = ...'
Take e.g. this script

from brian2 import *

G = NeuronGroup(1, 'A : 1', threshold='True')
S = Synapses(G, G, model='A_post : 1', on_pre='A_post += 1')
S.connect()
run(defaultclock.dt)

print('G.A = {}'.format(G.A[:]))
print('S.A_post = {}'.format(S.A_post[:]))                   

which produces this output

G.A = [ 0.]
S.A_post = [ 1.]

But one could have wanted to change the NeuronGroup variable instead. I guess it would be good to at least produce a warning or even not allow _pre or _post variables in Synapses models as @mstimberg suggested?

@thesamovar

This comment has been minimized.

Show comment
Hide comment
@thesamovar

thesamovar Mar 2, 2017

Member

Yeah I would tend to say that banning _pre or _post on synaptic variables (or maybe all variables for consistency?) would be the most logical approach.

Member

thesamovar commented Mar 2, 2017

Yeah I would tend to say that banning _pre or _post on synaptic variables (or maybe all variables for consistency?) would be the most logical approach.

@mstimberg

This comment has been minimized.

Show comment
Hide comment
@mstimberg

mstimberg Mar 2, 2017

Member

Yeah I would tend to say that banning _pre or _post on synaptic variables (or maybe all variables for consistency?) would be the most logical approach.

I agree, I'd be happy to ban it for all variables (imagine having a variable x_pre in a NeuronGroup and then referring to x_pre_pre or x_pre_post in the Synapses...). I really thought we were already doing that :-/

Member

mstimberg commented Mar 2, 2017

Yeah I would tend to say that banning _pre or _post on synaptic variables (or maybe all variables for consistency?) would be the most logical approach.

I agree, I'd be happy to ban it for all variables (imagine having a variable x_pre in a NeuronGroup and then referring to x_pre_pre or x_pre_post in the Synapses...). I really thought we were already doing that :-/

mstimberg added a commit that referenced this issue Apr 19, 2017

@mstimberg mstimberg modified the milestone: 2.1 Apr 28, 2017

@mstimberg mstimberg closed this in 03ba543 May 5, 2017

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