Description of problem
I am trying to convert the code from brian1 to brian2, related to the paper
“A computational model of Major Depression: The role of glutamate dysfunction on cingulo-frontal network dynamics” Ramirez-Mahaluf J.P., Roxin A., Mayberg H.S. and Compte A. Cerebral Cortex, 2015
Minimal code to reproduce problem
NE=800
NI=200
#Biophysical parameters
tauav = 2*ms
tauad = 2*ms # tau AMPA decay on dlPFC
taun = 100*ms # tau NMDA decay
taux = 2*ms # tau NMDA rise
taug = 10*ms # tau GABA decay
Vt =-50*mvolt # spike threshold
Vr =-55*mvolt # reset value
Elv =-70*mvolt
El =-70*mvolt
refE= 2*ms # refractory periods piramidal cell
refI= 1*ms # refractory period inhibitory cell
cmE= 500*pF #capacitance piramidal cel
cmI= 200*pF #capacitance interneuron
tauE =20*ms #tau piramidal cel
tauI =10*ms #tau interneuron
alpha =0.5*kHz
S=1
N=800/NE # Factor for rescaling the weights according to the number of neurons
#Connection parameters
wgEEN = 0.001761*(1/S)*N #weight excitatory to excitatory through NMDA
wgEEA = 0.0009454*(1/S)*N #weight excitatory to excitatory through AMPA
wgEIN = 0.0012*(1/S)*N #weight excitatory to inhibitory through NMDA
wgEIA = 0.0004*(1/S)*N #weight excitatory to inhibitory through AMPA
wgIEG = 0.005*(1/S)*N #weight inhibitory to excitatory through GABA
wgIIG = 0.004865*(1/S)*N #weight inhibitory to inhibitory through GABA
wgEIA1 = 0.0004*(1/S)*N #weight vACC excitatory to dlPFC inhibitory through NMDA
wgEIA2 = 0.0004*(1/S)*N #weight dlPFC excitatory to vACC excitatory through NMDA
#equations excitatory cell vACC
eqsE1 = '''
dV/dt = (-gea*V-gen*V/(1+exp(-V/Ven)/3.57)-gi*(V+70*mV)-(V-Elv))/(tauE) : volt
dgea/dt = -gea/(tauav) : 1
dgi/dt = -gi/(taug) : 1
dspre/dt = -spre/(taun)+alpha*xpre*(1-spre) : 1
dxpre/dt = -xpre/(taux) : 1
gen: 1
'''
#equations inhibitory cell vACC
eqsI1 = '''
dV/dt = (-gea*V-gen*V/(1+exp(-V/Ven)/3.57)-gi*(V+70*mV)-(V-El))/(tauI) : volt
dgea/dt = -gea/(tauav) : 1
dgi/dt = -gi/(taug) : 1
dspre/dt = -spre/(taun)+alpha*xpre*(1-spre) : 1
dxpre/dt = -xpre/(taux) : 1
gen: 1
'''
#equations excitatory cell dlPFC
eqsE2 = '''
dV/dt = (-gea*V-gen*V/(1+exp(-V/Ven)/3.57)-gi*(V+70*mV)-(V-El))/(tauE) : volt
dgea/dt = -gea/(tauad) : 1
dgi/dt = -gi/(taug) : 1
dspre/dt = -spre/(taun)+alpha*xpre*(1-spre) : 1
dxpre/dt = -xpre/(taux) : 1
gen: 1
'''
#equations inhibitory cell dlPFC
eqsI2 = '''
dV/dt = (-gea*V-gen*V/(1+exp(-V/Ven)/3.57)-gi*(V+70*mV)-(V-El))/(tauI) : volt
dgea/dt = -gea/(tauad) : 1
dgi/dt = -gi/(taug) : 1
dspre/dt = -spre/(taun)+alpha*xpre*(1-spre) : 1
dxpre/dt = -xpre/(taux) : 1
gen: 1
'''
#Populations of neurons:
Pev = NeuronGroup(NE, model= eqsE1, threshold=Vt, reset= Vr, refractory=refE) #vACC excitatory neurons
Piv = NeuronGroup(NI, model= eqsI1, threshold=Vt, reset= Vr, refractory=refI) #vACC inhibitory neurons
Ped = NeuronGroup(NE, model= eqsE2, threshold=Vt, reset= Vr, refractory=refE) #dlPFC excitatory neurons
Pid = NeuronGroup(NI, model= eqsI2, threshold=Vt, reset= Vr, refractory=refI) #dlPFC inhibitory neurons
#Connection NMDA:
selfnmda_v = IdentityConnection(Pev, Pev, 'xpre', weight=1.0) #NMDA connections, excitatory to excitatory neurons in vACC
selfnmda_d = IdentityConnection(Ped, Ped, 'xpre', weight=1.0) #NMDA connections, excitatory to excitatory neurons in dlPF
#Connections AMPA and GABA:
Ceeav = Connection(Pev, Pev, 'gea', structure='dense') #AMPA connections, excitatory to excitatory neurons in vACC
Ceiav = Connection(Pev, Piv, 'gea', structure='dense') #AMPA connections, excitatory to inhibitory neurons in vACC
Ciev = Connection(Piv, Pev, 'gi', structure='dense') # GABA connections, inhibitory to excitatory neurons in vACC
Ciiv = Connection(Piv, Piv, 'gi', structure='dense') # GABA connections, excitatory to excitatory neurons in vACC
Ceead = Connection(Ped, Ped, 'gea', structure='dense')#AMPA connections, excitatory to excitatory neurons in dlPFC
Ceiad = Connection(Ped, Pid, 'gea', structure='dense') #AMPA connections, excitatory to inhibitory neurons in dlPFC
Cied = Connection(Pid, Ped, 'gi', structure='dense')# GABA connections, inhibitory to excitatory neurons in dlPFC
Ciid = Connection(Pid, Pid, 'gi', structure='dense')# GABA connections, excitatory to excitatory neurons in dlPFC
Ceiav1 = Connection(Pev, Pid, 'gea' )#AMPA connections, excitatory neurons in vACC target inhibitory neurons in dlPFC
Ceiad1 = Connection(Ped, Piv, 'gea' )#AMPA connections excitatory neurons in dlPFC target inhibitory neurons in vACC
Ceeav.connect_random(Pev, Pev, S, weight=wgEEA) #AMPA connections, excitatory to excitatory neurons in vACC
Ceiav.connect_random(Pev, Piv, S, weight=wgEIA) #AMPA connections, excitatory to inhibitory neurons in vACC
Ciev.connect_random(Piv, Pev, S, weight=wgIEG) # GABA connections, inhibitory to excitatory neurons in vACC
Ciiv.connect_random(Piv, Piv, S, weight=wgIEG) # GABA connections, excitatory to excitatory neurons in vACC
Ceead.connect_random(Ped, Ped, S, weight=wgEEA) #AMPA connections, excitatory to excitatory neurons in dlPFC
Ceiad.connect_random(Ped, Pid, S, weight=wgEIA) #AMPA connections, excitatory to inhibitory neurons in dlPFC
Cied.connect_random(Pid, Ped, S, weight=wgIEG) # GABA connections, inhibitory to excitatory neurons in dlPFC
Ciid.connect_random(Pid, Pid, S,weight=wgIIG) # GABA connections, excitatory to excitatory neurons in dlPFC
Ceiav1.connect_random(Pev, Pid, S, weight=wgEIA1) #AMPA connections, excitatory neurons in vACC target inhibitory neurons in dlPFC
Ceiad1.connect_random(Ped, Piv, S, weight=wgEIA2) #AMPA connections excitatory neurons in dlPFC target inhibitory neurons in vACC
#NMDA synapses
E_nmda_v = asarray(Pev.spre)
E_nmda_d = asarray(Ped.spre)
E_gen_v = asarray(Pev.gen)
E_gen_d = asarray(Ped.gen)
I_gen_v = asarray(Piv.gen)
I_gen_d = asarray(Pid.gen)
#Calculate NMDA contributions
@network_operation(when='start')
def update_nmda():
E_gen_v[:] = wgEEN/wgEEA * numpy.dot(E_nmda_v,Ceeav.W)
I_gen_v[:] = wgEIN/wgEIA * numpy.dot(E_nmda_v,Ceiav.W)
E_gen_d[:] = wgEEN/wgEEA * numpy.dot(E_nmda_d,Ceead.W)
I_gen_d[:] = wgEIN/wgEIA * numpy.dot(E_nmda_d,Ceiad.W)
#External noise:
extinput1E=PoissonGroup(NE,rates=1800*Hz)
extinput1I=PoissonGroup(NI,rates=1800*Hz)
input1_coE=IdentityConnection(extinput1E,Pev,'gea',weight=0.082708)
input1_coI=IdentityConnection(extinput1I,Piv,'gea',weight=0.081)
extinput2E=PoissonGroup(NE,rates=1800*Hz)
extinput2I=PoissonGroup(NI,rates=1800*Hz)
input2_coE=IdentityConnection(extinput2E,Ped,'gea',weight=0.082708)
input2_coI=IdentityConnection(extinput2I,Pid,'gea',weight=0.081)
#run
run(100*second)
What you have aready tried
Pev = NeuronGroup(NE, model= eqsE1, threshold=Vt, reset= Vr, refractory=refE) #vACC excitatory neurons
Piv = NeuronGroup(NI, model= eqsI1, threshold=Vt, reset= Vr, refractory=refI) #vACC inhibitory neurons
Ped = NeuronGroup(NE, model= eqsE2, threshold=Vt, reset= Vr, refractory=refE) #dlPFC excitatory neurons
Pid = NeuronGroup(NI, model= eqsI2, threshold=Vt, reset= Vr, refractory=refI) #dlPFC inhibitory neurons
selfnmda_v = Synapses(Pev, Pev, on_pre='xpre += 1.0')
selfnmda_v.connect(j='i')
selfnmda_d = Synapses(Ped, Ped, on_pre='xpre += 1.0')
selfnmda_d.connect(j='i')
Ceeav = Synapses(Pev, Pev, on_pre='gea += wgEEA') #AMPA connections, excitatory to excitatory neurons in vACC
Ceiav = Synapses(Pev, Piv, on_pre='gea += wgEIA') #AMPA connections, excitatory to inhibitory neurons in vACC
Ciev = Synapses(Piv, Pev, on_pre='gi += wgIEG') # GABA connections, inhibitory to excitatory neurons in vACC
Ciiv = Synapses(Piv, Piv, on_pre='gi += wgIIG') # GABA connections, excitatory to excitatory neurons in vACC
Ceead = Synapses(Ped, Ped, on_pre='gea += wgEEA')#AMPA connections, excitatory to excitatory neurons in dlPFC
Ceiad = Synapses(Ped, Pid, on_pre='gea += wgEIA') #AMPA connections, excitatory to inhibitory neurons in dlPFC
Cied = Synapses(Pid, Ped, on_pre='gi += wgIEG')# GABA connections, inhibitory to excitatory neurons in dlPFC
Ciid = Synapses(Pid, Pid, on_pre='gi += wgIIG')# GABA connections, excitatory to excitatory neurons in dlPFC
Ceiav1 = Synapses(Pev, Pid, on_pre='gea += wgEIA1')#AMPA connections, excitatory neurons in vACC target inhibitory neurons in dlPFC
Ceiad1 = Synapses(Ped, Piv, on_pre='gea += wgEIA2' )#AMPA connections excitatory neurons in dlPFC target inhibitory neurons in vACC
Ceeav.connect(p=S)
Ceiav.connect(p=S)
Ciev.connect(p=S)
Ciiv.connect(p=S)
Ceead.connect(p=S)
Ceiad.connect(p=S)
Cied.connect(p=S)
Ciid.connect(p=S)
Ceiav1.connect(p=S)
Ceiad1.connect(p=S)
#NMDA synapses
E_nmda_v = asarray(Pev.spre)
E_nmda_d = asarray(Ped.spre)
E_gen_v = asarray(Pev.gen)
E_gen_d = asarray(Ped.gen)
#I_gen_v = asarray(Piv.gen)
#I_gen_d = asarray(Pid.gen)
I_gen_v = asarray(Pev.gen)
I_gen_d = asarray(Ped.gen)
#Calculate NMDA contributions
@network_operation(when='start')
def update_nmda():
E_gen_v[:] = wgEEN/wgEEA * numpy.dot(E_nmda_v,wgEEA)
I_gen_v[:] = wgEIN/wgEIA * numpy.dot(E_nmda_v,wgEIA)
E_gen_d[:] = wgEEN/wgEEA * numpy.dot(E_nmda_d,wgEEA)
I_gen_d[:] = wgEIN/wgEIA * numpy.dot(E_nmda_d,wgEIA)
#External noise:
extinput1E=PoissonGroup(NE,rates=1800*Hz)
extinput1I=PoissonGroup(NI,rates=1800*Hz)
input1_coE=Synapses(extinput1E,Pev,on_pre='gea += 0.082708')
input1_coE.connect(j='i')
input1_coI=Synapses(extinput1I,Piv,on_pre='gea += 0.081')
input1_coI.connect(j='i')
extinput2E=PoissonGroup(NE,rates=1800*Hz)
extinput2I=PoissonGroup(NI,rates=1800*Hz)
input2_coE=Synapses(extinput2E,Ped,on_pre='gea += 0.082708')
input2_coE.connect(j='i')
input2_coI=Synapses(extinput2I,Pid,on_pre='gea += 0.081')
input2_coI.connect(j='i')
Expected output (if relevant)
The model is running. But it gives the similar kind of results when the NMDA synaptic strength is set to zero which shouldn’t happen. I want to be sure my update_nmda change is right becuase i think that might be the issue.
Thanks,
Selva