我正在耦合两个具有双指数突触连接的霍奇金赫x黎神经元,耦合似乎是正确的,并且在突触前神经元尖峰之后,突触后神经元尖峰。但是问题在于突触后神经元由于未知原因而不会停止发射。
the pre-synaptic and post-synaptic voltage with pre-synaptic current
import numpy as np
import matplotlib.pyplot as plt
import time
def HHmodel(I,gSyn):
#holders
v = []
m = []
h = []
n = []
dt = 0.05
t = np.linspace(0,100,len(I))
Isyn = []
#constants
Cm = 1.0 #microFarad
ENa=50 #miliVolt
EK=-77 #miliVolt
El=-54 #miliVolt
g_Na=120 #mScm-2
g_K=36 #mScm-2
g_l=0.03 #mScm-2
Esyn = 4 #mScm-2
def alphaN(v):
return 0.01*(v+50)/(1-np.exp(-(v+50)/10))
def betaN(v):
return 0.125*np.exp(-(v+60)/80)
def alphaM(v):
return 0.1*(v+35)/(1-np.exp(-(v+35)/10))
def betaM(v):
return 4.0*np.exp(-0.0556*(v+60))
def alphaH(v):
return 0.07*np.exp(-0.05*(v+60))
def betaH(v):
return 1/(1+np.exp(-(0.1)*(v+30)))
#Initialize the voltage and the channels :
v.append(-60)
m0 = alphaM(v[0])/(alphaM(v[0])+betaM(v[0]))
n0 = alphaN(v[0])/(alphaN(v[0])+betaN(v[0]))
h0 = alphaH(v[0])/(alphaH(v[0])+betaH(v[0]))
#t.append(0)
m.append(m0)
n.append(n0)
h.append(h0)
#solving ODE using Euler's method:
for i in range(1,len(t)):
m.append(m[i-1] + dt*((alphaM(v[i-1])*(1-m[i-1]))-betaM(v[i-1])*m[i-1]))
n.append(n[i-1] + dt*((alphaN(v[i-1])*(1-n[i-1]))-betaN(v[i-1])*n[i-1]))
h.append(h[i-1] + dt*((alphaH(v[i-1])*(1-h[i-1]))-betaH(v[i-1])*h[i-1]))
gNa = g_Na * h[i-1]*(m[i-1])**3
gK=g_K*n[i-1]**4
gl=g_l
INa = gNa*(v[i-1]-ENa)
IK = gK*(v[i-1]-EK)
Il=gl*(v[i-1]-El)
if (gSyn.any()==0):
v.append(v[i-1]+(dt)*((1/Cm)*(I[i-1]-(INa+IK+Il))))
Isyn.append(0)
#print('sucks')
else:
#Isyn = -gSyn*(v[i-1]-Esyn)
Isyn.append(-gSyn[i-1]*(v[i-1]-Esyn))
v.append(v[i-1]+(dt)*((1/Cm)*(I[i-1]-(INa+IK+Il+Isyn[i-1]))))
#v.append(v[i-1]+(dt)*((1/Cm)*(I-(INa+IK+Il))))
return v,t,Isyn
#function to count the spikes and generate pre-synaptic current
def synapticCurrent(voltage,time):
spikes = []
for i in range(len(time)):
if (voltage[i-1]<0 and voltage[i]>0):
spikes.append(round(time[i],3))
else:
spikes.append(0)
tfinal = np.zeros(len(spikes))
if (len(spikes)>1):
t = np.arange(0,100,1)
for i in range(len(spikes)):
if (spikes[i]!= 0):
tfinal[i:i+100] = t
tRise = 1.5
tDecay = 2
gBar = 2
gSyn = -gBar*(1/tDecay-tDecay)*(np.exp(-(tfinal)/tDecay)-np.exp(-(tfinal)/tRise))
#Isyn = -gSyn*(voltage-Esyn)
return gSyn,spikes
offset = 6.4
dataset = 10000
standardDeviation = 3
pulsyCurrent = np.zeros(dataset)
pulsyCurrent[2000:2500] = 8
constantCurrent = 6.2*np.ones(dataset)
voltage1,time,Isyn1 = HHmodel(pulsyCurrent,np.zeros(dataset))
synapticCurrent1,spikes1 = synapticCurrent(voltage1,time)
voltage2,time,Isyn2 = HHmodel(constantCurrent,synapticCurrent1)
synapticCurrent2,spikes2 = synapticCurrent(voltage2,time)
#plt.plot(preSynaptic1)
plt.figure(figsize=(18,8))
plt.plot(time,voltage1,'r--',label='preSynaptic voltage');
plt.plot(time,voltage2,'g-.',label='postSynaptic voltage');
plt.plot(time[1::],Isyn2,'b--',label='synapticCurrent');
#plt.plot(time,preSynaptic1,'y');
plt.eventplot(spikes1[10::],colors='red',linelengths=2,linewidths=3,lineoffsets=-10);
plt.eventplot(spikes2[10::],colors='green',linelengths=2,linewidths=3,lineoffsets=10);
plt.legend(loc='upper left')
plt.show()
如果您发现问题,请告诉我。 对我来说,一切似乎都是正确的。