Recording Currents & Current Stimulation

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

Recording Currents & Current Stimulation

Post by yiliu021 » Tue Apr 03, 2018 5:40 pm

Hello,

I'm a new user of NEURON + Python. After studying the online resources including the NEURON documentation and forum, I still have several questions:

1. I want to verify the Hodgkin-Huxley equation: I_total = Cm*dV/dt + I_ion under extracellular stimulation. The mechanisms I inserted are 'pas', 'hh', and 'extracellular'. By defining the extracellular voltages (e_extracellular) of each segment, I can see spikes by plotting the membrane potential (v).
(1) What are the meaning of recording 'segment.pas._ref_i' and 'segment._ref_i_membrane' ? Which one should I use for the I_total in the HH equation?
(2) To get the capacitive current Cm*dV/dt, I just need to record 'segment._ref_i_cap' and multiply it with area. Is this right?
(3) To get the sum of all the ion currents I_ion, can I just record 'segment._ref_ina' and 'segment._ref_ik', multiply them with area, and add them together? Are there other ways to directly get the sum of total ion currents?

2. If I want to control the stimulation current of the extracellular electrodes, is it necessary for me to calculate the extracellular voltages first so that I can define e_extracellular using softwares other than NEURON? Is it possible to directly define the extracellular current?


Thank you!

Yi

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

Re: Recording Currents & Current Stimulation

Post by ted » Tue Apr 03, 2018 6:21 pm

I want to verify the Hodgkin-Huxley equation: I_total = Cm*dV/dt + I_ion under extracellular stimulation.
Actually that's not the Hodgkin-Huxley equation. It's just a statement of the fact that total transmembrane current is the sum of membrane capacitive and ionic currents.
The mechanisms I inserted are 'pas', 'hh', and 'extracellular'.
The hh mechanism has a built-in leak current called ileak. If you insert hh, you get na channels, k channels, and membrane leak "channels". There's no need to include pas.
What are the meaning of recording 'segment.pas._ref_i' and 'segment._ref_i_membrane' ?
seg.i_membrane is the total transmembrane current for a particular segment. seg.pas.i is the current through the "pas" channels. The _ref_ prefix is needed when you want to capture the time course of a current to a vector.
To get the capacitive current Cm*dV/dt, I just need to record 'segment._ref_i_cap' and multiply it with area.
First, seg.i_cap is indeed the membrane capacitive current, and if you want to record it to a vector you need to call it seg._ref_i_cap.

Second, all of the currents we are discussing are "density currents"--their units are mA/cm2. If you need to convert them to absolute current units (total current in pA, nA, or mA), you do have to multiply them by segment surface area. However, segment surface area is reported in square microns, so you'll also need to multiply by an appropriate scale factor (1e-8 * area in um2 * current in mA/cm2 will give you current in mA).

But why is that necessary? Just leave all the currents in their original units (mA/cm2). The equation
I_total = I_cap + I_ion
will be numerically correct if all of the currents are in mA/cm2.
To get the sum of all the ion currents I_ion, can I just record 'segment._ref_ina' and 'segment._ref_ik', multiply them with area, and add them together? Are there other ways to directly get the sum of total ion currents?
Nope, that's the only way. Don't forget to include i_pas and ileak_hh. But you're not going to include pas, so just remember to add ileak_hh.
If I want to control the stimulation current of the extracellular electrodes, is it necessary for me to calculate the extracellular voltages first so that I can define e_extracellular using softwares other than NEURON? Is it possible to directly define the extracellular current?/quote]I don't know how complicated your electrode geometry is. It's real easy to figure out what currents applied with point source electrodes do to potentials in an infinite or semi-infinite, homogeneous and purely resistive conductive medium. Then you could use the xtra mechanism to couple the stimulus waveform to e_extracellular. Here are a couple examples of the use of xtra:
Cavarretta F, Carnevale NT, Tegolo D, Migliore M (2014)
Effects of low frequency electric fields on synaptic integration in hippocampal CA1 pyramidal neurons:
implications for power line emissions Front. Cell. Neurosci. 8:310
https://senselab.med.yale.edu/ModelDB/s ... del=151731

Reilly JP (2016) Survey of numerical electrostimulation models. Phys Med Biol 61:4346-63
https://senselab.med.yale.edu/ModelDB/S ... del=239006

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

Re: Recording Currents & Current Stimulation

Post by yiliu021 » Tue Apr 03, 2018 7:11 pm

Hi Ted,

Thanks a lot for your quick reply! Your tips are very helpful. Now I've deleted the 'pas' mechanism and I'm only using 'hh' and 'extracellular'.

One more question: I tried 'seg.ileak_hh' to get the leak current, but got an error " 'nrn.Segment' object has no attribute 'ileak_hh' ". However, 'seg.ik' and 'seg.ina' worked well. Seems that the leak current is missing in my hh mechanism. Is there any way to fix this?


Thanks,

Yi

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

Re: Recording Currents & Current Stimulation

Post by ramcdougal » Tue Apr 03, 2018 9:04 pm

The leak current in the hh mechanism is il_hh not ileak_hh.

Alternatively, a more Pythonic syntax is to access it via the mechanism; e.g. seg.hh.il (or seg.hh._ref_il if you need the pointer).

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

Re: Recording Currents & Current Stimulation

Post by yiliu021 » Wed Apr 04, 2018 8:37 pm

It works. I was able to validate the equation. Thanks!

Two more questions:

1. I don't quite understand the layered model of the extracellular mechanism (the last figure here: https://www.neuron.yale.edu/neuron/stat ... /mech.html) It seems that we can add more layers to it, but I don't know what's the physical meaning of each layer. Is there any reference for it?

2. If I want to model a neuron with the cable theory (For example, the Figure 1 here: https://en.wikipedia.org/wiki/Cable_theory), how do I get the current flowing through r_l in the figure (which is the longitudinal current flow between segments)?


Thanks,

Yi

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

Re: Recording Currents & Current Stimulation

Post by ted » Thu Apr 05, 2018 2:28 pm

I don't quite understand the layered model of the extracellular mechanism
extracellular can be used to add concentric layers of radially symmetric insulation to the external surface of a neurite, e.g. a myelin sheath. It also provides the variables e_extracellular, which can be used to change the extracellular potential adjacent to a segment, and i_membrane, which reports the segment's total membrane current (in units of mA/cm2, of course).
I don't know what's the physical meaning of each layer. Is there any reference for it?
The reference is the Programmer's Reference for the extracellular mechanism.
how do I get . . . the longitudinal current flow between segments)?
Ohm's law. Divide the potential difference between adjacent segments by ri, the longitudinal resistance between adjacent segments--see the documentation of ri in the Programmer's Reference. Note that if extracellular is present, the actual internal potential for a given segment equals the sum vext+v (see the diagram in the Programmer's Reference documentation of extracellular).

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

Re: Recording Currents & Current Stimulation

Post by yiliu021 » Fri Apr 06, 2018 8:02 pm

Hi Ted,

Thanks for your advice. For the figure in the Programmer's Reference for the extracellular mechanism (the last figure in https://www.neuron.yale.edu/neuron/stat ... mechanisms), I still have several questions (suppose we only have one concentric layer of radially symmetric insulation, say, a myelin sheath):

1. In the figure, from top to bottom, is it: "vext + v ": the intracellular space of s cell --> "xc + xg in parallel": the cell membrane --> "vext": the surface between the membrane and the myelin sheath --> "xc and xg in parallel": myelin sheath --> "vext[1]" the outer surface of myelin sheath --> "the series xg[1], e_extracellular combination in parallel with the xc[1] capacitance": don't know what it is...

My understanding above might be completely wrong because even I myself don't think it looks reasonable. But I can't find a better way to explain this. Could you help me correct it?

2. Are there variables that define the Nernst potential of Na+ and K+ ions?


Thanks,

Yi

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

Re: Recording Currents & Current Stimulation

Post by ted » Sat Apr 07, 2018 11:33 am

For the figure in the Programmer's Reference for the extracellular mechanism (the last figure in https://www.neuron.yale.edu/neuron/stat ... mechanisms), I still have several questions (suppose we only have one concentric layer of radially symmetric insulation, say, a myelin sheath):

1. In the figure, from top to bottom, is it: "vext + v ": the intracellular space of s cell --> "xc + xg in parallel": the cell membrane --> "vext": the surface between the membrane and the myelin sheath --> "xc and xg in parallel": myelin sheath --> "vext[1]" the outer surface of myelin sheath --> "the series xg[1], e_extracellular combination in parallel with the xc[1] capacitance": don't know what it is...
I'm guessing that you want me to explain the diagram. The diagram is an equivalent circuit representation of a spatially discretized cable that is wrapped inside two additional layers. The Ra are the longitudinal resistances between the adjacent intracellular nodes (segment centers) of the axon itself. xraxial (actually a hoc shortcut for xraxial[0]; the index is of course required for Python) represents the longitudinal resistances between the first extracellular layer's nodes. vext, the potential at those nodes, is the electrical potential adjacent to the external surface of the axon. v is the axon's membrane potential (voltage drop across the axonal membrane). Therefore vext+v is the potential at the internal nodes of the axon. xraxial[1] represents the longitudinal resistances between the second extracellular layer's nodes, and vext[1] represents the potentials at those nodes. xc and xg (xc[0] and xg[0]) are the first extracellular layer's radial capacitance and conductance, and xc[1] and xg[1] are the second extracellular layer's radial capacitance and conductance. The default values of all the xraxial, xc, and xg parameters are such that longitudinal current flow in the extracellular layers is negligible, so that all current flow in those layers is radial.
2. Are there variables that define the Nernst potential of Na+ and K+ ions?
The hoc names of those equilibrium potentials are ena and ek, so their Python names are h.ena and h.ek. For any ionic species x, the equilibrium potential ex exists in a given section only if that section has a mechanism that READs or WRITEs ex. The easiest way to find out what exists in a section is to use the h.psection() function. Read about it in the Programmer's Reference.

Furthermore, NEURON has a function called ion_style() that allows one to specify whether an equilibrium potential ex is treated as a constant parameter or is calculated from the intra- and extracellular concentrations xi and xo. ion_style() also allows specification of several other aspects of how NEURON deals with ionic equilibrium potentials and concentrations--be sure to read about it in the Programmer's Reference. And if a modeler doesn't specify these policies with the ion_style() function, NEURON automatically makes a "reasonable decision" about how these matters will be handled. Finally, if you what to find out how NEURON will deal with these things, just call ion_style() with the name of the ionic species and the section as arguments, e.g.
h.ion_style("na_ion", sec=dend)

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

Re: Recording Currents & Current Stimulation

Post by yiliu021 » Mon Apr 09, 2018 5:19 pm

Hi Ted,

That was a very clear and helpful answer to my questions. Thank you so much for your help!!!

Best,

Yi

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

Re: Recording Currents & Current Stimulation

Post by yiliu021 » Mon Apr 09, 2018 8:02 pm

One more quick question: how do we access Ra (longitudinal resistances between the adjacent intracellular nodes of the axon itself)?

Thanks,

Yi

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

Re: Recording Currents & Current Stimulation

Post by yiliu021 » Mon Apr 09, 2018 8:31 pm

Oh it should be "section.Ra". I was looking at the wrong place in the Programmers' Reference.

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

Re: Recording Currents & Current Stimulation

Post by ted » Mon Apr 09, 2018 9:36 pm

Actually Ra is cytoplasmic resistivity, which is a bulk property of cytoplasm itself and is not affected by L or diam. You need the function ri(). Example:

Code: Select all

from neuron import h
axon = h.Section()
axon.diam = 1 // default L is 100 um
axon.nseg = 3
for seg in axon.allseg():
  print seg.x, seg.ri()
Be sure to read the Programmer's Reference entries on allseg(), ri(), and Ra

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

Re: Recording Currents & Current Stimulation

Post by yiliu021 » Tue Apr 10, 2018 5:33 pm

Thanks for your correction. Somehow "seg.ri()" doesn't work for me ('nrn.Segment' object has no attribute 'ri'), but "h.ri(x, sec = section)" works.

Post Reply