I am facing an issue when using lambda_f for specifying nseg. The error message is: "lambda_f undefined function"
I had read the only other post dealing with such an error on the forum (http://www.neuron.yale.edu/phpbb/viewto ... =15&t=2017) and double-checked to ensure that I had included 'load_file("nrngui.hoc")' at the start of my code. I even tried toying around placing the same statement just before creating an object from the template, but to no use.
A stripped down & simplified version of my hoc code (that reproduces this error) is as follows:
Code: Select all
load_file("nrngui.hoc")
begintemplate test_template
public a, b
create a, b[1]
objref list_b
proc init() {
NUM = $1
create a, b[NUM]
list_b = new SectionList()
forsec "b" list_b.append
a {
L = 25 // um
diam = 25 // um
cm = 1 // uF/cm2
insert hh
ena = 50 // mV
ek = -80 // mV
}
forsec list_b {
L = 1500 // um
diam = 1.0 // um
cm = 0.005 // uF/cm2
}
forall {
nseg = int((L/(0.1*lambda_f(100))+.9)/2)*2 + 1 // d_lambda rule
//nseg = 11 //This works!
print secname()
Ra = 100 // ohm.cm
insert pas
e_pas = -70 // mv - Resting Membrane Potential
g_pas = 1/15000 // S/cm2 = 1/Rm = 1 / Membrane Resistance
}
}
endtemplate test_template
objref testobj
testobj = new test_template(5)
access testobj.a
Reproducing the entire error message:
It seems that 'lambda_f' is being considered as function defined in the template rather than belonging to the hoc library. Specifying my nseg via d_lambda seems to be fine if done outside of the template - after creating my object from the template.nrniv: lambda_f undefined function
in /cygdrive/.....
testobj = new test_template(5)
^
test_template[0].lambda_f(100 )
test_template[0].init(5 )
Despite this workaround, I was wondering whether I had committed some mistake in using the template method. If not, is there any way I can get it to work within the template?
Thanks in advance,
Shailesh Appukuttan