Пример #1
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_()
Пример #2
0
def displayPlots():
    for x in moose.wildcardFind('/graphs/#[0]'):
        tab = moose.vec(x)
        for i in range(len(tab)):
            pylab.plot(tab[i].vector, label=x.name[:-3] + " " + str(i))
        pylab.legend()
        pylab.figure()
Пример #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()