linked_var and Synapses

35 views
Skip to first unread message

Gordon Erlebacher

unread,
Dec 15, 2014, 1:02:58 PM12/15/14
to brian-de...@googlegroups.com
Hi, 

Is it possible to link a synapse variable to a variable in a NeuronGroup? I have failed so far.  I have a need to transfer the value of a variable 
from one synapse to another. Put differently, I have a requirement

Here is a minimal example: 
======================

from brian2 import *

eqs1 = Equations(""" dv/dt = -v * Hz : 1 """)
eqs2 = Equations(""" dv/dt = 1 * Hz : 1 """)
eqA = Equations(""" vn : 1 (linked) """)

P = PoissonGroup(1, 8*Hz)
G = NeuronGroup(1, eqs1)
A = NeuronGroup(1, eqs2, threshold = 'v > 1', reset='v=0')

S1 = Synapses(P, A, model=eqA)   # <=== variable "vn" in eqA is linked to "v" in G
S1.vn = linked_var(G, 'v')
S1.connect(True)

######################
Error message: 

ERROR    brian2: 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: /var/folders/5j/c7kq4kb565sbg07km9_bmxqh0000gn/T/brian_debug_ecqG92.log  Additionally, you can also include a copy of the script that was run, available at: /var/folders/5j/c7kq4kb565sbg07km9_bmxqh0000gn/T/brian_script_xbvOcq.py Thanks!

Traceback (most recent call last):

  File "tst.py", line 12, in <module>

    S1 = Synapses(P, A, model=eqA)   # <=== variable "vn" in eqA is linked to "v" in G

  File "/Users/erlebach/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Brian2-2.0beta-py2.7-macosx-10.6-x86_64.egg/brian2/synapses/synapses.py", line 599, in __init__

    PARAMETER: ['constant', 'shared']})

  File "/Users/erlebach/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Brian2-2.0beta-py2.7-macosx-10.6-x86_64.egg/brian2/equations/equations.py", line 886, in check_flags

    flag, allowed_flags[eq.type]))

ValueError: Equations of type "parameter" cannot have a flag "linked", only the following flags are allowed: ['constant', 'shared']



Thanks!


     Gordon


Marcel Stimberg

unread,
Dec 18, 2014, 5:37:46 AM12/18/14
to brian-de...@googlegroups.com
Hi Gordon,

no, you cannot have linked variables in synapses because the number of
synapses is not fixed -- in contrast to the number of neurons in a
NeuronGroup -- and you'd therefore have to specify how to map between
the two groups and the mapping would have to change after the addition
of synapses.

If all you want to do is access variables from two different
NeuronGroups (PoissonGroup could be reformulated as a NeuronGroup as
well) of the same size (or even of different size, you'd have to specify
the indexing explicitly in that case), then you can do the linking on
the level of the NeuronGroup.

G1 = NeuronGroup(N, 'dv/dt = -v/ tau : 1', ...)
G2 = NeuronGroup(N, '''dv/dt = -v/ tau : 1
v_other : 1 (linked)''')
G2.v_other = linked_var(G1, 'v')
S = Synapses(G2, target, ...) # <- can now refer to G1.v as v_other_pre

Best,
Marcel
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Brian Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to brian-developm...@googlegroups.com
> <mailto:brian-developm...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages