weight monitor

13 views
Skip to first unread message

Robin XU

unread,
Aug 18, 2020, 10:21:09 PM8/18/20
to Brian
Hi,

Is that possible to monitor the weight of synapses originating from a number of neurons like from neuron 0 to neuron 30, from the example:
M = StateMonitor(S, 'w', record=S[0, :]) # all synapses originating from neuron 0
so I am wondering how to record all synapses originating from neuron 0 to neuron 30? Thanks.

Cheers,
Robin

Felix Kern

unread,
Aug 19, 2020, 3:22:36 AM8/19/20
to Brian
Hi Robin,
You should be able to use the slice syntax in the pre-synaptic part, too:
M = StateMonitor(S, 'w', record=S[0:30, :]) # all synapses originating from neurons 0..30
Cheers, Felix

Robin XU

unread,
Aug 19, 2020, 3:26:42 AM8/19/20
to brians...@googlegroups.com
Hi Felix,

Thanks for your quick reply, really appreciate it. Meanwhile, may I ask how to count the numbers of synapses going into each target neuron from the source neuron layer?

Cheers,
Robin

--
http://www.facebook.com/briansimulator
https://twitter.com/briansimulator
 
Please cite Brian 2: Stimberg M, Brette R, Goodman DFM (2019). Brian 2, an intuitive and efficient neural simulator. eLife, doi: 10.7554/eLife.47314.
---
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 view this discussion on the web visit https://groups.google.com/d/msgid/briansupport/beee776c-2de5-4566-8a72-0bca7a0bdbcdn%40googlegroups.com.

Felix Kern

unread,
Aug 19, 2020, 3:34:19 AM8/19/20
to brians...@googlegroups.com

Hi Robin,

You can get the connected index pairs with S.i and S.j (pre- and postsynaptic indices, respectively). I've been using np.bincount on those to get outdegree and indegree (which is what you're after), though I suspect I may have missed a more direct route to get at those numbers.

Best, Felix

You received this message because you are subscribed to a topic in the Google Groups "Brian" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/briansupport/aJK29Kiloxw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to briansupport...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/briansupport/CAB9YjwYnJE_fsjVWuoG32HGi%2B8L1G-nDe%2B67v%3DWXVMDF6wndxA%40mail.gmail.com.

Robin XU

unread,
Aug 19, 2020, 3:42:13 AM8/19/20
to brians...@googlegroups.com
Hi Felix,

Get it, thanks. That’s really helpful. Appreciate it.

Cheers,
Robin

Marcel Stimberg

unread,
Aug 19, 2020, 3:45:30 AM8/19/20
to brians...@googlegroups.com

Hi everyone,

Felix's suggestion to use bincount is the most efficient if you are interested in this information for all neurons. If you are only interested in a few neurons you can also use something like len(S.i[:, 0]) to get the number of connections to neuron 0.

Having said that, we do actually store this information in the Synapses object already, but it is not easily accessible. The information is in the N_incoming and N_outgoing variables. These variables are meant to be accessed for each synapse (so that you can write something like on_pre='v_post += w/N_incoming' to get a normalized weight), but they are internally stored for each neuron. Until we expose a better way, you can access them like this:

synapses_going_out = S.variables['N_outgoing'].get_value()
synapses_coming_in = S.variables['N_incoming'].get_value()

Best,

  Marcel


Reply all
Reply to author
Forward
0 new messages