equivalent resistance through terminals to soma

NMODL and the Channel Builder.
Post Reply
einsinghaf
Posts: 11
Joined: Tue Jun 17, 2014 2:23 pm

equivalent resistance through terminals to soma

Post by einsinghaf »

Hi there
Is there any build in function in NEURON that can measure the equivalent resistance through terminals to soma?
else where is it possible to know the whole path through dendtites?
what is the problem with my code?

Code: Select all

soma a=ri(0.5)
print a
soma scrf = new SectionRef()
if (scrf.nchild != 0) soma s1.children()
forsec s1 {
	a=a+ri(0.5)
	print a
	scrf1 = new SectionRef()
	if (scrf1.nchild != 0) s2.children()
	forsec s2 {
		a=a+ri(0.5)
		print a
		scrf2 = new SectionRef()
		if (scrf2.nchild != 0) s3.children()
		s3.children()
		forsec s3 {
			a=a+ri(0.5)
			print a
			scrf3 = new SectionRef()
			if (scrf3.nchild != 0) s4.children()
			s4.children()
			forsec s4 {
				a=a+ri(0.5)
				print a					
			}
		}
		
	}
}
of course I know about the transfer impedance, but I dont know their relationship with equivalent resistors :(

Code: Select all

objref zz
zz = new Impedance()

FREQ = 0 
WHERE = 0.5 

soma distance(0, WHERE) 
soma zz.loc(WHERE)
zz.compute(FREQ, 1)
forall {
distance(x)
zz.transfer(x)
}
einsinghaf
Posts: 11
Joined: Tue Jun 17, 2014 2:23 pm

Re: equivalent resistance through terminals to soma

Post by einsinghaf »

Finally I write this stupid code:(

Code: Select all


objref tree
tree = new SectionList()
soma tree.wholetree()
objref terminals, thisone
terminals = new SectionList()
forsec tree {
thisone = new SectionRef()
if (thisone.nchild == 0) terminals.append()
}
objref thisone // destroy link between thisone and the last referenced section
objref vec
vec = new Vector(500)
objref par1,par2,par3,par4,par5,par6,par7,par8,par9,par10,par11,par12,par13,par14,par15,par16,par17,par18,par19
par1 = new SectionList()
par2 = new SectionList()
par3 = new SectionList()
par4 = new SectionList()
par5 = new SectionList()
par6 = new SectionList()
par7 = new SectionList()
par8 = new SectionList()
par9 = new SectionList()
par10 = new SectionList()
par11 = new SectionList()
par12 = new SectionList()
par13 = new SectionList()
par14 = new SectionList()
par15 = new SectionList()
par16 = new SectionList()
par17 = new SectionList()
par18 = new SectionList()
par19 = new SectionList()
objref termref,par1ref,par2ref,par3ref,par4ref,par5ref,par6ref,par7ref,par8ref,par9ref,par10ref,par11ref,par12ref,par13ref,par14ref,par15ref,par16ref,par17ref,par18ref,par19ref
i=0
forsec terminals {
print "term=",secname()
termref = new SectionRef()
i=i+1
vec.x[i]=ri(.5)

if (termref.has_parent) termref.parent {
print "par1=",secname()
vec.x[i]=vec.x[i]+ri(.5)
par1.append()
forsec par1{
par1ref = new SectionRef()

if (par1ref.has_parent)  par1ref.parent{
print "par2=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par2.append()
forsec par2{
par2ref = new SectionRef()

if (par2ref.has_parent)  par2ref.parent{
print "par3=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par3.append()
forsec par3{
par3ref = new SectionRef()

if (par3ref.has_parent)  par3ref.parent{
print "par4=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par4.append()
forsec par4{
par4ref = new SectionRef()

if (par4ref.has_parent)  par4ref.parent{
print "par5=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par5.append()
forsec par5{
par5ref = new SectionRef()

if (par5ref.has_parent)  par5ref.parent{
print "par6=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par6.append()
forsec par6{
par6ref = new SectionRef()

if (par6ref.has_parent)  par6ref.parent{
print "par7=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par7.append()
forsec par7{
par7ref = new SectionRef()

if (par7ref.has_parent)  par7ref.parent{
print "par8=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par8.append()
forsec par8{
par8ref = new SectionRef()

if (par8ref.has_parent)  par8ref.parent{
print "par9=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par9.append()
forsec par9{
par9ref = new SectionRef()

if (par9ref.has_parent)  par9ref.parent{
print "par10=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par10.append()
forsec par10{
par10ref = new SectionRef()

if (par10ref.has_parent)  par10ref.parent{
print "par11=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par11.append()
forsec par11{
par11ref = new SectionRef()

if (par11ref.has_parent)  par11ref.parent{
print "par12=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par12.append()
forsec par12{
par12ref = new SectionRef()

if (par12ref.has_parent)  par12ref.parent{
print "par13=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par13.append()
forsec par13{
par13ref = new SectionRef()

if (par13ref.has_parent)  par13ref.parent{
print "par14=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par14.append()
forsec par14{
par14ref = new SectionRef()

if (par14ref.has_parent)  par14ref.parent{
print "par15=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par15.append()
forsec par15{
par15ref = new SectionRef()

if (par15ref.has_parent)  par15ref.parent{
print "par16=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par16.append()
forsec par16{
par16ref = new SectionRef()

if (par16ref.has_parent)  par16ref.parent{
print "par17=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par17.append()
forsec par17{
par17ref = new SectionRef()

if (par17ref.has_parent)  par17ref.parent{
print "par18=",secname()
vec.x[i]=vec.x[i]+ri(.5)
par18.append()
forsec par18{
par18ref = new SectionRef()

if (par18ref.has_parent)  par18ref.parent{
print "par19=",secname()
vec.x[i]=vec.x[i]+ri(.5)

par19.append()
forsec par19{
par19ref = new SectionRef()

if (par19ref.has_parent)  par19ref.parent{
print "par20=",secname()
vec.x[i]=vec.x[i]+ri(.5)
}
par19.remove()
}
}
par18.remove()
}
}
par17.remove()
}
}
par16.remove()
}
}
par15.remove()
}
}
par14.remove()
}
}
par13.remove()
}
}
par12.remove()
}
}
par11.remove()

}
}
par10.remove()

}
}
par9.remove()

}
}
par8.remove()
}
}
par7.remove()
}
}
par6.remove()
}
}
par5.remove()
}
}
par4.remove()
}
}
par3.remove()
}
}
par2.remove()
}
}
par1.remove()
}
termref par1ref
}
objref termref
pause(.3)
print "------",i
}
It works for 20 parents only!
Is there any simpler way possible?
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: equivalent resistance through terminals to soma

Post by ted »

It is possible to add up all the axial resistances along a path between two points in a cell, but the resulting number will be meaningless unless you assume that membrane current along the path, and current that flows into side branches along the path, are inconsequential. Still, if you insist, please note that your code example will produce incorrect results because it only adds up the axial resistances between 0.5 and the adjacent node with range < 0.5. You need to include ri at all internal nodes, as well as at the 1 end, of each section along the path between the points of interest. Also it will fail if the path runs through the origin of the cell (the 0 end of the root section), or if the path changes direction i.e. part of the path moves toward the root section but another part moves away from the root section.

If you want your code to work with a path that contains any number of sections, use a recursive algorithm to traverse the tree.
Post Reply