Accessing inf_hh and tau_hh in the hh mechanism

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

Moderator: hines

Post Reply
yiliu021
Posts: 12
Joined: Thu Mar 29, 2018 3:18 pm

Accessing inf_hh and tau_hh in the hh mechanism

Post by yiliu021 » Mon Nov 26, 2018 2:48 pm

Hello,

I'm using NEURON in my python codes, and I'm trying to get the variables in the 'hh' mechanism. I saw the following in the documentation:

'rates_hh(v) computes the global variables [mhn]inf_hh and [mhn]tau_hh from the rate functions. usetable_hh defaults to 1.'

I tried several times but couldn't get them. Could you clarify how to get the inf_hh and tau_hh in detail? A simple example code would be perfect.


Thanks,

Yi

ramcdougal
Posts: 141
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Medicine

Re: Accessing inf_hh and tau_hh in the hh mechanism

Post by ramcdougal » Mon Nov 26, 2018 6:01 pm

Globals are accessed globally; i.e. through the h object:

Code: Select all

from neuron import h
soma = h.Section(name='soma')
soma.insert('hh')
print(h.htau_hh)
print(h.hinf_hh)

yiliu021
Posts: 12
Joined: Thu Mar 29, 2018 3:18 pm

Re: Accessing inf_hh and tau_hh in the hh mechanism

Post by yiliu021 » Mon Nov 26, 2018 6:52 pm

Maybe my understanding is wrong, but aren't h.htau_hh and h.hinf_hh two arrays of numbers related to the membrane potential?

i.e. in the following link:
https://icwww.epfl.ch/~gerstner/SPNM/node14.html
in Equation 2.7, h.htau_hh should be the tau_x and h.hinf_hh should be the x_0 here when x = h. Therefore, both of them should be changing with the membrane potential. Am I wrong?


Thanks,

Yi

ramcdougal
Posts: 141
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Medicine

Re: Accessing inf_hh and tau_hh in the hh mechanism

Post by ramcdougal » Mon Nov 26, 2018 7:28 pm

Conceptually, you are correct.

For memory reasons, however, NEURON's hh.mod doesn't actually store those values since they are only useful for computing one location at one time point. Instead, a GLOBAL value is used, meaning that there is only one memory location used for every spatial point (different points just overwrite the old value when is their turn to be calculated).

The CoreNEURON version, available at

https://github.com/BlueBrain/CoreNeuron ... ile/hh.mod

replaces the GLOBAL variables with RANGE variables and this allows accessing the values at different points. To use that one instead, simply place it in your model directory and recompile with nrnivmodl.

(Actually, I'm not sure: you may have to change the SUFFIX to e.g. hh2... I'm not sure what happens if a local mechanism duplicates the name of a built in one )

yiliu021
Posts: 12
Joined: Thu Mar 29, 2018 3:18 pm

Re: Accessing inf_hh and tau_hh in the hh mechanism

Post by yiliu021 » Mon Nov 26, 2018 8:03 pm

I see. I'll try the CoreNEURON version. I think I can also directly calculate these values by myself because all I need is the membrane potential at each time at each location.

Thanks for answering my questions!

Best,

Yi

ted
Site Admin
Posts: 5376
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Accessing inf_hh and tau_hh in the hh mechanism

Post by ted » Mon Nov 26, 2018 11:52 pm

yiliu021 wrote:
Mon Nov 26, 2018 6:52 pm
Maybe my understanding is wrong, but aren't h.htau_hh and h.hinf_hh two arrays of numbers related to the membrane potential?
Neither is an array. Both are scalars whose values depend on membrane potential.
ramcdougal wrote:
Mon Nov 26, 2018 7:28 pm
you may have to change the SUFFIX to e.g. hh2
True. nrnivmodl/mknrndll will refuse to compile a mechanism that has the same name as one that has already been compiled or is already built into NEURON.
yiliu021 wrote:I'll try the CoreNEURON version.
Why bother. You're going to have to edit the file anyway. Might as well just copy th hh.mod already on your own machine to a file called hh2.mod that is located in one of your own directories (not in NEURON's installation tree), then edit hh2.mod to change

Code: Select all

  SUFFIX hh
to

Code: Select all

:  SUFFIX hh
  SUFFIX hh2
and also change

Code: Select all

  GLOBAL minf, hinf, ninf, mtau, htau, ntau
to

Code: Select all

:  GLOBAL minf, hinf, ninf, mtau, htau, ntau
  RANGE minf, hinf, ninf, mtau, htau, ntau

yiliu021
Posts: 12
Joined: Thu Mar 29, 2018 3:18 pm

Re: Accessing inf_hh and tau_hh in the hh mechanism

Post by yiliu021 » Tue Nov 27, 2018 1:41 pm

That is even better than using CoreNEURON. Thanks Ted!


Best,

Yi

Post Reply