Skip to content
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

User defined delay variable in Synapses object creates ambigiuity #927

Closed
denisalevi opened this issue Mar 13, 2018 · 1 comment
Closed

Comments

@denisalevi
Copy link
Member

The delay variable (as shortcut for the pre pathways delay) is accessible in the Synapses objects equations (model, on_event etc). But delay can also be defined as a synaptic variable, which create ambiguity about which variable is used when.

Quick example I was just running. When using delay in a differential equation like this

Synapses(group, group, model='''                          
                dA/dt = delay/ms : second                        
                ''',
                delay=2*ms)

delay=2*ms is used for the state update of A. But when defining another delay variable, e.g. like this

Synapses(group, group, model='''                          
                dA/dt = delay/ms : second
                delay = 4*ms : second                  
                ''',
                delay=2*ms)

delay = 4*ms is used in the state update of A.

I guess banning delay as synaptic variables as done for lastupdate would solve this. Or removing the accessibility to the synaptic delay in synapse code since other pathways delay variables (e.g. post.delay) are not accessible in synapse code either.

@mstimberg
Copy link
Member

I guess banning delay as synaptic variables as done for lastupdate would solve this.

Uh, indeed -- I'm actually surprised that this was not already the case... 😒

Or removing the accessibility to the synaptic delay in synapse code since other pathways delay variables (e.g. post.delay) are not accessible in synapse code either.

This is not that trivial, unfortunately. We add a reference to the pre pathway's delay to the Synapses.variables dictionary. The variables dictionary has two uses: it determines what you can access as attributes of the Synapses object, and it determines the variables you can access in the code. For delay, we are only interested in the former (to allow the convenience of syn.delay = ... instead of syn.pre.delay = ...) but it comes necessarily with the latter.

That said, I think we should fix both things, i.e.: no longer allow to declare variables called "delay", and change the mechanism so that the delay of the pre-synaptic pathway is not exposed via variables but in a more direct way (Synapses.delay is a property, delegating things to the pre-synaptic pathway).

mstimberg added a commit that referenced this issue Mar 20, 2018
Also, make exception types for illegal identifiers consistently
`SyntaxError` (previously, they could be `KeyError`, `ValueError`, or
`SyntaxError`).

Together with previous commit, fixes #927
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants