creating independent instances of a cell object
Posted: Fri May 09, 2014 8:39 am
I usually define a generic cell class in Python to generate cell objects that will be treated independently in a network of neurons. For example:
This will allow me to create different stances of PyramidalCell, and for example, attach point processes to one of them before a simulation.
The problem comes if I want to import the topology from a hoc file
If I now do:
the first object (ie mycell1), which points to h.soma will now point to the morphology loaded in the second place (topology2.hoc). Is there any way to introduce the argument self=cell in the creation of that object?
Thanks in advance
Code: Select all
class DummyCell(object):
def __init__(self):
self.soma = h.Section( name = 'soma', cell = self )
self.dend = h.Section( name = 'dend', cell = self )
self.axon = h.axon( name = 'axon', cell = self )
....
The problem comes if I want to import the topology from a hoc file
Code: Select all
class PyramidalCell(object):
def __init__(self, hoc_file):
h.load_file(hoc_file)
self.soma = h.soma
self.dend = h.dend
self.axon = h.axon
....
Code: Select all
mycell1 = PyramidalCell(topology1.hoc')
mycell2 = PyramidalCell('topology2.hoc')
Thanks in advance