Page 1 of 1

Recording the m,h,n gating variables

Posted: Fri Jul 24, 2015 4:08 pm
by Dmandel
I have built a channel in Channel Builder, saved as a session file and loaded into Python. But when I tried to record the State Gating variables, I have discovered that there is no reference to them, like there is in the 'hh' model. Here is the python code.

Code: Select all

# Load in Channels
h.load_file('/Users/Doni/Channels/KDR.ses')
h.load_file('/Users/Doni/Channels/NA.ses')
h.load_file('/Users/Doni/Channels/leak.ses')

# Create Soma and insert the channels
soma = Section()
soma.insert('KDR')
soma.insert('Na')
soma.insert('leak')   vm, vh, vn = [h.Vector() for x in xrange(3)] # record the m,h,n gating variables

# Record state variable gates
vm.record(soma(0.5).KDR._ref_m)
vh.record(soma(0.5).Na._ref_h)
vn.record(soma(0.5).Na._ref_n)
And the error,

AttributeError: 'nrn.Mechanism' object has no attribute '_ref_m'

Do I need to create a Mod file like 'hh'?

Re: Recording the m,h,n gating variables

Posted: Sun Jul 26, 2015 1:24 pm
by ted
Fortunately no. Just activate your ChannelBuilder's "aliases" feature, and the state variables will be exposed to hoc and Python. To see an example in a slightly different context, read this discussion thread:
Temperature dependence with the Channel Builder
viewtopic.php?f=16&t=1473

"Oh, but that's all about hoc names. I need to get at these variables from Python."

Then this topic in the NEURON Programmer's Reference will be very helpful:
Python Accessing HOC
https://www.neuron.yale.edu/neuron/stat ... essing-hoc