periodic boundaries

51 views
Skip to first unread message

Robin XU

unread,
Aug 3, 2020, 6:32:15 AM8/3/20
to Brian
Hi guys,

I am wondering anyone knows how to make the periodic boundaries for neural layers with synaptic connection functions in Brian2 ? Really need some help. 

Cheers,
Robin

Marcel Stimberg

unread,
Aug 4, 2020, 8:31:21 AM8/4/20
to Brian
Hi Robin,
the most succinct way to describe connections with periodic boundary conditions uses the modulo operator "%". We have one example in our 2014 paper (https://www.frontiersin.org/articles/10.3389/fninf.2014.00006/full#h3). It is not always straightforward to formulate things this way, though. As an alternative, you could decompose your connection condition. For example, if you have a variable "x : meter" and want to connect neurons that are less than 100µm from each other with period boundary conditions at 0µm and 1000µm, you could use:
syn.connect('abs(x_pre - x_post) < 100*um or abs(x_pre-1000*um-x_post) < 100*um or abs(x_pre+1000*um-x_post) < 100*um')

(throw in an "and i != j" if you do not want neurons to connect to themselves.)

If this gets too confusing, you can also separate it into separate connect calls:
syn.connect('abs(x_pre - x_post) < 100*u')
syn.connect('abs(x_pre-1000*um-x_post) < 100*um')
syn.connect('abs(x_pre+1000*um-x_post) < 100*um')

Hope that helps, best
  Marcel

Robin XU

unread,
Aug 5, 2020, 3:07:51 AM8/5/20
to brians...@googlegroups.com
Hi Marcel,

Thanks for your reply, your suggestions are really helpful. In addition, I am not so sure about how the TimedArray works in 2d-dimension? What does the index i mean in TimedArray, I would like to take each rate from the TimedArray for each neuron (such as 900 rates for 900 neurons individually), so I am wondering in Brian2, the i index already gives a different value for different neurons? or some other codes would be needed to locate different rates defined in TimedArray to different neurons defined in the neuron group (such as possiongroup)? 

Meanwhile, I am also confused about how to plot the firing rate of single neuron in the neuron group instead of just plot the population firing rate? Any suggestions on that?

Really appreciate your help, and thanks again for taking your valuable time.

Best regards,
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/4c1ed832-2cb4-4468-b83e-96cf2afbc327o%40googlegroups.com.

Marcel Stimberg

unread,
Aug 6, 2020, 11:21:03 AM8/6/20
to Brian
Hi Robin,

"i" always refers to the index of a neuron (see https://brian2.readthedocs.io/en/stable/user/models.html#state-variables). If you use it as the second argument of a TimedArray call, this means that each neuron gets a different value (see https://brian2.readthedocs.io/en/stable/user/input.html#timed-arrays).

About plotting the firing rate of a single neuron: this would depend on how you define the rate of a neuron (each time step the neuron either spikes or not). The most common thing to do would be to record the spike times with a spike monitor, convert the times to an array of 0 and 1s and then convolve this array with some kind of temporal kernel to get a smooth rate.

Best,
  Marcel

ausr...@gmail.com

unread,
Aug 29, 2020, 9:10:30 AM8/29/20
to Brian
Hi Marcel,

May I ask, from the web:

S.connect(condition='i != j', p='p_max*exp(-(x_pre-x_post)**2+(y_pre-y_post)**2 / (2*(125*umeter)**2))')

Does this define all connection within the distance? Is that possible to obtain a certain number of connections random draw from the gaussian distribution around the neuron?

Thanks,
Robin
Reply all
Reply to author
Forward
0 new messages