Replicating "Rapid thalamocortical network switching mediated by cortical synchronization..." by Soplata et al. (2023) in Brian2

Hello Brian2 community,

I am trying to implement a thalamocortical model for propofol induced anesthesia from this paper, " Rapid thalamocortical network switching mediated by cortical synchronization underlies propofol-induced EEG signatures: a biophysical model" by Soplata et al. published in JNP in 2023.

Keywords: PY(Pyramidal neurons), IN(Interneurons), TC(Thalamic relay cells), TRN(Thalamic reticular nucleus)

The authors have implemented their model and study in Dynasim (MATLAB based toolbox for neural simulations). When I ran their code in Dynasim then the results were almost similar to as given in their paper. My goal is to implement their proposed model in Brian2 for more openness and scalability and extend it to a mesoscale whole-brain model for anesthesia with the help of experimentally observed data. I translated their code and implemented their complete study in Brian2. In their study they have included a short-term depression of intracortical excitatory connections for AMPAergic and NMDAergic synapses (PY>PY, PY>IN) and for short-term depression of inhibitory GABAergic synaptic connections (IN-PY, IN>IN). I guess that it is much similar to STDP (spike time dependent plasticity) or maybe it is STDP itself because the authors haven’t mentioned about it much in the paper. However, I am not able to implement this mechanism in Brian2 exactly similar to Dynasim. The following equations from the paper indicate this mechanism:

The complete equations for the model can be seen from the supplementary material available on the paper link mentioned earlier.

The Dynasim implementation of this mechanism for PY>PY AMPAergic synapse is as follows:

% # iAMPA_PYdr_PYso_JB12:
%
% Normalized synaptic AMPAergic excitatory current, with synaptic
% depression and minis, FROM the pyramidal axo-soma TO pyramidal dendrite
% PYdr<-PYso connection used in the DynaSim implementation of (Benita et
% al., 2012).
%
% - Dependencies:
%     - netconNearestNeighbors.m
%
% - References:
%     - Benita, J. M., Guillamon, A., Deco, G., & Sanchez-Vives, M. V. (2012).
%     Synaptic depression and slow oscillatory activity in a biophysical
%     network model of the cerebral cortex. Frontiers in Computational
%     Neuroscience, 6. https://doi.org/10.3389/fncom.2012.00064
%
% - Tags: synapse, connection, excitation, ampa
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Parameters
% For DynaSim, we need to convert synaptic maximal conductance from
% absolute to area-relative terms, while also converting the units to
% mS/cm^2 to keep pace with the rest of the equations:
%
% 5.4 nS (gAMPA EE) / 0.035 mm^2 (dendrite area) * ...
% 1 mS / 1000000 nS * 100 mm^2 / 1 cm^2 = ...
% 0.0154 mS/cm^2
%
gAMPAMult = 1 % for experimenting with gAMPA
gAMPA = gAMPAMult * 0.0154 % mS/cm^2
EAMPA = 0 % mV

alpha = 3.48
tauS = 2 % ms
deprFactor = 0.9
tauRes = 400 % ms

sAMPAIC = 0.0
sAMPANoiseIC = 0.1
resIC = 0.8
resNoiseIC = 0.1

% Connectivity
% Connective radius, aka how many target cells each source cell connects
% to, from the source's perspective.
radius = 10

% Remove autapses to the dendrite corresponding to this soma
removeRecurrentBool = 1
% We also need to normalize the conductance in mS/cm^2 by the number of
% connections each target cell is receiving on average, so that the TOTAL
% sum of their conductive inputs adds to our overall maximal conductance
% above.
normalizingFactor = min(((2*radius + (1-removeRecurrentBool)) / (N_post/N_pre)), N_pre)

% Note that what is passed is 2x the radius
netcon = netconNearestNeighbors(2*radius, N_pre, N_post, removeRecurrentBool)


% Functions
IAMPA_PYdr_PYso_JB12(X,sAMPA,rec) = -gAMPA/normalizingFactor.*((res.*sAMPA)*netcon).*(X-EAMPA)

monitor IAMPA_PYdr_PYso_JB12

% This is the synaptic activity state variable
sAMPA' = alpha./(1 + exp(-(X_pre-20)./2)) - sAMPA./tauS
sAMPA(0) = sAMPAIC+sAMPANoiseIC.*rand(1,N_pre)

% This is the 'resources' state variable
res' = (1 - res)./tauRes + max((t-tspike_pre)<=(2*dt)).*(-(1 - res)./tauRes + (deprFactor.*res - res)./dt)
res(0) = resIC-resNoiseIC.*rand(1,N_pre)

% Linker
@current += IAMPA_PYdr_PYso_JB12(X_post,sAMPA,res)

So what I am facing the issue is that I am not getting the same results as Dynasim in Brian2 because of some implementation issue in Brian2 or possibly the internal environment differences between the two which I am not able to figure out. From the equations and Dynasim code we can see that there is a resources variable which is depressed by some factor whenever a presynaptic spike occurs. I tried to implement exactly the same logic as given in the paper in Brian2 but what I observe is that the plots for the resources variable are quite different between Brian2 and Dynasim.

I am also confused about whether to include the refractory period (I have kept around 2ms) for all the cells in Brian2 or not. Because Dynasim based model does not include it in the code or mention anywhere in the paper. The model is based on Hodgkin-Huxley dynamics. If I don’t include that then the cells fire at a much higher rate than as compared to Dynasim.

So in summary, any help in solving this issue or the exact implementation of model like Dynasim in Brian2 would be really appreaciated. Apologies for such a long post :'). Looking forward to hearing from you all if you are interested in it and I am eager to learn from this wonderful community. It would be great help for my project as well as it might inform others to translate Dynasim based models to Brian2 or possibly create such large models on their own in Brian2.

Thanks in advance!

The Dynasim based model code provided by the authors is available at GitHub - asoplata/soplata-2023-thalcort-code

The complete Brian2 (Python) code for the model I tried to replicate can be seen from this link:

The synaptic depression mechanism I tried to implement is at line 425 and line 515 in the code if you don’t want to go through the entire code.

Plot for res variable from Dynasim:

Plot for res variable from Brian2:

Hi @Volcanic_Neuron. I did not yet have time to look into your code in detail, but just a few remarks:

  • this does not seem to be STDP, but STP (similar acronym but different :wink: ). This is about individual synapses that get depressed after repeated activation, and does not depend on the spiking activity of the post-synaptic cell (as STDP does)
  • In your code, I’ve seen that you implemented this in the post-synaptic neuron equations. This does not work for STP, since the synapses are independent. This usually has to be implemented in the Synapses object, see e.g. this example: Example: example_1_COBA — Brian 2 2.7.1 documentation
  • When they refer to the “last spike” in their paper, they mean the last spike of the pre-synaptic cell. In your code, you are using the lastspike variable in the post-synaptic cell, so this won’t work.

Hope that gives you a few ideas. I am actually not sure that this weird “if time since last spike < 2dt” thing is needed, maybe this is just a workaround for numerical rounding errors and is supposed to say: “if the neuron spiked in the previous time step”? In this case, you’d rather use the standard on_pre mechanism (as in the example I linked earlier), instead of explicitly calculating a time difference.

A minor note: I’ve seen that you implemented your own max_func, but if it is only needed for something like max(V, 0*mV), you can replace it by clip(V, 0*mV, inf*mV) :slight_smile:

Hope this gives you a few ideas!

Thank you @mstimberg for responding so quickly and noting implementation mistakes in my code. I missed that clip can be used like a max function also, interesting :slightly_smiling_face: Now I get it, thanks for clearing confusion between STDP and STP.

I will try your suggestions and see if I can get the model working.

Hello @mstimberg . As per your suggestions I made changes to my code and after debugging each synapse one by one I finally found out some issues due to which the model is not giving exactly the same output as the Dynasim.

Radius = 10
Remove_Recurrent_Bool = True
dtMult = 2
dtStart = -0.03

################################# AMPAergic synapse from PYso to IN ###############################

# Parameters

gAMPAMult = 1  # for experimenting with gAMPA

# Synapse equations

IAMPA_PYso_IN_eqns = '''
normalizing_factor = clip((2 * radius + (1 - int(remove_recurrent_bool))) / (Npost / Npre), 0, Npre) : 1
iAMPA_PYso_IN_post = -(gAMPA / normalizing_factor) * (res_AMPA * sAMPA) * (v_post - EAMPA) : amp/meter**2 (summed)
dsAMPA/dt = alpha / (1 + exp(-(v_pre - 20 * mV) / (2 * mV))) - sAMPA / tau : 1 (clock-driven)
dres_AMPA/dt = (1 - res_AMPA) / tauRes + int(timestep(t - tspikePre, dt) <= timestep(dtMult*dt, dt)) * (-(1 - res_AMPA) / tauRes + (deprFactor * res_AMPA - res_AMPA) / dt) : 1 (clock-driven)
tspikePre : second  # pre-synaptic spike times
Npre : 1
Npost : 1
alpha : 1/second
tau : second
deprFactor : 1
tauRes : second
gAMPA : siemens/meter**2
EAMPA : volt
radius : 1
remove_recurrent_bool : boolean
'''

IAMPA_PYso_IN = b2.Synapses(PYso_group, IN_group, model=IAMPA_PYso_IN_eqns,
                              on_pre='''
                              tspikePre = t
                              ''', method='euler')

# Connectivity matrix
netcon3 = netcon_nearest_neighbors(2*Radius, len(IAMPA_PYso_IN.source), len(IAMPA_PYso_IN.target), Remove_Recurrent_Bool)

sources3, targets3 = netcon3.nonzero()

IAMPA_PYso_IN.connect(i=sources3, j=targets3)

# Initial conditions
IAMPA_PYso_IN.Npre = len(IAMPA_PYso_IN.source)
IAMPA_PYso_IN.Npost = len(IAMPA_PYso_IN.target)
# IAMPA_PYso_IN.gAMPA = gAMPAMult * 0.01125 * b2.msiemens / b2.cm**2  # mS/cm^2 ### Default
IAMPA_PYso_IN.gAMPA = gAMPAMult * 1.0 * b2.msiemens / b2.cm**2  # mS/cm^2 ###Propofol
IAMPA_PYso_IN.EAMPA = 0 * b2.mV
IAMPA_PYso_IN.alpha = 3.48 / b2.ms
IAMPA_PYso_IN.tau = 2 * b2.ms
IAMPA_PYso_IN.deprFactor = 0.9
IAMPA_PYso_IN.tauRes = 400 * b2.ms
IAMPA_PYso_IN.radius = 10
IAMPA_PYso_IN.remove_recurrent_bool = True
IAMPA_PYso_IN.sAMPA = '0.0 + 0.1 * rand()' # Initial condition for sAMPA
IAMPA_PYso_IN.res_AMPA = '0.8 - 0.1 * rand()' # Initial condition for res
IAMPA_PYso_IN.tspikePre = dtStart * b2.ms

########################### NMDAergic synapse from PYso to IN #############################

# Synapse equations
INMDA_PYso_IN_eqns = '''
normalizing_factor = clip((2 * radius + (1 - int(remove_recurrent_bool))) / (Npost / Npre), 0, Npre) : 1
iNMDA_PYso_IN_post = -(gNMDA / normalizing_factor) * (res_NMDA * sNMDA) * (v_post - ENMDA) : amp/meter**2 (summed)
dsNMDA/dt = alphaS * xNMDA * (1 - sNMDA) - sNMDA / tauS : 1 (clock-driven)
dxNMDA/dt = alphaX / (1 + exp(-(v_pre - 20 * mV) / (2 * mV))) - xNMDA / tauX : 1 (clock-driven)
dres_NMDA/dt = (1 - res_NMDA) / tauRes + int(timestep(t - tspikePre, dt) <= timestep(dtMult*dt, dt)) * (-(1 - res_NMDA) / tauRes + (deprFactor * res_NMDA - res_NMDA) / dt) : 1 (clock-driven)
tspikePre : second  # pre-synaptic spike times
Npre : 1
Npost : 1
alphaS : 1/second
tauS : second
alphaX : 1/second
tauX : second
deprFactor : 1
tauRes : second
gNMDA : siemens/meter**2
ENMDA : volt
radius : 1
remove_recurrent_bool : boolean
'''

INMDA_PYso_IN = b2.Synapses(PYso_group, IN_group, model=INMDA_PYso_IN_eqns,
                              on_pre='''                                     
                              tspikePre = t
                              ''', method='euler')

# Connectivity matrix
netcon4 = netcon_nearest_neighbors(2*Radius, len(INMDA_PYso_IN.source), len(INMDA_PYso_IN.target), Remove_Recurrent_Bool)

sources4, targets4 = netcon4.nonzero()

INMDA_PYso_IN.connect(i=sources4, j=targets4)

#Initial conditions
INMDA_PYso_IN.Npre = len(INMDA_PYso_IN.source)
INMDA_PYso_IN.Npost = len(INMDA_PYso_IN.target)
# INMDA_PYso_IN.gNMDA = 0.0025 * b2.msiemens / b2.cm**2  # mS/cm^2 ### Default
INMDA_PYso_IN.gNMDA = 0.0025 * b2.msiemens / b2.cm**2  # mS/cm^2 ### Propofol
INMDA_PYso_IN.ENMDA = 0 * b2.mV
INMDA_PYso_IN.alphaS = 0.5 / b2.ms
INMDA_PYso_IN.tauS = 100 * b2.ms
INMDA_PYso_IN.alphaX = 3.48 / b2.ms
INMDA_PYso_IN.tauX = 2 * b2.ms            
INMDA_PYso_IN.deprFactor = 0.9
INMDA_PYso_IN.tauRes = 400 * b2.ms
INMDA_PYso_IN.radius = 10
INMDA_PYso_IN.remove_recurrent_bool = True
INMDA_PYso_IN.sNMDA = '0.0 + 0.1 * rand()' # Initial condition for sNMDA
INMDA_PYso_IN.xNMDA = '0.0 + 0.1 * rand()' # Initial condition for xNMDA
INMDA_PYso_IN.res_NMDA = '0.8 - 0.1 * rand()' # Initial condition for res
INMDA_PYso_IN.tspikePre = dtStart * b2.ms

########################## GABA-Aergic synapse from IN to PYso #############################

# Parameters
propoCondMult = 3
propoTauMult = 3

# Synapse equations
IGABAA_IN_PYso_eqns = '''
normalizing_factor = clip((2 * radius + (1 - int(remove_recurrent_bool))) / (Npost / Npre), 0, Npre) : 1
iGABAA_IN_PYso_post = -propoCondMult * gGABAA / normalizing_factor * (res_GABAA * sGABAA) * (v_post - EGABAA) : amp/meter**2 (summed)
dsGABAA/dt = alpha / (1 + exp(-(v_pre - 20 * mV) / (2 * mV))) - sGABAA / (tauGABAA * propoTauMult) : 1 (clock-driven)
dres_GABAA/dt = (1 - res_GABAA) / tauRes + int(timestep(t - tspikePre, dt) <= timestep(dtMult*dt, dt)) * (-(1 - res_GABAA) / tauRes + (deprFactor * res_GABAA - res_GABAA) / dt) : 1 (clock-driven)
tspikePre : second  # pre-synaptic spike times
Npre : 1
Npost : 1
gGABAA : siemens/meter**2
EGABAA : volt
alpha : 1/second
tauGABAA : second
deprFactor : 1
tauRes : second
radius : 1
remove_recurrent_bool : boolean
'''

IGABAA_IN_PYso = b2.Synapses(IN_group, PYso_group, model=IGABAA_IN_PYso_eqns,
                              on_pre='''
                              tspikePre = t
                              ''', method='euler')

# Connectivity matrix
netcon5 = netcon_nearest_neighbors(2*Radius, len(IGABAA_IN_PYso.source), len(IGABAA_IN_PYso.target), Remove_Recurrent_Bool)

sources5, targets5 = netcon5.nonzero()

IGABAA_IN_PYso.connect(i=sources5, j=targets5)

#Initial conditions
IGABAA_IN_PYso.Npre = len(IGABAA_IN_PYso.source)
IGABAA_IN_PYso.Npost = len(IGABAA_IN_PYso.target)
# IGABAA_IN_PYso.gGABAA = 0.0277 * b2.msiemens / b2.cm**2  # mS/cm^2 ### Default
IGABAA_IN_PYso.gGABAA = 0.1 * b2.msiemens / b2.cm**2  # mS/cm^2 ### Propofol
IGABAA_IN_PYso.EGABAA = -70 * b2.mV
IGABAA_IN_PYso.alpha = 1 / b2.ms
IGABAA_IN_PYso.tauGABAA = 5 * b2.ms
IGABAA_IN_PYso.deprFactor = 0.9
IGABAA_IN_PYso.tauRes = 400 * b2.ms
IGABAA_IN_PYso.radius = 10
IGABAA_IN_PYso.remove_recurrent_bool = True
IGABAA_IN_PYso.sGABAA = '0.0 + 0.1 * rand()' # Initial condition for sGABAA
IGABAA_IN_PYso.res_GABAA = '0.8 - 0.1 * rand()' # Initial condition for res
IGABAA_IN_PYso.tspikePre = dtStart * b2.ms

############################### GABAAergic synapse from IN to IN ############################

# Parameters
propoCondMult = 3
propoTauMult = 3

# Synapse equations
IGABAA_IN_IN_eqns = '''
normalizing_factor = clip((2 * radius + (1 - int(remove_recurrent_bool))) / (Npost / Npre), 0, Npre) : 1
iGABAA_IN_IN_post = -propoCondMult * gGABAA / normalizing_factor * (res_GABAA * sGABAA) * (v_post - EGABAA) : amp/meter**2 (summed)
dsGABAA/dt = alpha / (1 + exp(-(v_pre - 20 * mV) / (2 * mV))) - sGABAA / (tauGABAA * propoTauMult) : 1 (clock-driven)
dres_GABAA/dt = (1 - res_GABAA) / tauRes + int(timestep(t - tspikePre, dt) <= timestep(dtMult*dt, dt)) * (-(1 - res_GABAA) / tauRes + (deprFactor * res_GABAA - res_GABAA) / dt) : 1 (clock-driven)
tspikePre : second  # pre-synaptic spike times
Npre : 1
Npost : 1
gGABAA : siemens/meter**2
EGABAA : volt
alpha : 1/second
tauGABAA : second
deprFactor : 1
tauRes : second
radius : 1
remove_recurrent_bool : boolean
'''

IGABAA_IN_IN = b2.Synapses(IN_group, IN_group, model=IGABAA_IN_IN_eqns, 
                           on_pre='''
                           tspikePre = t
                           ''', method='euler')

# Connectivity matrix
netcon6 = netcon_nearest_neighbors(2*Radius, len(IGABAA_IN_IN.source), len(IGABAA_IN_IN.target), Remove_Recurrent_Bool)

sources6, targets6 = netcon6.nonzero()

IGABAA_IN_IN.connect(i=sources6, j=targets6)

#Initial conditions
IGABAA_IN_IN.Npre = len(IGABAA_IN_IN.source)
IGABAA_IN_IN.Npost = len(IGABAA_IN_IN.target)
IGABAA_IN_IN.gGABAA = 0.000825 * b2.msiemens / b2.cm**2
IGABAA_IN_IN.EGABAA = -70 * b2.mV
IGABAA_IN_IN.alpha = 1 / b2.ms
IGABAA_IN_IN.tauGABAA = 5 * b2.ms
IGABAA_IN_IN.deprFactor = 0.9
IGABAA_IN_IN.tauRes = 400 * b2.ms
IGABAA_IN_IN.radius = 10
IGABAA_IN_IN.remove_recurrent_bool = True
IGABAA_IN_IN.sGABAA = '0.0 + 0.1 * rand()' # Initial condition for sGABAA
IGABAA_IN_IN.res_GABAA = '0.8 - 0.1 * rand()' # Initial condition for res
IGABAA_IN_IN.tspikePre = dtStart * b2.ms

Above code is the snippet of four synapses from my complete code. When I remove res_AMPA and res_NMDA variables from the first three synapses, I get exactly same raster plot as the Dynasim but when I remove them then I get different raster plot and different spike rates for all the cells. When I keep res_GABAA in the last synapse then I do not face such issue. So, it looks like when the number of pre and post synaptic cells are same then the ‘res’ variable works fine in the synapse but when they are different then it does not.

I would be glad if you could help me with this as I am not able to proceed further with the model for my project.

Hi @Volcanic_Neuron

I am afraid I do not quite understand this paragraph. When do you get the same raster plot and when do you not?

I did not analyze your code in detail, but I think the way you translate the pre-synaptic spike time is still an issue. There is only one tSpikePre for the post-synaptic neuron, so if inputs are coming in from multiple synapses, they will not integrate correctly. Actually, I think the best approach for your synapse model would be to not include the int(timestep...) term in the equations, but instead have a variable that is zero or one (or actually a value > 1 if there are several incoming synapses that fire at the same time). You’d then update this variable from the synapse with an “up” and a “down” pathway, where the latter has a 2dt delay in your case. See this code here: Winner Take All mechanism using lateral inhibition - #3 by mstimberg

Hope this helps, let me know if this approach is not entirely clear.

Thanks! @mstimberg. I have now incorporated your suggestions for the synapse model and getting somewhat similar results as mentioned in their paper. There are some small differences still there but I don’t know whether they are due to numerical differences between the two environments or due to some implementation issue in Brian2. For example the interneurons spike at a higher rate in brian2 compared to Dynasim for the wake condition. I have put the results in the next comments.

Below code is for the synapse model by incorporating your suggestions.

########################## GABA-Aergic synapse from IN to PYso #############################

# Parameters
propoCondMult = 1
propoTauMult = 1
time_step  = 0.01 * b2.ms
release_time = 2 * time_step

# Synapse equations
IGABAA_IN_PYso_eqns = '''
normalizing_factor = clip((2 * radius + (1 - int(remove_recurrent_bool))) / (Npost / Npre), 0, Npre) : 1
iGABAA_IN_PYso_post = -propoCondMult * gGABAA / normalizing_factor * (res_GABAA * sGABAA) * (v_post - EGABAA) : amp/meter**2 (summed)
dsGABAA/dt = alpha / (1 + exp(-(v_pre - 20 * mV) / (2 * mV))) - sGABAA / (tauGABAA * propoTauMult) : 1 (clock-driven)
# dres_GABAA/dt = (1 - res_GABAA) / tauRes : 1 (clock-driven)
dres_GABAA/dt = (1 - res_GABAA) / tauRes + spike_activity * (-(1 - res_GABAA) / tauRes + (deprFactor * res_GABAA - res_GABAA) / dt) : 1 (clock-driven)
# dres_GABAA/dt = (1 - res_GABAA) / tauRes + int(t - tspikePre <= dtMult*dt) * (-(1 - res_GABAA) / tauRes + (deprFactor * res_GABAA - res_GABAA) / dt) : 1 (clock-driven)
# tspikePre : second  # pre-synaptic spike times
spike_activity : 1  # Tracks the state of incoming spikes at the synapse
Npre : 1
Npost : 1
gGABAA : siemens/meter**2
EGABAA : volt
alpha : 1/second
tauGABAA : second
deprFactor : 1
tauRes : second
radius : 1
remove_recurrent_bool : boolean
'''

IGABAA_IN_PYso = b2.Synapses(IN_group, PYso_group, model=IGABAA_IN_PYso_eqns,
                              on_pre={'up' : 'spike_activity += 1', 'down': 'spike_activity -=1'},
                              delay={'down': release_time}, method='euler')

# Connectivity matrix
netcon5 = netcon_nearest_neighbors(2*Radius, len(IGABAA_IN_PYso.source), len(IGABAA_IN_PYso.target), Remove_Recurrent_Bool)

sources5, targets5 = netcon5.nonzero()

IGABAA_IN_PYso.connect(i=sources5, j=targets5)

#Initial conditions
IGABAA_IN_PYso.Npre = len(IGABAA_IN_PYso.source)
IGABAA_IN_PYso.Npost = len(IGABAA_IN_PYso.target)
# IGABAA_IN_PYso.gGABAA = 0.0277 * b2.msiemens / b2.cm**2  # mS/cm^2 ### Default
IGABAA_IN_PYso.gGABAA = 0.1 * b2.msiemens / b2.cm**2  # mS/cm^2 ### Wakelike
IGABAA_IN_PYso.EGABAA = -70 * b2.mV
IGABAA_IN_PYso.alpha = 1 / b2.ms
IGABAA_IN_PYso.tauGABAA = 5 * b2.ms
IGABAA_IN_PYso.deprFactor = 0.9
IGABAA_IN_PYso.tauRes = 400 * b2.ms
IGABAA_IN_PYso.radius = 10
IGABAA_IN_PYso.remove_recurrent_bool = True
IGABAA_IN_PYso.sGABAA = '0.0 + 0.1 * rand()' # Initial condition for sGABAA
IGABAA_IN_PYso.res_GABAA = '0.8 - 0.1 * rand()' # Initial condition for res
IGABAA_IN_PYso.spike_activity = 0

I would like to know if this is the correct way to define the synapse model for my case now or some changes are required?

The complete code can be seen from here:
https://colab.research.google.com/drive/1vIb28fT6ANCAej2SvrXkp0vch4XrVvNT?usp=sharing

Following raster plot is from Brian2 for wake condition:

Following raster plot is from Dynasim for wake condition:

Apologies for multiple replies :slightly_smiling_face:, couldn’t help myself as being a new user I can’t put multiple embedding in a single reply/post.

Hi @Volcanic_Neuron. I won’t have the time to go through all the code in detail, but I noticed that in the first picture you posted, the “spike-detection function” is only used for AMPA and NMDA, whereas your code seems to use it for the GABAA synapses as well (instead of a continuous function of pre-synaptic membrane potential). Is this intentional?

I “upgraded” you to a “basic user” – hope it helps :blush:

Thanks for pointing that out @mstimberg, I was also confused about whether it is needed for GABAA synapses or not as the paper does not mention it, however the original paper from which they have adapted the mechanism includes this synaptic depression and the Dynasim code provided by the authors also include it. When I don’t include this for GABAA synapses then I get different results compared to what the authors claim to observe in their paper. So, I thought of including it in Brian2 also. While replicating this model I found other discrepancies like this also which I tried to sort out by looking at some other sources. So it seems like this might be also an error in their paper on their part. The implementation journey of this model in Brian2 made me learn that the authors should be very clear in their paper to ensure reproducibility and do good science. Thanks for helping me with it.

Much thanks :raised_hands: for upgrading me to basis user :smiley: .