def preLoopFunctions(self):
        self.powerspecdir = os.path.join(self.params['rundir'], "opimages")
        apParam.createDirectory(self.powerspecdir, warning=False)
        self.acerunq = None
        self.params['matdir'] = os.path.join(self.params['rundir'], "matfiles")
        self.params['tempdir'] = os.path.join(self.params['rundir'], "temp")
        apParam.createDirectory(os.path.join(self.params['matdir']),
                                warning=False)
        apParam.createDirectory(os.path.join(self.params['tempdir']),
                                warning=False)

        if self.params['sessionname'] is not None:
            self.params['outtextfile'] = os.path.join(
                self.params['rundir'], self.params['sessionname'] + ".txt")

        if self.params['xvfb'] is True:
            apParam.resetVirtualFrameBuffer()
        apMatlab.checkMatlabPath(self.params)
        acepath = os.path.join(os.getcwd(), self.functionname + ".py")
        #if not os.path.isfile(acepath):
        #	apDisplay.printWarning("'"+self.functionname+".py' usually needs to be run in the "+\
        #		"same directory as all of its matlab files")
        print "Connecting to matlab ... "
        if self.params['xvfb'] is True:
            apParam.resetVirtualFrameBuffer()
        try:
            self.matlab = pymat.open()
            #self.matlab = pymat.open('matlab -nodisplay')
        except:
            apDisplay.environmentError()
            raise
        apMatlab.setAceConfig(self.matlab, self.params)
	def preLoopFunctions(self):
		self.powerspecdir = os.path.join(self.params['rundir'], "opimages")
		apParam.createDirectory(self.powerspecdir, warning=False)
		self.acerunq = None
		self.params['matdir']         = os.path.join(self.params['rundir'],"matfiles")
		self.params['tempdir']    = os.path.join(self.params['rundir'],"temp")
		apParam.createDirectory(os.path.join(self.params['matdir']), warning=False)
		apParam.createDirectory(os.path.join(self.params['tempdir']), warning=False)

		if self.params['sessionname'] is not None:
			self.params['outtextfile']=os.path.join(self.params['rundir'], self.params['sessionname']+".txt")
	
		if self.params['xvfb'] is True:
			apParam.resetVirtualFrameBuffer()
		apMatlab.checkMatlabPath(self.params)
		acepath = os.path.join(os.getcwd(), self.functionname+".py")
		#if not os.path.isfile(acepath):
		#	apDisplay.printWarning("'"+self.functionname+".py' usually needs to be run in the "+\
		#		"same directory as all of its matlab files")
		print "Connecting to matlab ... "
		if self.params['xvfb'] is True:
			apParam.resetVirtualFrameBuffer()
		try:
			self.matlab = pymat.open()
			#self.matlab = pymat.open('matlab -nodisplay')
		except:
			apDisplay.environmentError()
			raise
		apMatlab.setAceConfig(self.matlab, self.params)
def runChimeraScript(chimscript, xvfb=False):
        if not chimscript or not os.path.isfile(chimscript):
                print chimscript
                apDisplay.printError("Could not find file: apChimSnapshot.py")
        #apDisplay.printColor("Trying to use chimera for model imaging","cyan")
        if xvfb is True:
                port = apParam.resetVirtualFrameBuffer()
                time.sleep(1)
        if 'CHIMERA' in os.environ and os.path.isdir(os.environ['CHIMERA']):
                chimpath = os.environ['CHIMERA']
                os.environ['CHIMERA'] = chimpath
                os.environ['CHIMERAPATH'] = os.path.join(chimpath,"share")
                os.environ['LD_LIBRARY_PATH'] = os.path.join(chimpath,"lib")+":"+os.environ['LD_LIBRARY_PATH']
                chimexe = os.path.join(chimpath,"bin/chimera")
                if not os.path.isfile(chimexe):
                        apDisplay.printWarning("Could not find chimera at: "+chimexe)
        else:
                chimpath = None
                chimexe = "chimera"
                #apDisplay.printWarning("'CHIMERA' environmental variable is unset")
        rendercmd = (chimexe+" --debug python:"+chimscript)
        logf = open("chimeraRun.log", "a")
        apDisplay.printColor("running Chimera:\n "+rendercmd, "cyan")
        if xvfb is True:
                print "import -verbose -display :%d -window root screencapture.png"%(port)
        proc = subprocess.Popen(rendercmd, shell=True, stdout=logf, stderr=logf)
        proc.wait()
        logf.close()
        if xvfb is True:
                apParam.killVirtualFrameBuffer(port)
        return
Exemple #4
0
def runChimeraScript(chimscript, xvfb=False):
    if not chimscript or not os.path.isfile(chimscript):
        print chimscript
        apDisplay.printError("Could not find file: apChimSnapshot.py")
    #apDisplay.printColor("Trying to use chimera for model imaging","cyan")
    if xvfb is True:
        port = apParam.resetVirtualFrameBuffer()
        time.sleep(1)
    if 'CHIMERA' in os.environ and os.path.isdir(os.environ['CHIMERA']):
        chimpath = os.environ['CHIMERA']
        os.environ['CHIMERA'] = chimpath
        os.environ['CHIMERAPATH'] = os.path.join(chimpath, "share")
        os.environ['LD_LIBRARY_PATH'] = os.path.join(
            chimpath, "lib") + ":" + os.environ['LD_LIBRARY_PATH']
        chimexe = os.path.join(chimpath, "bin/chimera")
        if not os.path.isfile(chimexe):
            apDisplay.printWarning("Could not find chimera at: " + chimexe)
    else:
        chimpath = None
        chimexe = "chimera"
        #apDisplay.printWarning("'CHIMERA' environmental variable is unset")
    rendercmd = (chimexe + " --debug python:" + chimscript)
    logf = open("chimeraRun.log", "a")
    apDisplay.printColor("running Chimera:\n " + rendercmd, "cyan")
    if xvfb is True:
        print "import -verbose -display :%d -window root screencapture.png" % (
            port)
    proc = subprocess.Popen(rendercmd, shell=True, stdout=logf, stderr=logf)
    proc.wait()
    logf.close()
    if xvfb is True:
        apParam.killVirtualFrameBuffer(port)
    return