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.
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.
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/briansupport/3ed84a89-3d3e-d9fb-6241-3b30024cc1d6%40gmail.com.
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()