def importCellParams(self, label, conds, fileName, cellName, cellArgs=None, importSynMechs=False, somaAtOrigin=False, cellInstance=False): if cellArgs is None: cellArgs = {} if not label: label = int(self._labelid) self._labelid += 1 secs, secLists, synMechs, globs = utils.importCell(fileName, cellName, cellArgs, cellInstance) cellRule = {'conds': conds, 'secs': secs, 'secLists': secLists, 'globals': globs} # adjust cell 3d points so that soma is at location 0,0,0 if somaAtOrigin: somaSec = next((sec for sec in cellRule['secs'] if 'soma' in sec), None) if not somaSec or not 'pt3d' in cellRule['secs'][somaSec]['geom']: print 'Warning: cannot place soma at origin because soma does not exist or does not contain pt3d' return soma3d = cellRule['secs'][somaSec]['geom']['pt3d'] midpoint = int(len(soma3d)/2) somaX, somaY, somaZ = soma3d[midpoint][0:3] for sec in cellRule['secs'].values(): for i,pt3d in enumerate(sec['geom']['pt3d']): sec['geom']['pt3d'][i] = (pt3d[0] - somaX, pt3d[1] - somaY, pt3d[2] - somaZ, pt3d[3]) self.addCellParams(label, cellRule) if importSynMechs: for synMech in synMechs: self.addSynMechParams(synMech.pop('label'), synMech) return self.cellParams[label]
def importCellParams(self, label, conds, fileName, cellName, cellArgs=None, importSynMechs=False): if cellArgs is None: cellArgs = {} if not label: label = int(self._labelid) self._labelid += 1 secs, secLists, synMechs = utils.importCell(fileName, cellName, cellArgs) cellRule = {'conds': conds, 'secs': secs, 'secLists': secLists} self.addCellParams(label, cellRule) if importSynMechs: for synMech in synMechs: self.addSynMechParams(synMech.pop('label'), synMech) return self.cellParams[label]
netParams['popParams'].append({'popLabel': 'HH3D_pop', 'cellType': 'PYR', 'numCells': 5, 'cellModel': 'HH3D'}) netParams['popParams'].append({'popLabel': 'Traub_pop', 'cellType': 'PYR', 'numCells': 5, 'cellModel': 'Traub'}) netParams['popParams'].append({'popLabel': 'Mainen_pop', 'cellType': 'PYR', 'numCells': 5, 'cellModel': 'Mainen'}) netParams['popParams'].append({'popLabel': 'Friesen_pop', 'cellType': 'PYR', 'numCells': 5, 'cellModel': 'Friesen'}) netParams['popParams'].append({'popLabel': 'Izhi03b_pop', 'cellType': 'PYR', 'numCells': 5, 'cellModel': 'Izhi2003a'}) netParams['popParams'].append({'popLabel': 'Izhi03b_pop', 'cellType': 'PYR', 'numCells': 5, 'cellModel': 'Izhi2003b'}) netParams['popParams'].append({'popLabel': 'Izhi07a_pop', 'cellType': 'PYR', 'numCells': 5, 'cellModel': 'Izhi2007a'}) netParams['popParams'].append({'popLabel': 'Izhi07b_pop', 'cellType': 'PYR', 'numCells': 5, 'cellModel': 'Izhi2007b'}) netParams['popParams'].append({'popLabel': 'background', 'rate': 50, 'noise': 0.5, 'source': 'random', 'cellModel': 'NetStim'}) ## Cell property rules netParams['cellParams'] = [] # list of cell property rules - each item will contain dict with cell properties ### HH cellRule = {'label': 'PYR_HH_rule', 'conditions': {'cellType': 'PYR', 'cellModel': 'HH'}, 'sections': {}} # cell rule dict cellRule['sections'] = utils.importCell(fileName='HHCellFile.py', cellName='HHCellClass') netParams['cellParams'].append(cellRule) # add dict to list of cell parameters ### HH3D cellRule = {'label': 'PYR_HH3D_rule', 'conditions': {'cellType': 'PYR', 'cellModel': 'HH3D'}, 'sections': {}} # cell rule dict cellRule['sections'] = utils.importCell(fileName='geom.hoc', cellName='E21') cellRule['sections']['soma']['mechs']['hh'] = {'gnabar': 0.12, 'gkbar': 0.036, 'gl': 0.003, 'el': -70} # soma hh mechanism for secName in cellRule['sections']: cellRule['sections'][secName]['mechs']['pas'] = {'g': 0.0000357, 'e': -70} cellRule['sections'][secName]['geom']['cm'] = 10 cellRule['sections']['soma']['syns']['NMDA'] = {'_type': 'Exp2Syn', '_loc': 0.5, 'tau1': 1.0, 'tau2': 5.0, 'e': 0} # soma NMDA synapse netParams['cellParams'].append(cellRule) ### Traub cellRule = {'label': 'PYR_Traub_rule', 'conditions': {'cellType': 'PYR', 'cellModel': 'Traub'}, 'sections': {}} # cell rule dict cellRule['sections'] = utils.importCell(fileName='pyr3_traub.hoc', cellName='pyr3')