I created a cell class with Python and wanted to use the Neuron gui, so that I can play around with some parameters. In principle this is an easy job for the current accessed section, but if I want to see other compartments, I have to change the currently accessed section all the time.
In this class
Code: Select all
from neuron import h
class FooCell(object):
def __init__(self, ndend):
""" simple cell with a soma and ndend dendrites """
self.soma = h.Section(name = 'soma', cell = self)
self.dend = list()
for dend in range(ndend):
myname = 'dend%d'%dend
self.dend.append(h.Section(name = myname, cell = self))
# connect dendrites
self.dend[0].connect(self.soma,1, 0 )
for i in range(1,ndend):
self.dend[i].connect(self.dend[i-1], 1, 0)
Code: Select all
>>> from neuron import h, gui
>>> mycell = FooCell(ndend=10)
>>> h.cas().name()
>>> <foo.FooCell object at 0xb6cf4bcc>.soma'
Thanks in advance.