示例#1
0
def makeChemProto(name):
    chem = moose.Neutral('/library/' + name)
    comptVol = diffLen * dendDia * dendDia * PI / 4.0
    for i in (['dend', comptVol], ['spine', 1e-19], ['psd', 1e-20]):
        print(('making ', i))
        compt = moose.CubeMesh(chem.path + '/' + i[0])
        compt.volume = i[1]
        z = moose.Pool(compt.path + '/z')
        z.concInit = 0.0
        z.diffConst = diffConst
    nInit = comptVol * 6e23 * concInit
    nstr = str(1 / nInit)

    x = moose.Pool(chem.path + '/dend/x')
    x.diffConst = diffConst
    func = moose.Function(x.path + '/func')
    func.expr = "-x0 * (0.3 - " + nstr + " * x0) * ( 1 - " + nstr + " * x0)"
    print((func.expr))
    func.x.num = 1
    moose.connect(x, 'nOut', func.x[0], 'input')
    moose.connect(func, 'valueOut', x, 'increment')
    z = moose.element('/library/' + name + '/dend/z')
    reac = moose.Reac('/library/' + name + '/dend/reac')
    reac.Kf = 1
    reac.Kb = 10
    moose.connect(reac, 'sub', x, 'reac')
    moose.connect(reac, 'prd', z, 'reac')
示例#2
0
def showVisualization():
    makeModel()
    elec = moose.element('/model/elec')
    elec.setSpineAndPsdMesh(moose.element('/model/chem/spine'),
                            moose.element('/model/chem/psd'))

    eHead = moose.wildcardFind('/model/elec/#head#')
    oldDia = [i.diameter for i in eHead]
    graphs = moose.Neutral('/graphs')
    #makePlot( 'psd_x', moose.vec( '/model/chem/psd/x' ), 'getN' )
    #makePlot( 'head_x', moose.vec( '/model/chem/spine/x' ), 'getN' )
    makePlot('dend_x', moose.vec('/model/chem/dend/x'), 'getN')
    dendZ = makePlot('dend_z', moose.vec('/model/chem/dend/z'), 'getN')
    makePlot('head_z', moose.vec('/model/chem/spine/z'), 'getN')
    psdZ = makePlot('psd_z', moose.vec('/model/chem/psd/z'), 'getN')
    diaTab = makePlot('headDia', eHead, 'getDiameter')
    dendrite = moose.element("/model/elec/dend")
    dendrites = [dendrite.path + "/" + str(i) for i in range(len(dendZ))]
    moose.reinit()

    spineHeads = moose.wildcardFind('/model/elec/#head#')

    if doMoo:
        app = QtGui.QApplication(sys.argv)
        viewer = create_viewer("/model/elec", dendrite, dendZ, diaTab, psdZ)
        viewer.showMaximized()
        viewer.start()
        return app.exec_()
示例#3
0
def makeModel():
    moose.Neutral('/library')
    makeCellProto('cellProto')
    makeChemProto('cProto')
    rdes = rd.rdesigneur(
        useGssa=False,
        turnOffElec=True,
        chemDt=0.1,
        diffDt=0.1,
        combineSegments=False,
        stealCellFromLibrary=True,
        diffusionLength=1e-6,
        cellProto=[['cellProto', 'elec']],
        spineProto=[['makePassiveSpine()', 'spine']],
        chemProto=[['cProto', 'chem']],
        spineDistrib=[[
            'spine', '#',
            str(spineSpacing),
            str(spineSpacingDistrib),
            str(spineSize),
            str(spineSizeDistrib),
            str(spineAngle),
            str(spineAngleDistrib)
        ]],
        chemDistrib=[["chem", "#dend#,#psd#", "install", "1"]],
        adaptorList=[
            ['psd/z', 'n', 'spine', 'psdArea', 50.0e-15, 500e-15],
        ])
    moose.seed(1234)
    rdes.buildModel('/model')
    print('built model')
    x = moose.vec('/model/chem/dend/x')
    x.concInit = 0.0
    for i in range(0, 20):
        x[i].concInit = concInit
示例#4
0
def main():
    """
    This illustrates the use of rdesigneur to build a simple dendrite with
    spines, and then to resize them using spine fields. These are the
    fields that would be changed dynamically in a simulation with reactions
    that affect spine geometry.
    In this simulation there is a propagating reaction wave using a
    highly abstracted equation, whose product diffuses into the spines and
    makes them bigger.
    """
    makeModel()
    elec = moose.element('/model/elec')
    elec.setSpineAndPsdMesh(moose.element('/model/chem/spine'),
                            moose.element('/model/chem/psd'))

    eHead = moose.wildcardFind('/model/elec/#head#')
    oldDia = [i.diameter for i in eHead]
    graphs = moose.Neutral('/graphs')
    #makePlot( 'psd_x', moose.vec( '/model/chem/psd/x' ), 'getN' )
    #makePlot( 'head_x', moose.vec( '/model/chem/spine/x' ), 'getN' )
    makePlot('dend_x', moose.vec('/model/chem/dend/x'), 'getN')
    makePlot('dend_z', moose.vec('/model/chem/dend/z'), 'getN')
    makePlot('head_z', moose.vec('/model/chem/spine/z'), 'getN')
    makePlot('psd_z', moose.vec('/model/chem/psd/z'), 'getN')
    makePlot('headDia', eHead, 'getDiameter')
    '''
    debug = moose.PyRun( '/pyrun' )
    debug.tick = 10
    debug.runString = """print( "RUNNING: ", moose.element( '/model/chem/psd/z').n, moose.element( '/model/elec/head0' ).diameter)"""
    '''
    moose.reinit()
    moose.start(runtime)

    displayPlots()
    pylab.plot(oldDia, label='old Diameter')
    pylab.plot([i.diameter for i in eHead], label='new Diameter')
    pylab.legend()
    pylab.show()

    if doMoo:
        app = QtGui.QApplication(sys.argv)
        morphology = moogli.read_morphology_from_moose(name="",
                                                       path='/model/elec')
        widget = moogli.MorphologyViewerWidget(morphology)
        widget.show()
        return app.exec_()
    quit()