def makeAxonProto(): axon = moose.Neuron('/library/axon') prev = rd.buildCompt(axon, 'soma', RM=RM, RA=RA, CM=CM, dia=10e-6, x=0, dx=comptLen) theta = 0 x = comptLen y = 0.0 for i in range(numAxonSegments): dx = comptLen * np.cos(theta) dy = comptLen * np.sin(theta) r = np.sqrt(x * x + y * y) theta += comptLen / r compt = rd.buildCompt(axon, 'axon' + str(i), RM=RM, RA=RA, CM=CM, x=x, y=y, dx=dx, dy=dy, dia=comptDia) moose.connect(prev, 'axial', compt, 'raxial') prev = compt x += dx y += dy return axon
def makeCellProto(name): elec = moose.Neuron('/library/' + name) ecompt = [] soma = rd.buildCompt(elec, 'soma', somaDia, somaDia, -somaDia, RM, RA, CM) dend = rd.buildCompt(elec, 'dend', dendLen, dendDia, 0, RM, RA, CM) moose.connect(soma, 'axial', dend, 'raxial') elec.buildSegmentTree()
def makeCellProto( name ): elec = moose.Neuron( '/library/' + name ) ecompt = [] soma = rd.buildCompt( elec, 'soma', somaDia, somaDia, -somaDia, RM, RA, CM ) dend = rd.buildCompt( elec, 'dend', dendLen, dendDia, 0, RM, RA, CM ) moose.connect( soma, 'axial', dend, 'raxial' ) elec.buildSegmentTree()
def makeDendProto(): dend=moose.Neuron('/library/dend') #prev=rd.buildCompt(dend,'soma',RM=RM,RA=RA,CM=CM,dia=0.3e-06,x=0,dx=comptLenBuff) prev=rd.buildCompt(dend,'soma',RM=RM,RA=RA,CM=CM,dia=0.3e-06,x=0,dx=comptLen) #x=comptLenBuff x=comptLen y=0.0 comptDia=0.3e-06 for i in range(numDendSegments-1): dx=comptLen dy=0 #comptDia +=1.7e-08 compt=rd.buildCompt(dend,'dend'+str(i),RM=RM,RA=RA,CM=CM,x=x,y=y,dx=dx,dy=dy,dia=comptDia) moose.connect(prev,'axial',compt,'raxial') prev=compt x+=dx y+=dy print i for i in range(numDendSegments,numDendSegments+lenbfNotch): print i dx=comptLen dy=0 comptDia -=0.5e-07 print comptDia compt=rd.buildCompt(dend,'dend'+str(i),RM=RM,RA=RA,CM=CM,x=x,dx=dx,dy=dy,dia=comptDia) moose.connect(prev,'axial',compt,'raxial') prev=compt x+=dx y+=dy for i in range(numDendSegments+lenbfNotch,numDendSegments+lenbfNotch+lenafNotch): dx=comptLen dy=0 comptDia +=0.5e-07 print comptDia compt=rd.buildCompt(dend,'dend'+str(i),RM=RM,RA=RA,CM=CM,x=x,dx=dx,dy=dy,dia=comptDia) moose.connect(prev,'axial',compt,'raxial') prev=compt x+=dx y+=dy for i in range (numDendSegments+lenbfNotch+lenafNotch,numDendSegments+lenbfNotch+lenafNotch+numDendSegmentsSlope): dx=comptLen dy=0 #comptDia -=0.1e-07 print comptDia compt=rd.buildCompt(dend,'dend'+str(i),RM=RM,RA=RA,CM=CM,x=x,y=y,dx=dx,dy=dy,dia=comptDia) moose.connect(prev,'axial',compt,'raxial') prev=compt x+=dx y+=dy #compt=rd.buildCompt(dend,'dendL',RM=RM,RA=RA,CM=CM,x=x,y=y,dx=comptLenBuff,dy=dy,dia=comptDia) #moose.connect(prev,'axial',compt,'raxial') return dend
def makeYmodel(): segLen = dendLength / numDendSeg rdes = rd.rdesigneur( stealCellFromLibrary=True, verbose=False, # cellProto syntax: ['ballAndStick', 'name', somaDia, somaLength, dendDia, dendLength, numDendSegments ] # The numerical arguments are all optional cellProto=[[ 'ballAndStick', 'cellBase', dendDia, segLen, dendDia, dendLength, numDendSeg ]], passiveDistrib=[[ '#', 'RM', str(dendRM), 'CM', str(dendCM), 'RA', str(dendRA) ]], stimList=[['soma', '1', '.', 'inject', stimStr]], ) # Build the arms of the Y for a branching cell. pa = moose.element('/library/cellBase') x = length y = 0.0 dx = length / (numDendSeg * np.sqrt(2.0)) dy = dx prevc1 = moose.element('/library/cellBase/dend{}'.format(numDendSeg - 1)) prevc2 = prevc1 for i in range(numDendSeg): c1 = rd.buildCompt(pa, 'branch1_{}'.format(i), RM=RM, CM=CM, RA=RA, dia=dia, x=x, y=y, dx=dx, dy=dy) c2 = rd.buildCompt(pa, 'branch2_{}'.format(i), RM=RM, CM=CM, RA=RA, dia=dia, x=x, y=-y, dx=dx, dy=-dy) moose.connect(prevc1, 'axial', c1, 'raxial') moose.connect(prevc2, 'axial', c2, 'raxial') prevc1 = c1 prevc2 = c2 x += dx y += dy rdes.buildModel()
def makeDendProto(): dend = moose.Neuron('/library/dend') prev = rd.buildCompt(dend, 'soma', RM=RM, RA=RA, CM=CM, dia=10e-06, x=0, dx=comptLenBuff) x = comptLenBuff y = 0.0 comptDia = 10e-06 for i in range(numDendSegments): dx = comptLen dy = 0 #comptDia +=1.7e-08 compt = rd.buildCompt(dend, 'dend' + str(i), RM=RM, RA=RA, CM=CM, x=x, y=y, dx=dx, dy=dy, dia=comptDia) moose.connect(prev, 'axial', compt, 'raxial') prev = compt x += dx y += dy compt = rd.buildCompt(dend, 'dendL', RM=RM, RA=RA, CM=CM, x=x, y=y, dx=comptLenBuff, dy=dy, dia=comptDia) moose.connect(prev, 'axial', compt, 'raxial') return dend
def makeAxonProto(): axon = moose.Neuron( '/library/axon' ) prev = rd.buildCompt( axon, 'soma', RM = RM, RA = RA, CM = CM, dia = 10e-6, x=0, dx=comptLen) theta = 0 x = comptLen y = 0.0 for i in range( numAxonSegments ): dx = comptLen * np.cos( theta ) dy = comptLen * np.sin( theta ) r = np.sqrt( x * x + y * y ) theta += comptLen / r compt = rd.buildCompt( axon, 'axon' + str(i), RM = RM, RA = RA, CM = CM, x = x, y = y, dx = dx, dy = dy, dia = comptDia ) moose.connect( prev, 'axial', compt, 'raxial' ) prev = compt x += dx y += dy return axon
def makeCellProto(name): elec = moose.Neuron('/library/' + name) ecompt = [] ec = rd.buildCompt(elec, 'dend', dx=dendLen, dia=2.0e-6, x=0, RM=RM, RA=RA, CM=CM) elec.buildSegmentTree()
def makeSpineProto2(name): spine = moose.Neutral('/library/' + name) shaft = rd.buildCompt(spine, 'shaft', dz=1e-6, dx=0, dia=0.2e-6, z=0, RM=RM, RA=RA, CM=CM) head = rd.buildCompt(spine, 'head', dz=0.5e-6, dx=0, dia=0.5e-6, z=1e-6, RM=RM, RA=RA, CM=CM) moose.connect(shaft, 'axial', head, 'raxial')
def makeCellProto(name): elec = moose.Neuron('/library/' + name) ecompt = [] ###soma = rd.buildCompt( elec, 'soma', dx=somaDia, dia=somaDia, x=-somaDia, RM=RM, RA=RA, CM=CM ) dend = rd.buildCompt(elec, 'dend', dx=dendLen, dia=dendDia, x=0, RM=RM, RA=RA, CM=CM) ###moose.connect( soma, 'axial', dend, 'raxial' ) elec.buildSegmentTree()
def makeCellProto( name ): print(('IN: makeCellProto( ', name, ')')) elec = moose.Neuron( '/library/' + name ) ecompt = [] for i in range( numDendSegments ): ec = rd.buildCompt( elec, 'dend' + str(i), segLen, 2.0e-6, i * segLen, RM, RA, CM ) ecompt.append( ec ) if i > 0: moose.connect( ecompt[i-1], 'axial', ec, 'raxial' ) else: ec.name = "soma" for i in ecompt: i.z0 = i.x0 i.x0 = 0 i.z = i.x i.x = 0
def makeCellProto(name): print(('IN: makeCellProto( ', name, ')')) elec = moose.Neuron('/library/' + name) ecompt = [] for i in range(numDendSegments): ec = rd.buildCompt(elec, 'dend' + str(i), segLen, 2.0e-6, i * segLen, RM, RA, CM) ecompt.append(ec) if i > 0: moose.connect(ecompt[i - 1], 'axial', ec, 'raxial') else: ec.name = "soma" for i in ecompt: i.z0 = i.x0 i.x0 = 0 i.z = i.x i.x = 0
def makeSpineProto2( name ): spine = moose.Neutral( '/library/' + name ) shaft = rd.buildCompt( spine, 'shaft', 0.5e-6, 0.4e-6, 0, RM, RA, CM ) head = rd.buildCompt( spine, 'head', 0.5e-6, 0.5e-6, 0.5e-6, RM, RA, CM ) moose.connect( shaft, 'axial', head, 'raxial' )
def makeSpineProto2( name ): spine = moose.Neutral( '/library/' + name ) shaft = rd.buildCompt( spine, 'shaft', dz=1e-6, dx = 0, dia=0.2e-6, z=0, RM=RM, RA=RA, CM=CM ) head = rd.buildCompt( spine, 'head', dz=0.5e-6, dx = 0, dia=0.5e-6, z=1e-6, RM=RM, RA=RA, CM=CM ) moose.connect( shaft, 'axial', head, 'raxial' )
def makeCellProto( name ): elec = moose.Neuron( '/library/' + name ) ecompt = [] ec = rd.buildCompt( elec, 'dend', dendLen, 2.0e-6, 0, RM, RA, CM ) elec.buildSegmentTree()
def makeYmodel(): length = rec[0].geom dia = rec[3].geom segLen = length / numDendSeg cp = [['make_glu()', 'glu'], ['make_GABA()', 'GABA']] cp.extend(spikingProto) cd = [['glu', 'dend9', 'Gbar', str(rec[0].Gbar)], ['glu', 'branch1_9', 'Gbar', str(rec[1].Gbar)], ['glu', 'branch2_9', 'Gbar', str(rec[2].Gbar)], ['GABA', 'dend9', 'Gbar', str(rec[3].Gbar)], ['GABA', 'branch1_9', 'Gbar', str(rec[4].Gbar)], ['GABA', 'branch2_9', 'Gbar', str(rec[5].Gbar)]] cd.extend(spikingDistrib) rdes = rd.rdesigneur( elecPlotDt=elecPlotDt, stealCellFromLibrary=True, verbose=False, #chanProto = [['make_glu()', 'glu'],['make_GABA()', 'GABA']], chanProto=cp, # cellProto syntax: ['ballAndStick', 'name', somaDia, somaLength, dendDia, dendLength, numDendSegments ] # The numerical arguments are all optional cellProto=[[ 'ballAndStick', 'cellBase', dia, segLen, dia, length, numDendSeg ]], passiveDistrib=[['#', 'RM', str(RM), 'CM', str(CM), 'RA', str(RA)]], chanDistrib=cd, #chanDistrib = [ #['glu', 'dend9', 'Gbar', str(rec[0].Gbar)], #['glu', 'branch1_9', 'Gbar', str(rec[1].Gbar)], #['glu', 'branch2_9', 'Gbar', str(rec[2].Gbar)], #['GABA', 'dend9', 'Gbar', str(rec[3].Gbar)], #['GABA', 'branch1_9', 'Gbar', str(rec[4].Gbar)], #['GABA', 'branch2_9', 'Gbar', str(rec[5].Gbar)], #], stimList=[ [ 'dend9', '1', 'glu', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[0].inputFreq, rec[0].onset, rec[0].onset + rec[0].inputDuration) ], [ 'branch1_9', '1', 'glu', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[1].inputFreq, rec[1].onset, rec[1].onset + rec[1].inputDuration) ], [ 'branch2_9', '1', 'glu', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[2].inputFreq, rec[2].onset, rec[2].onset + rec[2].inputDuration) ], [ 'dend9', '1', 'GABA', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[3].inputFreq, rec[3].onset, rec[3].onset + rec[3].inputDuration) ], [ 'branch1_9', '1', 'GABA', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[4].inputFreq, rec[4].onset, rec[4].onset + rec[4].inputDuration) ], [ 'branch2_9', '1', 'GABA', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[5].inputFreq, rec[5].onset, rec[5].onset + rec[5].inputDuration) ], #['dend9,branch1_9,branch2_9', '1','glu', 'periodicsyn', '100*(t>0.01 && t<0.02)'], ], plotList=[ ['soma,dend9,branch1_9,branch2_9', '1', '.', 'Vm'], ], ) # Modify some library values based on the slider controls glu = moose.element('/library/glu') gaba = moose.element('/library/GABA') glu.tau1 = rec[0].tau1 glu.tau2 = rec[1].tau2 glu.Ek = rec[2].Ek gaba.tau1 = rec[3].tau1 gaba.tau2 = rec[4].tau2 gaba.Ek = rec[5].Ek # Build the arms of the Y for a branching cell. pa = moose.element('/library/cellBase') x1 = length x2 = length y1 = 0.0 y2 = 0.0 dx1 = rec[1].geom / (numDendSeg * np.sqrt(2.0)) dx2 = rec[2].geom / (numDendSeg * np.sqrt(2.0)) dia1 = rec[4].geom dia2 = rec[5].geom dy1 = dx1 dy2 = -dx2 prevc1 = moose.element('/library/cellBase/dend{}'.format(numDendSeg - 1)) prevc2 = prevc1 for i in range(numDendSeg): c1 = rd.buildCompt(pa, 'branch1_{}'.format(i), RM=RM, CM=CM, RA=RA, dia=dia1, x=x1, y=y1, dx=dx1, dy=dy1) c2 = rd.buildCompt(pa, 'branch2_{}'.format(i), RM=RM, CM=CM, RA=RA, dia=dia2, x=x2, y=y2, dx=dx2, dy=dy2) moose.connect(prevc1, 'axial', c1, 'raxial') moose.connect(prevc2, 'axial', c2, 'raxial') prevc1 = c1 prevc2 = c2 x1 += dx1 y1 += dy1 x2 += dx2 y2 += dy2 rdes.elecid.buildSegmentTree() # rebuild it as we've added the branches rdes.buildModel() # Permit fast spiking input. #for i in moose.wildcardFind( '/model/##[ISA=RandSpike]' ): for i in moose.wildcardFind('/model/elec/#/#/#/#/synInput_rs'): #print i.path, i.refractT i.refractT = 0.002 '''
def makeYmodel(): length = rec[0].geom dia = rec[3].geom segLen = length / numDendSeg cp = [['make_glu()', 'glu'],['make_GABA()', 'GABA']] cp.extend( spikingProto ) cd = [ ['glu', 'dend9', 'Gbar', str(rec[0].Gbar)], ['glu', 'branch1_9', 'Gbar', str(rec[1].Gbar)], ['glu', 'branch2_9', 'Gbar', str(rec[2].Gbar)], ['GABA', 'dend9', 'Gbar', str(rec[3].Gbar)], ['GABA', 'branch1_9', 'Gbar', str(rec[4].Gbar)], ['GABA', 'branch2_9', 'Gbar', str(rec[5].Gbar)] ] cd.extend( spikingDistrib ) rdes = rd.rdesigneur( elecPlotDt = elecPlotDt, stealCellFromLibrary = True, verbose = False, #chanProto = [['make_glu()', 'glu'],['make_GABA()', 'GABA']], chanProto = cp, # cellProto syntax: ['ballAndStick', 'name', somaDia, somaLength, dendDia, dendLength, numDendSegments ] # The numerical arguments are all optional cellProto = [['ballAndStick', 'cellBase', dia, segLen, dia, length, numDendSeg]], passiveDistrib = [[ '#', 'RM', str(RM), 'CM', str(CM), 'RA', str(RA) ]], chanDistrib = cd, #chanDistrib = [ #['glu', 'dend9', 'Gbar', str(rec[0].Gbar)], #['glu', 'branch1_9', 'Gbar', str(rec[1].Gbar)], #['glu', 'branch2_9', 'Gbar', str(rec[2].Gbar)], #['GABA', 'dend9', 'Gbar', str(rec[3].Gbar)], #['GABA', 'branch1_9', 'Gbar', str(rec[4].Gbar)], #['GABA', 'branch2_9', 'Gbar', str(rec[5].Gbar)], #], stimList = [ ['dend9', '1','glu', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[0].inputFreq, rec[0].onset, rec[0].onset + rec[0].inputDuration) ], ['branch1_9', '1','glu', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[1].inputFreq, rec[1].onset, rec[1].onset + rec[1].inputDuration) ], ['branch2_9', '1','glu', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[2].inputFreq, rec[2].onset, rec[2].onset + rec[2].inputDuration) ], ['dend9', '1','GABA', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[3].inputFreq, rec[3].onset, rec[3].onset + rec[3].inputDuration) ], ['branch1_9', '1','GABA', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[4].inputFreq, rec[4].onset, rec[4].onset + rec[4].inputDuration) ], ['branch2_9', '1','GABA', 'periodicsyn', '{}*(t>{:.3f} && t<{:.3f})'.format( rec[5].inputFreq, rec[5].onset, rec[5].onset + rec[5].inputDuration) ], #['dend9,branch1_9,branch2_9', '1','glu', 'periodicsyn', '100*(t>0.01 && t<0.02)'], ], plotList = [ ['soma,dend9,branch1_9,branch2_9', '1','.', 'Vm'], ], ) # Modify some library values based on the slider controls glu = moose.element( '/library/glu' ) gaba = moose.element( '/library/GABA' ) glu.tau1 = rec[0].tau1 glu.tau2 = rec[1].tau2 glu.Ek = rec[2].Ek gaba.tau1 = rec[3].tau1 gaba.tau2 = rec[4].tau2 gaba.Ek = rec[5].Ek # Build the arms of the Y for a branching cell. pa = moose.element( '/library/cellBase' ) x1 = length x2 = length y1 = 0.0 y2 = 0.0 dx1 = rec[1].geom / ( numDendSeg * np.sqrt(2.0) ) dx2 = rec[2].geom / ( numDendSeg * np.sqrt(2.0) ) dia1 = rec[4].geom dia2 = rec[5].geom dy1 = dx1 dy2 = -dx2 prevc1 = moose.element( '/library/cellBase/dend{}'.format( numDendSeg-1 ) ) prevc2 = prevc1 for i in range( numDendSeg ): c1 = rd.buildCompt( pa, 'branch1_{}'.format(i), RM = RM, CM = CM, RA = RA, dia = dia1, x=x1, y=y1, dx = dx1, dy = dy1 ) c2 = rd.buildCompt( pa, 'branch2_{}'.format(i), RM = RM, CM = CM, RA = RA, dia = dia2, x=x2, y=y2, dx = dx2, dy = dy2 ) moose.connect( prevc1, 'axial', c1, 'raxial' ) moose.connect( prevc2, 'axial', c2, 'raxial' ) prevc1 = c1 prevc2 = c2 x1 += dx1 y1 += dy1 x2 += dx2 y2 += dy2 rdes.elecid.buildSegmentTree() # rebuild it as we've added the branches rdes.buildModel() # Permit fast spiking input. #for i in moose.wildcardFind( '/model/##[ISA=RandSpike]' ): for i in moose.wildcardFind( '/model/elec/#/#/#/#/synInput_rs' ): #print i.path, i.refractT i.refractT = 0.002 '''