def creaetHHComp(parent='/library', name='hhcomp', diameter=1e-6, length=1e-6): """Create a compartment with Hodgkin-Huxley type ion channels (Na and K). Returns a 3-tuple: (compartment, nachannel, kchannel) """ compPath = '{}/{}'.format(parent, name) mc = comp.MooseCompartment(compPath, length, diameter, {}) c = mc.mc_ sarea = mc.surfaceArea if moose.exists('/library/na'): moose.copy('/library/na', c.path, 'na') else: create_na_chan(parent=c.path) na = moose.element('%s/na' % (c.path)) # Na-conductance 120 mS/cm^2 na.Gbar = 120e-3 * sarea * 1e4 na.Ek = 115e-3 + EREST_ACT moose.connect(c, 'channel', na, 'channel') if moose.exists('/library/k'): moose.copy('/library/k', c.path, 'k') else: create_k_chan(parent=c.path) k = moose.element('%s/k' % (c.path)) # K-conductance 36 mS/cm^2 k.Gbar = 36e-3 * sarea * 1e4 k.Ek = -12e-3 + EREST_ACT moose.connect(c, 'channel', k, 'channel') return (c, na, k)
def makeCable(self, args): ''' Make a cable out of n compartments ''' for i in range(self.ncomp): compPath = '{}/comp{}'.format(self.cablePath, i) l = self.length / self.ncomp d = self.diameter c = comp.MooseCompartment(compPath, l, d, args) self.cable.append(c) self.connect() utils.dump("STEP", "Passive cable is connected and ready for simulation.")
def buildCable(self, args): ''' Build binary cable ''' self.args = args self.buildParameterLists() # Cable is a list of lists. self.cable = list() for n, (l, d) in enumerate(zip(self.compLengthList, self.compDiamList)): utils.dump( "STEP", "Binary tree level {}: length {}, diameter {}".format(n, l, d)) noOfCompartments = pow(2, n) compartmentList = [] for i in range(noOfCompartments): compPath = '{}/comp_{}_{}'.format(self.cablePath, n, i) m = comp.MooseCompartment(compPath, l, d, args) compartmentList.append(m.mc_) self.cable.append(compartmentList) self.connectCable()