append sections to sectionlist
Posted: Mon Oct 28, 2013 12:58 pm
Hi
I have the following code and it crashes if I have a big number in _axonnodes(around 80)
I have read the forum that there is a stack size limit.
I didn't really figure out though if we can change the stack size or if there is another way of append in the SectionLists
Since I am using h.pop_section() shouldn't the stack size not be a problem?
I have the following code and it crashes if I have a big number in _axonnodes(around 80)
I have read the forum that there is a stack size limit.
I didn't really figure out though if we can change the stack size or if there is another way of append in the SectionLists
Since I am using h.pop_section() shouldn't the stack size not be a problem?
Code: Select all
from neuron import h
#----------Defining variables in python environment
_D = 20 # Fiber diameter [um]
_d = 0.7*_D # Axon diameter at node [um]
_w = 2.5 # Nodal gap [um]
_rhol = 100 # Axoplasmic resistivity [ohm*cm]
_rhoe = 300 # External medium resistivity [ohm*cm]
_cm = 2 # Membrane capacity [uF/(cm*cm)]
_gm = 0.0304 # Membrane conductivity [S/(cm*cm)]
_Li = 100*_D # Internodal distance [um]
_dEl = 2000 # Radial distance to longitudinally centered electrode [um]
_axonnodes = 100#int(math.floor(_lAx/_Li)-1) # Number of unmyelinated axon nodes
_axoninter = _axonnodes+1 # Number of myelinated axon inter-nodes
#-----------Defining variables in hoc environment
h('_D = 20') # Fiber diameter [um]
h('_d = 0.7*_D') # Axon diameter at node [um]
h('_w = 2.5') # Nodal gap [um]
h('_rhol = 100') # Axoplasmic resistivity [ohm*cm]
h('_rhoe = 300') # External medium resistivity [ohm*cm]
h('_cm = 2') # Membrane capacity [uF/(cm*cm)]
h('_gm = 0.0304') # Membrane conductivity [S/(cm*cm)]
h('_Li = 100*_D') # Internodal distance [um]
h('_dEl = 2000') # Radial distance to longitudinally centered electrode [um]
h('_lAx = 10*_dEl') # Total length of modeled axon [um]
h('_axoninter = _axonnodes+1') # Number of myelinated axon inter-nodes
h('create node[_axonnodes]')
h('create internode[_axoninter]')
h('access node[0]')
h.nrn_load_dll("C:/Users/Ioannis/Desktop/SENN - nrn7.3/nrnmech.dll")
SubsetAll = h.SectionList()
SubsetNodes = h.SectionList()
SubsetInternodes = h.SectionList()
def celldef():
topol()
subsets()
geom()
biophys()
geom_nseg()
def topol():
print "topol"
for i in range(_axonnodes):
h.node[i].connect(h.internode[i],1,0)
h.internode[i+1].connect(h.node[i],1,0)
basic_shape()
def subsets():
print "subsets"
for i in range(_axonnodes):
print i
SubsetAll.append(h.node[i].push())
h.pop_section()
SubsetAll.append(h.internode[i].push())
h.pop_section()
SubsetAll.append(h.internode[_axoninter-1].push())
h.pop_section()
for i in range(_axonnodes):
SubsetNodes.append(h.node[i].push())
h.pop_section()
for i in range(_axoninter):
SubsetInternodes.append(h.internode[i].push())
h.pop_section()
def basic_shape():
x = -0.5*(_axoninter*_Li - _w)
y = _dEl
z = 0
for i in range(_axonnodes):
h.internode[i].push()
h.pt3dclear()
h.pt3dadd(x, y, z, _d)
x = x + _Li - _w
h.pt3dadd(x, y, z, _d)
h.pop_section()
h.node[i].push()
h.pt3dclear()
h.pt3dadd(x, y, z, _d)
x = x + _w
h.pt3dadd(x, y, z, _d)
h.pop_section()
h.internode[_axonnodes].push()
h.pt3dclear()
h.pt3dadd(x, y, z, _d)
x = x + _Li - _w
h.pt3dadd(x, y, z, _d)
h.pop_section
def biophys():
for sec in SubsetAll:
sec.insert('extracellular')
sec.push()
h('xraxial[0] = 1e+09')
h('xraxial[1] = 1e+09')
h('xg = 1e+09')
h('xc = 0')
h('e_extracellular = 0')
h.pop_section
for sec in SubsetNodes:
sec.cm = _cm
sec.Ra = _rhol
sec.insert('fh')
sec.push()
h('nai = 13.74')
h('nao = 114.5')
h('ki = 120')
h('ko = 2.5')
h('celsius = 22.01')
h.pop_section
for sec in SubsetInternodes:
sec.cm = 0
sec.Ra = _rhol
def geom_nseg():
for sec in SubsetAll:
sec.nseg = 1
def geom():
1
h('access node[0]')
celldef()