Finding middle of a section
Posted: Sat Jan 11, 2020 5:50 pm
Hi! I am currently working on an algorithm for finding the min. current needed to produce an action potential using extracellular stimulation and the MRG axon as my model. I used h.APCount(<insert section name>(0.5)) to monitor whether the voltage in the middle of my sections crosses a certain threshold. However, I noticed I was getting varying results depending on the method I use to determine the coordinates of the middle of my sections (which I need in order to determine their distance from the current source and thus the voltage to be assigned to that section's e_extracellular). For example, when I use this method:
I get 2.1 mA for my current threshold (min. current necessary for an AP). Whereas when I use this method:
I get 3.1 mA for my current threshold even though the distances are extremely similar. Finally, when I try using x_xtra, y_xtra, and z_xtra to find the midpoints, my apc's (APCount) find no action potentials occured even for large current ranges (e.g. 0 - 100 mA). My question then is which of these corresponds to the true middle of a section (sec(0.5))?
Code: Select all
if (sec.n3d() % 2 == 0):
midUp = sec.n3d() / 2
midDown = midUp - 1
secCoor = Point((sec.x3d(midUp) + sec.x3d(midDown)) / 2e3, (sec.y3d(midUp) + sec.y3d(midDown)) / 2e3, (sec.z3d(midUp) + sec.z3d(midDown)) / 2e3)
else:
mid = sec.n3d() / 2
secCoor = Point(sec.x3d(mid) / 1e3, sec.y3d(mid) / 1e3, sec.z3d(mid) / 1e3)
r = calcDistance(source, secCoor)
Code: Select all
xSum = 0
ySum = 0
zSum = 0
for i in range(sec.n3d()):
xSum += sec.x3d(i)
ySum += sec.y3d(i)
zSum += sec.z3d(i)
return Point(float(xSum) / sec.n3d(), float(ySum) / sec.n3d(), float(zSum) / sec.n3d())