LIF-neuronal network in Brian2

1,000 views
Skip to first unread message

diracdelt...@googlemail.com

unread,
Dec 9, 2015, 5:14:03 PM12/9/15
to Brian Development
Greetings,
                         I am a first-time user of Brian (2.0) and am relatively new to python. I have been trying to capture ephys data pertaining to spiking behaviour in auditory cortical columns with a column-model set up using Brian2. Prior to my efforts, simulations had been done using SimLIFNet, a LIF-neuronal network tool in MatLab.

dVi/dt = -Vi + I_applied + sum_k[ Wki*Isynapse ]
%                     2   -a*(t - Kj) 
% Isynapse = sum_j[  a * e          *(t - Kj) ] * Wji                                                ....(1)



I put together a column to capture the same patterns as the previous simulation attempt using SimLIFNet. My query concerns specification of model equations.
I specified a leaky integrate and fire model with an alpha synapse (given that the library option is not available in Brian2, I looked p the synaptic equations in Brian1.4 and wrote the following:
eqs = Equations('''
dV/dt = (-(V-vr23)+ge+I_off1)*(1./tau) : volt (unless refractory)
dge/dt = (I - ge)*(1./tau_syn): volt
dI/dt = -I*(1./tau_syn) : volt
''')
Similar equations apply for the neurongroups making up the different layers in the column, and they receive an afferent input from  SpikeGeneratorGroup at 300 ms (simulation runs for 1000 ms). 

The synapses between neurons/neurongroups update 'I" with the connection strength (excitatory/inhibitory). 
Could someone please let me know whether this is the correct formulation of (1) above? Also, if I use the white noise variable (xi), I get activity across the column and coordinated activity near/at the stimulus delivery point, and elsewhere (depending on parameters such as tau_syn, stimulus strength, connection strengths etc), but I need to be able to replicate both spontaneous coordinated behaviour as well as stimulus-driven spiking, and this does not seem to happen - I think this is due to the noise model in use. 
As a new user I could be making some errors or missing something syntactic - I would be grateful if someone could point me in the right direction. 

Regards

Anand



Marcel Stimberg

unread,
Dec 18, 2015, 12:17:44 PM12/18/15
to brian-de...@googlegroups.com
Hi Anand,

at the first sight your equations look good, but I think there's a mistake in the Brian 1 documentation for the alpha synapse: these equations will peak at t=tau_syn with the value 1/e, not with 1. To get the same effect as in the matlab code (assuming that a=1), you'll therefore have to multiply the weights by exp(1). The model you quoted looks a bit odd, though: is Isynapse really multiplied with the weight twice, once in the definition of Isynapse and later when summing things up in the differential equation for Vi?
Could you be more specific about how you used xi and in what way it does not do what you want? In general, I'd recommend to make first sure that your individual components work correctly (e.g. stimulate your neuron model artificially, use a single synapse as input, etc.) before you simulate a full complex network.

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.
For more options, visit https://groups.google.com/d/optout.

Anand Ramamoorthy

unread,
Jan 7, 2016, 7:40:02 PM1/7/16
to Brian Development
Hi Marcel,
                    First - sincere apologies for the delayed response! 
Second - Happy New Year to everyone!
Third - thanks for your response and for the Brian library - although I am still learning the ropes, it is a very good tool for exploratory purposes and the documentation is great. Although I am a bit puzzled by the absence of many features of Brian1 in Brian2 - such as the library of synapses, statistics tool etc. For eg. had to figure out why the alpha synapse takes the form of two differential equations (the one for "y" yields an exponential curve when plotted, and the one for x is indeed an alpha function).  

So I followed your suggestion to pare things down to a single neuron to see the behaviour of the equations. Using the form I mentioned previously, and without any noise or bias currents, the neuron's membrane potential remains at its rest value. If I add another neuron to it and connect it properly using a synapse (and increment the variable y such that y--> y+ w) it still isn't sufficient to get either to spike. However, using the SpikeGeneratorgroup object I delivered an input to this two-neuron system at around 400 ms of a 1000 ms run, and found that there was reliable and coordinated spiking for this event. 
However, what I wanted was both spontaneous activity as well as stimulus-driven activity, and for periods of spontaneous coordination etc.
So I looked around the Brian2 documentation for examples on the use of noise, as well as oscillatory behaviours etc, and then played with adding the white noise variable to either a) the differential equation for membrane potential OR b) the second equation for the alpha synpase, describing variable y.
I also introduced a constant bias component to Vm and multiplied the synaptic weights by exp(1) (yes, I assume a to be 1 in this case). 

so the equations are:
dV/dt = (- (V-vrest) + x + bias + noise) / tau: volt
dx/dt = (y-x)/tau_syn : volt
dy/dt = -y/tau_syn : volt

bias  = constant input in mV

noise = sigma*sqrt(tau)*xi

w_excitation  = w_exc*exp(1)

When presynaptic neuron spikes: y --> y + w_excitation


This yielded expected spiking patterns both in the individual and 2-neuron cases, as well as the entire column that I'd mentioned earlier (where there is interplay between excitation and inhibition). 

Are there any computational neuroscience courses /tutorials which use Brian2 as a pedagogic tool?

Thanks again for a valuable resource and for your helpful comments!

Best

Anand

Marcel Stimberg

unread,
Jan 12, 2016, 9:33:33 AM1/12/16
to brian-de...@googlegroups.com
Hi Anand,
> Are there any computational neuroscience courses /tutorials which use
> Brian2 as a pedagogic tool?

As part of the documentation we have an introductory tutorial:
http://brian2.readthedocs.org/en/2.0b4/resources/tutorials/index.html

I am not aware of any more advanced course that is using Brian 2 at the
moment. There is a fairly recent book with accompanying videos and
exercises by Wulfram Gerstner and colleagues that is using Brian 1,
though: http://neuronaldynamics.epfl.ch/

I did not look into their exercises in detail, but I think with the
information in the docs
(http://brian2.readthedocs.org/en/2.0b4/introduction/changes.html) it
should be relatively straightforward to convert their examples to Brian 2.

Best,
Marcel

Anand Ramamoorthy

unread,
Jan 12, 2016, 12:56:31 PM1/12/16
to brian-de...@googlegroups.com
Hi Marcel,
                         Thanks! I have worked through the Brian2 tutorials -- in fact that was my first introduction to Brian. 
Oh cool...will check out Wulfram Gerstner's book and the exercises. 
I have found the library very useful and easy to work with, so thanks again!

Best





--

--- You received this message because you are subscribed to a topic in the Google Groups "Brian Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/brian-development/6gBDKd-P38c/unsubscribe.
To unsubscribe from this group and all its topics, send an email to brian-developm...@googlegroups.com.

Anand Ramamoorthy

unread,
Feb 18, 2016, 2:30:40 PM2/18/16
to brian-de...@googlegroups.com
Hi Marcel et al.,
                              The earlier model got around to producing patterns of interest more or less, but it has now been replaced with a conductance-based model, with bi-exponential synaptic conductances. I did look up the bi-exponential synapse in Brian 1.4, and while the coupled differential equations make sense, one thing that I find missing (or am not seeing) is the explicit dependence of the conductance on history of input spikes. Is this to be implemented by framing the synaptic equations as "event-driven" updates? Or am I getting something wrong here? 

Regards

Anand

Marcel Stimberg

unread,
Feb 24, 2016, 1:25:09 PM2/24/16
to brian-de...@googlegroups.com
Hi Anand,

> I did look up the bi-exponential synapse in Brian 1.4, and while the
> coupled differential equations make sense, one thing that I find
> missing (or am not seeing) is the explicit dependence of the
> conductance on history of input spikes. Is this to be implemented by
> framing the synaptic equations as "event-driven" updates? Or am I
> getting something wrong here?

the "Brian-way" of writing models does indeed not model the history
explicitly in the way you often see in papers (sums over previous spike
times and things like that). Those descriptions should be understood as
the solutions of the differential equations that are used in Brian. E.g.
for a simple exponential synapse, describing the post-synaptic
conductance as
dg_syn/dt = -g_syn/tau_syn
and increasing it for every incoming spike
pre='g_syn += w'
Is equivalent to something like
g_syn(t) = w * sum ( exp((t_spike - t)/tau_syn))
where the sum is over all previous spikes with times t_spike.

The event-driven mechanism is not really related to that. Note that in
most of the cases (synapses that add up linearly), you should actually
model the synaptic conductance as part of the post-synaptic NeuronGroup
and not use any synaptic equations. Have a look at the examples in the
Brian 2 documentation to get an idea of how to write such models.

Finally, to understand what is going on it is always useful to create
plenty of monitors, e.g. a SpikeMonitor that registers the spikes of the
source group and a StateMonitor for the synaptic conductance. This way
you can plot all together and see how the synaptic conductance is
behaving in response to spikes and in the period between them.

Best,
Marcel


Anand Ramamoorthy

unread,
Feb 24, 2016, 2:27:38 PM2/24/16
to brian-de...@googlegroups.com
Hi Marcel,
                        Thanks for the reply. Let me enumerate my observations/responses to the points you raise. 

1. Ok...I do recall reading another poster (Daniel Bliss, I think) explaining how to derive the differential equations corresponding to more typical synaptic equations and suchlike using the Laplace transform - haven't attempted it yet but it's on the list of things to do
I see what you mean but it is good to have the clarification when I explain the "Brian-way" to those who have no experience with Brian.

2. Oh, I do describe the model equations for membrane potential , refractory period as well as synaptic conductances within each postsynaptic neuron group and do not use a separate synaptic model for the synapse object. I did go through the documentation and examples to see how such models are put together.

3. Yep - I use Spikemonitors, Statemonitors, PopulationRatemonitors  and also a pared-down small-circuit version of the model with its own set of monitors to examine responses to stimuli and spontaneous spiking etc. I quite like this very useful feature of Brian.

4. Going by your response, I am sure I have set up the model correctly, and the issue is probably one off selecting best parameters. Will post an update when I have sorted this out.

Many thanks for your response and explanations.

Best



Best,
  Marcel


Anand Ramamoorthy

unread,
Apr 7, 2016, 3:40:29 PM4/7/16
to brian-de...@googlegroups.com
Hi Marcel et al.,
                               Hope everyone is doing well. I managed to get a column/network model working, and have been testing its output vis-a-vis electrophysiological data. Upon digging into Brian's history and prior versions, I found that there was a modelfitting library in Brian1 which allowed one to fit a model to a sample dataset so as to obtain parameter values that would be best suited for modelling the data in question. Is there any analogous module in development for Brian2? I thought I could adapt the old one, but playdoh does not seem to have a version compatible with Python 3x. 
Are there any plans for a modelfitting library for Brian2? 

Best

Dan Goodman

unread,
Apr 8, 2016, 9:23:16 AM4/8/16
to brian-de...@googlegroups.com
Hi,

It's on the "long term to do" list, but no immediate plans to upgrade it
I'm afraid. On the other hand, if you want to try to get it working with
Brian 2 and Python 3.x we'd be very happy to give any advice we can.
I'll also contact the playdoh developer (who's an ex-Brian developer but
still working on neuroscience software development).

Dan

On 07/04/2016 20:40, 'Anand Ramamoorthy' via Brian Development wrote:
> Hi Marcel et al.,
> Hope everyone is doing well. I managed
> to get a column/network model working, and have been testing its output
> vis-a-vis electrophysiological data. Upon digging into Brian's history
> and prior versions, I found that there was a modelfitting library in
> Brian1 which allowed one to fit a model to a sample dataset so as to
> obtain parameter values that would be best suited for modelling the data
> in question. Is there any analogous module in development for Brian2? I
> thought I could adapt the old one, but playdoh does not seem to have a
> version compatible with Python 3x.
> Are there any plans for a modelfitting library for Brian2?
>
> Best
>
> On Wed, Feb 24, 2016 at 1:27 PM, Anand Ramamoorthy
> <diracdelt...@googlemail.com
> <mailto:brian-development%2Bunsu...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
>
> ---
> 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>.

Anand Ramamoorthy

unread,
Apr 11, 2016, 11:47:30 AM4/11/16
to brian-de...@googlegroups.com
Hi Dan,
                Thanks!That sounds like an interesting problem to solve, and I'd love to take a crack at it..but there are immediate postdoc project concerns and I am not sure I'd be able to look into this right now. Optimising model fit and parametrisation remains a task on the list and if I get to that point (right now I am re-evaluating some target data to see what the modelling should aim to replicate) I'd like to try adapting your older version to work with Brian2 and python 3x. Will ping back here when this happens!

Best

To unsubscribe from this group and all its topics, send an email to brian-developm...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages