I'm having issues trying to use extracellular stimulation on a single unmyelinated axon. For the moment I'm computing the electric field along the axon induced by a stimulating electrode delivering a pulse stimulation, in a near future I will use fem simulation to get this field.
I want to set these computed values into e_extracellular. I have seen some examples about this method but when I plot the values set into e_extracellular I have something incoherent (all values are zeros).
Is there something I missed with the play method?
I use the following code
Code: Select all
def set_extra_stim(self,xe,ye,ze,sigma,tpulse,ttot):
#xe,ye,ze are the position of the stimulation electrode
#tpulse is the high time of the pulse
#ttot the total time of the stimulation
deltat = 0.01 #timestep
tdelay=5 #pulse start at 5 ms
i=0
v_ext=[]
v_e=[]
t_ext = neuron.h.Vector(np.arange(ttot/deltat)*deltat)
i0=[]
time=0
#create a single pulse as stimulus
for k in range(int(ttot/deltat)):
if time<tdelay or time>tdelay+tpulse:
time=time+deltat
i0.append(0)
else:
i0.append(-10)
time=time+deltat
for sec in self.allseclist: #list of all the sections
for seg in sec:
V0=[]
r=math.sqrt((self.x-xe)**2+(self.y-ye)**2+(self.z[i]-ze)**2) #compute distance from the electrode
for j in range(len(i0)):
V0.append(i0[j]/(4*math.pi*sigma*r)) #calculate the potential along the axon
v_ext.append(h.Vector(V0))
vstim=h.Vector(V0)
v_e.append(V0)
i=i+1
vstim.play(seg._ref_e_extracellular, t_ext)
Kind regards