I am working with the code in Pashut et al 2011 to make a realistic 2-D model of TMS on a layer V pyramidal neuron. Right now, I am having trouble understanding how NEURON is calculating step functions in this loop:
Code: Select all
for ii = 0, nseg {
xr = range.x[ii]
xrf= range.x[ii+1]
//x_xtra(xr:xrf)=xint.x[ii]:xint.x[ii+1] //Removed x and y_xtra, they aren't being used
//x_xtra(xr:xrf)=int(xint.x[ii]):xint.x[ii+1] //[micrometer]
//y_xtra(xr:xrf)=yint.x[ii]:yint.x[ii+1]
XX_xtra(xr:xrf)=int(xint.x[ii]+XShift):int(xint.x[ii+1]+XShift) //[micrometer]
YY_xtra(xr:xrf)=int(yint.x[ii]+YShift):int(yint.x[ii+1]+YShift)
DX_xtra(xr:xrf)=xint.x[ii+1]-xint.x[ii]:xint.x[ii+1]-xint.x[ii] //[micrometer]
DY_xtra(xr:xrf)=yint.x[ii+1]-yint.x[ii]:yint.x[ii+1]-yint.x[ii]
//the value of the spatial part of the electric field in the direction of the cable
Exs_xtra(xr:xrf)=Ex.x[XX_xtra(xr)][YY_xtra(xr)]:Ex.x[XX_xtra(xrf)][YY_xtra(xrf)]
Eys_xtra(xr:xrf)=Ey.x[XX_xtra(xr)][YY_xtra(xr)]:Ey.x[XX_xtra(xrf)][YY_xtra(xrf)]
//The spatial derivative of the above value. This is required
//in order to transform the axial current I=E*X/ri to the membrane
//current we will inject via the MOD file since, acording to cable
//theory i_m=-dI/dx. Units are [V ms/m A microm]. This is
//the derivative per unit length.
BB=((Ex.x[int(xint.x[ii+1]+XShift)][int(yint.x[ii+1]+YShift)] - Ex.x[int(xint.x[ii]+XShift)][int(yint.x[ii]+YShift)])*DX_xtra(xr) + (Ey.x[int(xint.x[ii+1]+XShift)][int(yint.x[ii+1]+YShift)] - Ey.x[int(xint.x[ii]+XShift)][int(yint.x[ii]+YShift)])*DY_xtra(xr))/(DX_xtra(xr)^2+DY_xtra(xr)^2)
DEDA_xtra(xr:xrf)=BB:BB
Code: Select all
range = new Vector(nseg+2)
range.indgen(1/nseg)
range.sub(1/(2*nseg))
range.x[0]=0
range.x[nseg+1]=1
However, when I printed out the values of the parameters defined in the loop, even though the first loop is meant to define values from x = 0 to x = .166667, in reality it defines values from x = 0 to x = .333, the end of first section. So instead of midpoints, the step function for all these parameters change values at points where segments change. Am I missing something? How can I fix this loop to define values for midpoints?
Thank you,
Dehan