Conversion of the model from Brian1 to Brian2

Hi! Could you @mstimberg @adam kindly help me with conversion of the model (Gamma-beta alternation in the olfactory bulb (David, Fourcaud-Trocmé et al., 2015) github link) from Brian1 to Brian2 . At the moment there are several lines in which it is not clear how they will look in the Brian2.

Minimal code to reproduce problem

.......
G=NeuronGroup(N_granule,QIF_eqs,threshold='V > 0.*mV',reset='V = -70.*mV',freeze=True,compile=True)
............

Cmg_AMPA = Connection(M,G,'sE',
                                                    weight=2.5*param_dict['exc_weight'], # 2.5 factor to compensate for the depressed strength of AMPA in the beta regime
                                                    sparseness=param_dict['stronginh_connectproba'],
                                                    delay=1.*ms) #
            mystp=STP(Cmg_AMPA,taud=150*ms,tauf=1*ms,U=1.)

......

At NeuronGroup i don’t know what is freeze and compile and how it is look like at brian2. At Connection i don’t know about STP function and how it convert to Brian2.

Hi @serge25 . Make sure that you have a look at the conversion guide in the documentation, it should hopefully explain most of the necessary changes. You can ignore/remove the freeze and compile keywords in NeuronGroup, they just trigger some Brian1-specific optimisation and are no longer relevant.
The Connection class has been replaced by Synapses, and we no longer provide an STP function. Instead, you’ll have to be explicit about the equations that you want to use (but of course, the advantage is that you can change the details of the plasticity in any way you want). The equations that are used for STP in Brian 1 are shown here: Short-term plasticity — Brian 1.4.4 documentation
Without having tested everything in detail, the equivalent definition for Cmg_AMPA in Brian 2 should therefore be the following:

weight_AMPA = 2.5*param_dict['exc_weight'] # 2.5 factor to compensate ...
taud=150*ms
tauf=1*ms
U=1.

Cmg_AMPA = Synapses(M, G, '''dx/dt=(1-x)/taud : 1 (event-driven)
                             du/dt=(U-u)/tauf : 1 (event-driven)''',
                    on_pre='''sE_post += u*x*weight_AMPA
                              x = x*(1 - u)
                              u = u + U*(1 - u)''',
                    delay=1.*ms) 
Cmg_AMPA.connect(p=param_dict['stronginh_connectproba'])
Cmg_AMPA.x = 1
Cmg_AMPA.u = U

Hope that helps, best
Marcel

1 Like