Page 1 of 1

### Record current

Posted: Tue Oct 01, 2013 2:34 pm
Hello,

I would like to record current flowing through a segment. For example, how can I get the total current at soma(0.5)? I tried to look around but couldn't find a single command that would do that.

My understanding is that there’s no way to do that other than summing up currents for the different conductances. So if one has, say, conductances CaHVA, Na_TST and i_Kv3p1, one would literally need to sum up i_CaHVA, i_Na_TST, and i_Kv3p1, plus the leak current and capacitive current. Is that right? But that seems to be prone to problems -- for example, what if a user wants to change conductances? Then the equation for computing the total current would have to be changed too.

I was hoping there is a built-in function to get that sum in just one statement, but couldn’t find anything like that.

I guess one can also use a voltage clump and compute the current using something like vclamp.i, but that will affect the dynamics of the cell.

Many thanks,

Anton.

### Re: Record current

Posted: Wed Oct 02, 2013 8:47 pm
Insert extracellular. That makes i_membrane availabe. Example:
dend[23] print i_membrane(0.5)
reports total membrane current density in the segment of dend[23] that contains 0.5.
Remember, units will be in mA/cm2, so if you want net current in absolute units you must multiply by segment area. Example:
dend[23] print i_membrane(0.5)*area(0.5)/100
reports net current in nA (area() returns segment area in um2, which is why the 1/100 scale factor is needed).

### Re: Record current

Posted: Thu Oct 03, 2013 2:34 pm
Thank you, Ted. I'll try extracellular. However, wouldn't that slow down the simulation? What if I need to simulate many neurons (100, 1,000, or maybe even more) and need to measure somatic transmembrane current for each? How much of a slow-down would you anticipate then in comparison with the same simulation without extracellular?

Thanks,

Anton.

### Re: Record current

Posted: Thu Oct 03, 2013 4:23 pm
antoncom wrote:wouldn't that slow down the simulation?
Try it and find out. Then try whatever other alternative you can think of and see which is faster. Bet you a nickel the alternatives are slower.

### Re: Record current

Posted: Sun Jan 19, 2014 9:25 am
If I want to record the current passing from 1 segment to the other. Is it possible?
Example: I have a dendrite with 3 segments, And I want to know how to record the current the 2th segment received from the 3rd segment and the current the 2nd segment received from the 1th segments.

-[1] - [2] - [3]- <-- to record the current the 2nd segment receive from 1 in Vec1 and from 2 in Vec2

### Re: Record current

Posted: Mon Jan 20, 2014 1:10 am
Find the membrane potential at adjacent internal nodes, find the axial resistance that separates them (read about hoc's function ri in the Programmer's Reference), and divide the voltage difference by ri. The result will be in mV/megohm = nA. If you want the time course of the axial current between two nodes, you'll need to record their membrane potentials.

Here are some code snippets that may help:

Code: Select all

``````// returns a List of Vectors that record membrane potential
// at the internal nodes of the currently accessed section
obfunc makevreclist() { localobj tobj, vrl
vrl = new List()
for (x,0) { // iterate over internal nodes
tobj = new Vector()
tobj.record(&v(x))
vrl.append(tobj)
}
return vrl
}
// usage example
objref vl
dend vl = makevreclist()``````

Code: Select all

``````// returns a Vector whose elements are the axial resistances
// between each internal node of the currently accessed section
// and its parent node
obfunc makerivec() { localobj tobj
finitialize() // ensure that everything that depends on geometry
// has been calculated
tobj = new Vector()
for (x,0) { // iterate over internal nodes
tobj.append(ri(x)) // axial resistance in megohms
// between node at x and parent node
}
}
// usage example
objref rivec
dend rivec = makerivec()``````

Code: Select all

``````// returns a List of Vectors that contain the time course of the axial currents
// between adjacent nodes in the currently accessed section
// \$o1 is a List of Vectors that contain the time course of v
// at the internal nodes of the currently accessed section
// \$o2 is a Vector of the axial resistances between these nodes
// and their parent nodes
// returns an empty List if the section has only one internal node
obfunc calciax() { local ii  localobj tobj, ixl
ixl = new List()
if (nseg>1) {
for ii=0,\$o1.count()-2 {
tobj=\$o1.o(ii).c // v at the upstream node
tobj.sub(\$o1.o(ii+1)).div(\$o2.x[ii+1])
ixl.append(tobj)
}
}
return ixl
}
// usage example
objref iaxl
dend iaxl = calciax(vl, rivec)``````
This zip fie https://www.neuron.yale.edu/ftp/ted/neuron/iaxial.zip contains a demonstration of these procedures that shows the time course of axial currents along a dendrite in a ball and stick model with passive membrane. Use NEURON to execute init.hoc, then click on Init & Run.

### Re: Record current

Posted: Tue Jun 10, 2014 12:44 pm
Thank You Ted, It works great.
If anyone ever needs.
This is my solution for recording the current thats going from the soma to the dendrites.

(I assume the soma is 1 segment)

Code: Select all

``````objref s1, childVolts, childri, somaV

childVolts = new List()
childri = new Vector()
somaV = new Vector()

s1 = new SectionList()
soma s1.children()
soma somaV.record(&v(0.5))
ind=0
forsec s1 {
childVolts.append(new Vector())
childVolts.o(ind).record(&v(0.1)) // How do I make sure I access the first segment?
childri.append(ri(0.1))
ind = ind+1
}

objref ixl, tobj
ixl = new List()

for ii=0,childVolts.count()-1{
tobj = somaV.c
tobj.sub(childVolts.o(ii)).div(childri.x[ii])
ixl.append(tobj)
}``````
object ixl should contain all the currents Vectors.

Ted, Do you think my solution is correct?

Thank You,
Oren.

### Re: Record current

Posted: Wed Jun 11, 2014 1:19 am
Here's a little trick for discovering the name of the membrane potential at the first internal node of a section: if nseg is < 1000, just call it secname.v(0.001). The result returned will be the value of v at the sections first internal node.

Now for the rest of your code.

You have the general idea, but there's a potential problem. Consider this example:

Code: Select all

``````create soma, dend[2]
access soma
for i=0,1 connect dend[i](0), soma(1)``````
Both dendrites are attached to the 1 end of soma. soma.v(0.5) can't be used to calculate the current that enters one dend, because the voltage drop from soma(0.5) to soma(1) is contaminated by the current that enters the other dend.

Instead, you could calculate the current that enters dend[0] from the difference between soma.v(1) and dend[0].v(0.001), and do something similar for dend[1]. But if some child branches are attached to soma(0), others to soma(0.5), and yet others to soma(1), it's safest to do this (in very rough pseudocode):

Code: Select all

``````for each section whose parent is soma
record v(0) and v(0.001) to vectors // call these vvec0 and vvec1``````
After the run is complete,

Code: Select all

``````for each section whose parent is soma
calculate vvec0 - vvec1
divide that result by ri(0.001)``````
Suggest you try this with a very simple model--a soma with two child dendrites. Make the child dendrites different diameters so they don't produce identical results.