dend = h.Section()
dir(dend)
shows that sections know insert, but not uninsert. This syntactic gap will be corrected in a future version of NEURON.
h('forall uninsert hh')
works as long as all existing sections have hh.
h('uninsert hh', sec=dend)
is a workaround that does what you want, i.e. uninserts a mechanism from an individual section.
I had hoped that one could
dend = h.Section(name='dend')
dend.insert('hh')
and then
h('dend uninsert hh') # avoid the mix of hoc and Python and the extra typing in h('uninsert hh', sec=dend)
but even though
dend.hname()
returns
'dend'
my hoped-for syntax does not work. According to Michael Hines, this is because
The 'name' arg for the section constructor . . . only refers to the label printed by GUI tools and topology and psection. That label cannot be used by the hoc interpreter as it is not added to the hoc symbol table. Hoc can only refer to a python section via the Section.hoc_internal_name() method.
And sure enough, that is correct, since either this
Code: Select all
>>> dend.hoc_internal_name()
'__nrnsec_0x9b34f78'
>>> h('uninsert hh', sec=h.__nrnsec_0x9b34f78)
1
or this much simpler (but still a bit tedious)
Code: Select all
>>> h('__nrnsec_0x9b34f78 uninsert hh')
1
will work. Either of which is nice and internally consistent but not very practical since it is much easier to type (and read)
h('uninsert hh', sec=dend)