Plot what... from a Python class
Posted: Fri Mar 11, 2011 3:20 am
Hi everybody
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
I type in the console
I was wondering if it is possible to access some other compartments easily via the Neuron gui. For example, in voltage axis, I can not choose compartments other than the currently accessed section. Would it be possible to see simulation in mycell.dend[4](x) and mycell.soma simultaneously? (without writing a Matplotlib routine for that)
Thanks in advance.
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.