Hi,
I wonder if it is possible to record the internal axial current between two compartment/segment? For instance, I want to record all the current sources in the soma, and I can have soma.ina, soma.ik, etc to record all types of ionic current, but I do not know how to record the axial current flowing into the soma from the adjacent dendrites. Could anyone help to answer it? Many thanks!
recording axial current

 Site Admin
 Posts: 5885
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: recording axial current
Record the membrane potential at the centers of the two compartments.
After the end of the simulation, calculate the axial current from Ohm's law.
Hint: the axial resistance between two adjacent compartments is given by the hoc function ri(). Example:
Suppose dend has nseg = 3, and you want to know the axial current between the middle segment and the last segment in dend. The segment centers are located at dend(0.5) and dend(5/6), so this statement
dend print ri(5/6)
will print the axial resistance between their centers. If you recorded the membrane potentials at 0.5 and 5/6 to vectors called v1 and v2, respectively, the axial current can be calculated by executing these three statements
objref iax
iax = new Vector()
dend iax.c(v1).sub(v2).div(ri(5/6))
after the end of a simulation.
Note that iax will be in nanoamperes, because membrane potential is in mV and ri is in megohms.
Be sure to read the Programmer's Reference entries about ri and the Vector class's c, sub, and div methods.
After the end of the simulation, calculate the axial current from Ohm's law.
Hint: the axial resistance between two adjacent compartments is given by the hoc function ri(). Example:
Suppose dend has nseg = 3, and you want to know the axial current between the middle segment and the last segment in dend. The segment centers are located at dend(0.5) and dend(5/6), so this statement
dend print ri(5/6)
will print the axial resistance between their centers. If you recorded the membrane potentials at 0.5 and 5/6 to vectors called v1 and v2, respectively, the axial current can be calculated by executing these three statements
objref iax
iax = new Vector()
dend iax.c(v1).sub(v2).div(ri(5/6))
after the end of a simulation.
Note that iax will be in nanoamperes, because membrane potential is in mV and ri is in megohms.
Be sure to read the Programmer's Reference entries about ri and the Vector class's c, sub, and div methods.
Re: recording axial current
Hi Ted,
I have a (very) simple followup question about this. If I am interested in axial current flowing from a dendrite (nseg=3) to the soma (nseg =1) is it just a matter of:
1) record voltage at soma(0.5) and dendrite(1/6)
2) get Ri at dendrite(1/6)  (I understand this is calculated at the parent end of the segment...)
3) get current by Ohms law as per your post above
Thanks in advance
I have a (very) simple followup question about this. If I am interested in axial current flowing from a dendrite (nseg=3) to the soma (nseg =1) is it just a matter of:
1) record voltage at soma(0.5) and dendrite(1/6)
2) get Ri at dendrite(1/6)  (I understand this is calculated at the parent end of the segment...)
3) get current by Ohms law as per your post above
Thanks in advance

 Site Admin
 Posts: 5885
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: recording axial current
Yes. If you follow the usual conventions for model constructionasb wrote:If I am interested in axial current flowing from a dendrite (nseg=3) to the soma (nseg =1) is it just a matter of:
1) record voltage at soma(0.5) and dendrite(1/6)
2) get Ri at dendrite(1/6)  (I understand this is calculated at the parent end of the segment...)
(treat the soma as the root section of the entire cell (i.e. the section that has no parent,
connect the 0 end of any child section to its parent section)
then, given that dendrite.nseg is 3, the current between dendrite's nodes at 0 and 1/6 will indeed be the same as the current that passes between dendrite and soma.
Here's a suggestion: instead of referring to ri(1/6) and dendrite.v(1/6), take advantage of the fact that
rangevar(range)
refers to the value of rangevar at the _internal_ node closest to range. This means that
dendrite.v(1e3)
and
ri(1e3)
refer to the membrane potential at the first internal node of dendrite
and
the axial resistance between the first internal node of dendrite and dendrite's 0 end, as long as dendrite.nseg is < 500 (a reasonable assumption in most cases). This means your code will work as you expect it to as long as dendrite.nseg is < 500.
Re: recording axial current
Thanks Ted  much appreciated

 Posts: 8
 Joined: Wed Oct 31, 2018 2:03 pm
Re: recording axial current
ted wrote: ↑Wed Oct 16, 2013 7:26 pm Record the membrane potential at the centers of the two compartments.
After the end of the simulation, calculate the axial current from Ohm's law.
Hint: the axial resistance between two adjacent compartments is given by the hoc function ri(). Example:
Suppose dend has nseg = 3, and you want to know the axial current between the middle segment and the last segment in dend. The segment centers are located at dend(0.5) and dend(5/6), so this statement
dend print ri(5/6)
will print the axial resistance between their centers. If you recorded the membrane potentials at 0.5 and 5/6 to vectors called v1 and v2, respectively, the axial current can be calculated by executing these three statements
objref iax
iax = new Vector()
dend iax.c(v1).sub(v2).div(ri(5/6))
after the end of a simulation.
Note that iax will be in nanoamperes, because membrane potential is in mV and ri is in megohms.
Be sure to read the Programmer's Reference entries about ri and the Vector class's c, sub, and div methods.
Hi Ted, thanks for all your help.
Is there a way to write a code for these in a mod file?
I am trying to measure the axial current between every segment in an object.
What is the best way to approach this?
Thanks again!

 Site Admin
 Posts: 5885
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: recording axial current
Nope. hoc or Python. The example in my old post is in hoc.Is there a way to write a code for these in a mod file?
How do you plan to deal with branch points? The notion of "axial current between every segment" breaks down at branch points.I am trying to measure the axial current between every segment in an object.