thanks ted, here are the results:
Code: Select all
from neuron import h
import numpy as np
axon = h.Section(name="axon")
axon.L = 10
axon.diam = 2
axon.nseg = 5
axon.insert("hh")
axon.psection()
# {'point_processes': {},
# 'density_mechs': {'hh': {'gnabar': [0.12, 0.12, 0.12, 0.12, 0.12],
# 'gkbar': [0.036, 0.036, 0.036, 0.036, 0.036],
# 'gl': [0.0003, 0.0003, 0.0003, 0.0003, 0.0003],
# 'el': [-54.3, -54.3, -54.3, -54.3, -54.3],
# 'gna': [0.0, 0.0, 0.0, 0.0, 0.0],
# 'gk': [0.0, 0.0, 0.0, 0.0, 0.0],
# 'il': [0.0, 0.0, 0.0, 0.0, 0.0],
# 'm': [0.0, 0.0, 0.0, 0.0, 0.0],
# 'h': [0.0, 0.0, 0.0, 0.0, 0.0],
# 'n': [0.0, 0.0, 0.0, 0.0, 0.0]}},
# 'ions': {'na': {'ena': [50.0, 50.0, 50.0, 50.0, 50.0],
# 'nai': [10.0, 10.0, 10.0, 10.0, 10.0],
# 'nao': [140.0, 140.0, 140.0, 140.0, 140.0],
# 'ina': [0.0, 0.0, 0.0, 0.0, 0.0],
# 'dina_dv_': [0.0, 0.0, 0.0, 0.0, 0.0]},
# 'k': {'ek': [-77.0, -77.0, -77.0, -77.0, -77.0],
# 'ki': [54.4, 54.4, 54.4, 54.4, 54.4],
# 'ko': [2.5, 2.5, 2.5, 2.5, 2.5],
# 'ik': [0.0, 0.0, 0.0, 0.0, 0.0],
# 'dik_dv_': [0.0, 0.0, 0.0, 0.0, 0.0]}},
# 'morphology': {'L': 10.0,
# 'diam': [2.0, 2.0, 2.0, 2.0, 2.0],
# 'pts3d': [],
# 'parent': None,
# 'trueparent': None},
# 'nseg': 5,
# 'Ra': 35.4,
# 'cm': [1.0, 1.0, 1.0, 1.0, 1.0],
# 'regions': set(),
# 'species': set(),
# 'name': 'axon',
# 'hoc_internal_name': '__nrnsec_0x11df18000',
# 'cell': None}
A list of 5 values is given for gnabar_hh, so it appears that nseg (5) is the max number of steps you can take in this section.
Code: Select all
for i in np.arange(0, 1.1, 0.1):
axon(i).gnabar_hh = i
print(f"axon position {i} = {axon(i).gnabar_hh}")
# axon position 0.0 = 0.0
# axon position 0.1 = 0.1
# axon position 0.2 = 0.2
# axon position 0.30000000000000004 = 0.30000000000000004
# axon position 0.4 = 0.4
# axon position 0.5 = 0.5
# axon position 0.6000000000000001 = 0.6000000000000001
# axon position 0.7000000000000001 = 0.7000000000000001
# axon position 0.8 = 0.8
# axon position 0.9 = 0.9
# axon position 1.0 = 1.0
That code works, which would imply that you can actually specify much finer grained detail than nseg.
However:
Code: Select all
for i in np.arange(0,1.1, 0.1):
print(f"axon position {i} = {axon(i).gnabar_hh}")
# axon position 0.0 = 0.1
# axon position 0.1 = 0.1
# axon position 0.2 = 0.30000000000000004
# axon position 0.30000000000000004 = 0.30000000000000004
# axon position 0.4 = 0.5
# axon position 0.5 = 0.5
# axon position 0.6000000000000001 = 0.7000000000000001
# axon position 0.7000000000000001 = 0.7000000000000001
# axon position 0.8 = 1.0
# axon position 0.9 = 1.0
# axon position 1.0 = 1.0
This information is also reflected in axon.psection().
It looks like the answer is that you are allowed to do as fine grained an assignment as you want, but it will silently fail and implicitly assign to the nearest normalized segment position instead. Is this correct? If so, an interpreter warning or failure would be a good idea.. I'd be happy to help implement or develop test cases.
If I am correct, the best bet for assigning gradients of things like conductances along a section is to explicitly iterate through the segments assigning a value to each segment:
Code: Select all
for seg in axon:
seg.gnabar_hh = 0
print(f"segment position (seg.x) is {seg.x} gnabar_hh is {seg.gnabar_hh}")
In regards to:
Consider a modeler who doesn't know much about NEURON and wants to reproduce one of those models in some other programming language. Or consider almost any modeler, including probably most NEURON users, who wants to reproduce one of those models in some other programming language. How many of them will end up with the correct spatial variation of channel density (or diameter or whatever other range variable they were varying)? Probably very few.
I agree, and this is my situation: Translating hoc code from published papers to python to run my own experiments, but trying to understand exactly what parts of the original code were doing (correct or not). It highlights the need for explicit documentation or, even better, interpreter warnings/errors when things should not be used.
I would like to contribute documentation to clear up this confusion and help others who run into this, do you accept documentation contributions for the website? How would I go about doing this?
Thanks again,
Nick