Page 1 of 1

recording a STATE variable with _ref_

Posted: Thu Feb 26, 2009 6:31 pm
by hnakhoul
Dear all,
I'm running a model using NEURON as an extension to Python and attempting to record a STATE variable ("ca_i") from one of the mod files into a vector:

Code: Select all

vec = {}
vec['cai'] = h.Vector()
vec['cai'].record(soma(0.5)._ref_ca_i))
but I obtained the following error:

Code: Select all

NameError: _ref_ca_i was not made to point to anything at soma(0.5)
What should I be doing differently? I'd be very grateful for any advice.

Re: recording a STATE variable with _ref_

Posted: Fri Feb 27, 2009 10:35 am
by hines

Code: Select all

vec['cai'].record(soma(0.5)._ref_ca_i))
perhaps you meant to write

Code: Select all

vec['cai'].record(soma(0.5)._ref_cai)
and for functions that need a currently accessed section it is often a good idea to
add it as a keyword arg as in

Code: Select all

vec['cai'].record(soma(0.5)._ref_cai, sec=soma)

Re: recording a STATE variable with _ref_

Posted: Fri Feb 27, 2009 11:22 am
by hnakhoul
Dear Michael,
I tried including the accessed section as a keyword arg, but I got the same error message. I did intend ca_i and not cai (the model was written not to use NEURON's cai). I have similar difficulty recording other STATE variables defined in mod files, although other variables, like v and t, seem to record without a problem.

Re: recording a STATE variable with _ref_

Posted: Fri Feb 27, 2009 11:33 am
by hines
Please send me the mod file and a little python file that demonstrates the problem. michael.hines@yale.edu

Re: recording a STATE variable with _ref_

Posted: Fri Feb 27, 2009 11:38 am
by hines
Did you verify that ca_i is in fact in the soma via
print soma(.5).ca_i

Re: recording a STATE variable with _ref_

Posted: Fri Feb 27, 2009 5:55 pm
by hnakhoul
I found the problem--I neglected to include the suffix of the mod file when referencing the variable. The syntax should have been

Code: Select all

vec['cai'].record(soma(0.5)._ref_ca_i_suffix,sec=soma)