Recording the m,h,n gating variables

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
Dmandel
Posts: 13
Joined: Wed Jul 08, 2015 2:32 pm

Recording the m,h,n gating variables

Post 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'?
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Recording the m,h,n gating variables

Post 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
Post Reply