Generic NEURON cell object. Provides template abstract methods and a generic design for NEURON cell models.
AUTHORS:
Thomas McTavish (2010-11-04).
Thomas McTavish (2011-11-06) Update for cleaner docstring and error reporting.
sub-attributes, and sub-elements via strings.
Generic cell template for NEURON cell objects.
Subclasses can override __init__() completely, or do some of their own initialization first, and then let Cell do its initializing, and then the subclass can finish. For example:
class ChildCell(Cell):
def __init__(self):
# Do some stuff
Cell.__init__(self)
# Do some more stuff
You might have to get fancy with arguments:
class ChildCell(Cell):
def __init__(self, someparameter=someval, **kwargs):
# Do some stuff
self.someparameter = someparameter
Cell.__init__(self, **kwargs)
# Do some more stuff
Build section list iterators. This defines the ‘all’, SectionList, but subclasses may want to define others. If overriden, call Cell.build_subsets(self) to create the ‘all’ SectionList.
For example, in a subclass with two dendrites, self.dend[0] and self.dend[1] already defined, we can add them to a “dendlist” iterator:
Cell.build_subsets(self) # Make 'all' iterator
self.dendlist = nrn.SectionList()
self.dendlist.append(self.dend[0])
self.dendlist.append(self.dend[1])
Connect the sections of the cell to build a tree. “0” ends are toward the soma and “1” ends are distal. For example, to connect the “0” end of a dendrite to the “1” end of the soma:
self.dend.connect(self.soma(1))
Make a new NetCon with this cell’s membrane potential at the soma as the source (i.e. the spike detector) onto the target passed in (i.e. a synapse on a cell). Subclasses may override with other spike detectors.
Create the sections of the cell. Remember to do this in the form:
self.soma = nrn.Section(name='soma', cell=self)
Create synapses (such as ExpSyn) at various segments and add them to self.synlist.
For example, in a ball-and-stick cell with a soma and single dendrite, to add an exponentially decaying (tau = 2 ms) synapse in the middle of the dendrite:
syn = nrn.ExpSyn(self.dend(0.5))
syn.tau = 2
self.synlist.append(syn)
Assign the membrane properties across the cell. For example:
# Insert active Hodgkin-Huxley current in the soma self.soma.insert(‘hh’) self.soma.gnabar_hh = 0.12 # Sodium conductance in S/cm2 self.soma.gkbar_hh = 0.036 # Potassium conductance in S/cm2 self.soma.gl_hh = 0.0003 # Leak conductance in S/cm2 self.soma.el_hh = -54.3 # Reversal potential in mV
Set the 3D geometry of the cell. The length, diameter, and number of segments should be set for each section as well as the section’s (x,y,z) coordinates, if necessary. For example:
self.soma.L = self.soma.diam = 12.6157 # microns
self.dend.L = 200 # microns
self.dend.diam = 1 # microns
self.dend.nseg = 5